Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simpler Tcl way for extracting method variables

81 views
Skip to first unread message

yaha...@gmail.com

unread,
Sep 27, 2015, 6:11:36 AM9/27/15
to
I was looking at python c package and the way it extracts arguments that were sent to the procedure:
uint8_t *key;
char *in;
unsigned int i, lBuf, lKey;
PyArg_ParseTuple(args, "s#s#", &in, &lBuf, &key, &lKey)

The Tcl way is more complicated as far as I know:
Tcl_Obj * tempObj = NULL;
Tcl_ListObjIndex(interp,objv[1],0,&tempObj);
in=Tcl_GetString(tempObj)
.

Maybe I miss an elegant solution that matches the above.

yaha...@gmail.com

unread,
Oct 2, 2015, 10:45:39 AM10/2/15
to
In the end I did it properly with these commands:

in = Tcl_GetStringFromObj(objv[1], &lBuf);
key = Tcl_GetStringFromObj(objv[2], &lKey);

looking at it the tcl way looks cleaner :-)

Harald Oehlmann

unread,
Oct 3, 2015, 8:50:57 AM10/3/15
to
Yes, that is the normal way to access variables in C.

Great,
Harald
0 new messages