From: Michael K. <mi...@mu...> - 2009-05-20 03:32:27
|
This may not be a direct opinion as to your specific question, but both of those look (IMHO) like throwbacks from the days before objects. Assuming the precision change isn't an issue, why wouldn't you use... EntryVisibleRange(entryPtr, &first, &last); objPtr = Tcl_DuplicateObj(entryPtr->scrollCmd); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewDoubleObj(first)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewDoubleObj(last)); code = Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL|TCL_EVAL_DIRECT); ...? -- Michael Kirkham President & CEO Muonics, Inc. http://www.muonics.com/ On Tue, 19 May 2009, Jeff Hobbs wrote: > Date: Tue, 19 May 2009 19:57:06 -0700 > From: Jeff Hobbs <je...@ac...> > To: Tcl Core List <tcl...@li...> > Subject: [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...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-core > |