chiark
/
gitweb
/
~ian
/
chiark-tcl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c48252f
)
slight improvements to scriptinv, including scriptinv_invoke_fg
author
ian
<ian>
Sun, 22 Jan 2006 15:59:47 +0000
(15:59 +0000)
committer
ian
<ian>
Sun, 22 Jan 2006 15:59:47 +0000
(15:59 +0000)
base/chiark-tcl.h
patch
|
blob
|
history
base/scriptinv.c
patch
|
blob
|
history
diff --git
a/base/chiark-tcl.h
b/base/chiark-tcl.h
index 4c022cb82c8c5922ecf2ac7046af64643a8e4216..f3f0922bdc1320708687bc25c23f3015f6b57979 100644
(file)
--- a/
base/chiark-tcl.h
+++ b/
base/chiark-tcl.h
@@
-39,7
+39,7
@@
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;
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;
+ int llength;
/* after set, is llength of script + xargs */
} ScriptToInvoke;
void cht_scriptinv_init(ScriptToInvoke *si);
} ScriptToInvoke;
void cht_scriptinv_init(ScriptToInvoke *si);
@@
-48,7
+48,12
@@
int cht_scriptinv_set(ScriptToInvoke *si, Tcl_Interp *ip,
void cht_scriptinv_cancel(ScriptToInvoke *si); /* then don't invoke */
/* no separate free function - just cancel */
void cht_scriptinv_cancel(ScriptToInvoke *si); /* then don't invoke */
/* no separate free function - just cancel */
+int cht_scriptinv_invoke_fg(ScriptToInvoke *si, int argc,
+ Tcl_Obj *const *argv);
+ /* if script fails, returns that error */
+
void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv);
void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv);
+ /* if script fails, reports it with Tcl_BackgroundError */
/* from idtable.c */
/* from idtable.c */
diff --git
a/base/scriptinv.c
b/base/scriptinv.c
index 3bc383d9c847cf2857573f0efc7bd8784ca3f7f8..6dd53755e79963f7877c652dab926552faffac27 100644
(file)
--- a/
base/scriptinv.c
+++ b/
base/scriptinv.c
@@
-34,7
+34,8
@@
int cht_scriptinv_set(ScriptToInvoke *si, Tcl_Interp *ip,
return 0;
}
return 0;
}
-void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv) {
+int cht_scriptinv_invoke_fg(ScriptToInvoke *si, int argc,
+ Tcl_Obj *const *argv) {
Tcl_Obj *invoke=0;
int i, rc;
Tcl_Obj *invoke=0;
int i, rc;
@@
-60,5
+61,10
@@
void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv) {
x_rc:
for (i=0; i<argc; i++) Tcl_DecrRefCount(argv[i]);
if (invoke) Tcl_DecrRefCount(invoke);
x_rc:
for (i=0; i<argc; i++) Tcl_DecrRefCount(argv[i]);
if (invoke) Tcl_DecrRefCount(invoke);
-
if (rc) Tcl_BackgroundError(si->ip)
;
+
return rc
;
}
}
+
+void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv) {
+ rc= cht_scriptinv_invoke_fg(si, argc, argv);
+ if (rc) Tcl_BackgroundError(si->ip);
+}