65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
+
-
+
+
+
+
|
struct TclTCCState *ts;
TCCState *s;
Tcl_Obj *sym_addr;
static CONST char *options[] = {
"add_include_path", "add_file", "add_library",
"add_library_path", "add_symbol", "command", "compile",
"define", "get_symbol", "output_file", "undefine",
"parse_args",
(char *) NULL
};
enum options {
TCC4TCL_ADD_INCLUDE, TCC4TCL_ADD_FILE, TCC4TCL_ADD_LIBRARY,
TCC4TCL_ADD_LIBRARY_PATH, TCC4TCL_ADD_SYMBOL, TCC4TCL_COMMAND, TCC4TCL_COMPILE,
TCC4TCL_DEFINE, TCC4TCL_GET_SYMBOL, TCC4TCL_OUTPUT_FILE, TCC4TCL_UNDEFINE
TCC4TCL_DEFINE, TCC4TCL_GET_SYMBOL, TCC4TCL_OUTPUT_FILE, TCC4TCL_UNDEFINE,
TCC4TCL_PARSE_ARGS
};
char *str;
int rv;
int tcc_argc;
char **tcc_argv;
ts = (struct TclTCCState *) cdata;
s = ts->s;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "subcommand arg ?arg ...?");
return TCL_ERROR;
|
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
case TCC4TCL_UNDEFINE:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "symbol");
return TCL_ERROR;
}
tcc_undefine_symbol(s,Tcl_GetString(objv[2]));
return TCL_OK;
case TCC4TCL_PARSE_ARGS:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "args...");
return TCL_ERROR;
}
tcc_argc = objc - 2;
tcc_argv = (char **) ckalloc(sizeof(*tcc_argv) * (tcc_argc + 1));
for (index = 0; index < tcc_argc; index++) {
tcc_argv[index] = Tcl_GetString(objv[index + 2]);
}
tcc_argv[tcc_argc] = NULL;
tcc_parse_args(s, tcc_argc, tcc_argv);
return(TCL_OK);
default:
Tcl_Panic("internal error during option lookup");
}
return TCL_OK;
}
static int Tcc4tclCreateCmd( ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]){
|