[TCLCORE] The end for Tcl_PrintDouble in Tk?
by Jeff Hobbs other posts by this author
May 19 2009 7:59PM messages near this date
Re: [TCLCORE] Be a voice of OSS Scan Community
|
Re: [TCLCORE] The end for Tcl_PrintDouble in Tk?
In looking into the best solution for 2790615
https://sourceforge.net/tracker/?func=detail&atid=112997&aid=2790615&group_id=12997
Don noted that Tcl_ObjPrintf (added in 8.5) or Tcl_AppendFormatToObj
would be good alternatives to the coding changes I was using.
This would change, eg tkEntry.c:EntryUpdateScrollbar from (partial):
EntryVisibleRange(entryPtr, &first, &last);
Tcl_PrintDouble(NULL, first, firstStr);
Tcl_PrintDouble(NULL, last, lastStr);
objPtr = Tcl_NewStringObj(entryPtr-> scrollCmd, -1);
Tcl_IncrRefCount(objPtr);
Tcl_AppendStringsToObj(objPtr, " ", firstStr, " ", lastStr, NULL);
code = Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL|TCL_EVAL_DIRECT);
...
to:
EntryVisibleRange(entryPtr, &first, &last);
objPtr = Tcl_ObjPrintf("%s %f %f", entryPtr-> scrollCmd, first, last);
Tcl_IncrRefCount(objPtr);
code = Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL|TCL_EVAL_DIRECT);
...
the problem is that Tcl_PrintDouble takes into account the (now
deprecated) tcl_precision variable. The above causes errors in the test
suite for where "scrollCmd 0.0 1.0" was expected, it now receives
"scrollCmd 0.000000 1.000000". These are error cases that have exact
expectations on the string output.
Most uses of the ~25 Tcl_PrintDoubles in Tk relate to scrolling, and
that the values passed are moved through Tcl_PD, whereas the above goes
to the raw sprintf handling of %f.
The Tcl_PDs exist from the time that we sanitized everything and EIAS
was always true in Tk. Would changing this be considered a compat
issue, or just clean-up?
Jeff
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Jeff Hobbs
Joe English
dgp
Jeff Hobbs
Joe English
Michael Kirkham
Joe English
Jeff Hobbs
|