91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
-
-
+
|
}
/*
** Tcl context information used by TH1. This structure definition has been
** copied from and should be kept in sync with the one in "main.c".
*/
struct TclContext {
int argc;
char **argv;
char *argv0;
Tcl_Interp *interp;
};
/*
** Syntax:
**
** tclEval arg ?arg ...?
|
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
-
+
|
return rc;
}
/*
** Array of Tcl integration commands. Used when adding or removing the Tcl
** integration commands from TH1.
*/
static struct _Command {
static const struct _Command {
const char *zName;
Th_CommandProc xProc;
void *pContext;
} aCommand[] = {
{"tclEval", tclEval_command, 0},
{"tclExpr", tclExpr_command, 0},
{"tclInvoke", tclInvoke_command, 0},
|
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
|
-
-
+
+
|
Th_ErrorMessage(interp,
"Invalid Tcl context", (const char *)"", 0);
return TH_ERROR;
}
if ( tclContext->interp ){
return TH_OK;
}
if ( tclContext->argc>0 && tclContext->argv ) {
Tcl_FindExecutable(tclContext->argv[0]);
if ( tclContext->argv0 ){
Tcl_FindExecutable(tclContext->argv0);
}
tclInterp = tclContext->interp = Tcl_CreateInterp();
if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
Th_ErrorMessage(interp,
"Could not create Tcl interpreter", (const char *)"", 0);
return TH_ERROR;
}
|