Menu

#2 easier method to return data to tcl scripts

closed
None
5
2006-02-16
2003-01-08
Dan Chak
No

It would be nice if there was a simple way to return
data to a tcl script without having to do something
like this:

char result[256];
sprintf(result, "%f", h->pos.x);
Tcl_SetResult( Togl_Interp(togl),
result,
TCL_VOLATILE);
return TCL_OK;

I'd rather see something like:

Togl_result_printf("%f", h->pos.x);
return TCL_OK;

I used to use mktclapp to add GUIs to my c/c++
programs, and it had functionality similar to what I am
describing. It was *extremely* helpful when coding to
have such a simple way to return data.

Discussion

  • Don Porter

    Don Porter - 2003-03-31

    Logged In: YES
    user_id=80530

    What you want is Tcl_SetObjResult(interp,
    Tcl_NewDoubleObj(h->pos.x))

     
  • Tom Milford

    Tom Milford - 2003-03-31

    Logged In: YES
    user_id=745915

    Hi Dan,

    Give this a shot:

    Tcl_SetVar2Ex(interp, "dummy", NULL,
    Tcl_NewDoubleObj(h->pos.x), 0);

     
  • Greg Couch

    Greg Couch - 2005-09-13
    • assigned_to: nobody --> gregcouch
     
  • Greg Couch

    Greg Couch - 2006-02-16
    • status: open --> closed
     
  • Greg Couch

    Greg Couch - 2006-02-16

    Logged In: YES
    user_id=131838

    Followups say it all.

     

Log in to post a comment.