ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
Re: [TCLCORE] The end for Tcl_PrintDouble in Tk?
by Jeff Hobbs other posts by this author
May 20 2009 9:15AM messages near this date
Re: [TCLCORE] The end for Tcl_PrintDouble in Tk? | Re: [TCLCORE] The end for Tcl_PrintDouble in Tk?
On 20/05/2009 7:26 AM, Donal K. Fellows wrote:
>  Jeff Hobbs wrote:
> > 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);
> > ...
>  
>  That sort of shortening looks good, but you might also consider using %g 
>  instead of %f so that very large text and canvas widgets can still scroll.

I tried that, which causes test failures of a different variety (you get 
"1"/"0" instead of "1.0"/"0.0").  Don noted that that could cause issues 
with expr as dividing by float 0.0 (non-error Inf) has different 
behavior than int 0 (error).

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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved