The Tcl library provides a useful array of functions for the manipulation of lists. Here's a snippet to show how to obtain sub-string from a string argument. Here's the line of Tcl script that needs to be parsed. -baseFont {"Andika Basic" 8}Clearly a call to sscanf is not much use because it will break down the font name into two elements: "{Andika" and "Basic}". Better use the Tcl library function Tcl_ListObjIndex which enables list elements to be pulled out for further processing. The following snippet is taken from the print.c module: /* obtain values from a list */Tcl_Obj *pobj;gdouble size;/* font */Tcl_ListObjIndex ( interp, objv[i+1], 0, &pobj ); w->data->font = Tcl_GetString ( pobj );/* size */Tcl_ListObjIndex ( interp, objv[i+1], 1, &pobj ) ;Tcl_GetDoubleFromObj ( interp, pobj, &size ); |