/* from scriptinv.c */
-typedef struct { /* semi-opaque - read only, and then only where commented */
- Tcl_Interp *ip; /* valid, non-0 and useable if set */
- Tcl_Obj *obj; /* non-0 iff set (but only test for 0/non-0) */
- Tcl_Obj *xargs;
- int llength; /* after set, is llength of script + xargs */
+typedef struct { /* opaque; comments are for scriptinv.c impl'n only */
+ /* states: Cancelled Set */
+ Tcl_Interp *ipq; /* 0 valid, non-0, useable */
+ Tcl_Obj *script; /* 0 valid, non-0 */
+ Tcl_Obj *xargs; /* 0 valid, may be 0 */
+ int llen; /* undefined llength of script + xargs */
} ScriptToInvoke;
-void cht_scriptinv_init(ScriptToInvoke *si);
+void cht_scriptinv_init(ScriptToInvoke *si); /* undefined -> Cancelled */
int cht_scriptinv_set(ScriptToInvoke *si, Tcl_Interp *ip,
- Tcl_Obj *newscript, Tcl_Obj *xargs);
-void cht_scriptinv_cancel(ScriptToInvoke *si); /* then don't invoke */
- /* no separate free function - just cancel */
+ Tcl_Obj *newscript, Tcl_Obj *xargs);
+ /* Cancelled/Set -> Set (newscript!=0, ok) / Cancelled (otherwise) */
+void cht_scriptinv_cancel(ScriptToInvoke *si);
+ /* Cancelled/Set -> Cancelled. No separate free function - just cancel. */
+#define cht_scriptinv_interp(si) ((si)->ipq)
+ /* int cht_scriptinv_interp(ScriptToInvoke *si); returns 0 if Cancelled */
int cht_scriptinv_invoke_fg(ScriptToInvoke *si, int argc,
Tcl_Obj *const *argv);
+ /* is a no-op if Cancelled rather than Set */
/* if script fails, returns that error */
void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv);