Fossil SCM

Skip calling Tcl_InitStubs when not compiled to use the Tcl stubs mechanism.

mistachkin 2012-09-29 07:29 UTC tclStubsV2
Commit 1f4cfd5776eb4ad769002030da9eb528e3a8f935
1 file changed +9 -6
+9 -6
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -293,18 +293,18 @@
293293
int argc,
294294
const char **argv,
295295
int *argl
296296
){
297297
Tcl_Interp *tclInterp;
298
-#ifndef USE_TCL_EVALOBJV
298
+#if !defined(USE_TCL_EVALOBJV)
299299
Tcl_Command command;
300300
Tcl_CmdInfo cmdInfo;
301301
#endif
302302
int rc;
303303
int nResult;
304304
const char *zResult;
305
-#ifndef USE_TCL_EVALOBJV
305
+#if !defined(USE_TCL_EVALOBJV)
306306
Tcl_Obj *objPtr;
307307
#endif
308308
USE_ARGV_TO_OBJV();
309309
310310
if ( createTclInterp(interp, ctx)!=TH_OK ){
@@ -317,11 +317,11 @@
317317
if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
318318
Th_ErrorMessage(interp, "invalid Tcl interpreter", (const char *)"", 0);
319319
return TH_ERROR;
320320
}
321321
Tcl_Preserve((ClientData)tclInterp);
322
-#ifndef USE_TCL_EVALOBJV
322
+#if !defined(USE_TCL_EVALOBJV)
323323
objPtr = Tcl_NewStringObj(argv[1], argl[1]);
324324
Tcl_IncrRefCount(objPtr);
325325
command = Tcl_GetCommandFromObj(tclInterp, objPtr);
326326
if( !command || Tcl_GetCommandInfoFromToken(command,&cmdInfo)==0 ){
327327
Th_ErrorMessage(interp, "Tcl command not found:", argv[1], argl[1]);
@@ -336,11 +336,11 @@
336336
return TH_ERROR;
337337
}
338338
Tcl_DecrRefCount(objPtr);
339339
#endif
340340
COPY_ARGV_TO_OBJV();
341
-#ifdef USE_TCL_EVALOBJV
341
+#if defined(USE_TCL_EVALOBJV)
342342
rc = Tcl_EvalObjv(tclInterp, objc, objv, 0);
343343
#else
344344
Tcl_ResetResult(tclInterp);
345345
rc = cmdInfo.objProc(cmdInfo.objClientData, tclInterp, objc, objv);
346346
#endif
@@ -602,12 +602,15 @@
602602
if( argc>0 && argv ){
603603
argv0 = argv[0];
604604
}
605605
tclContext->xFindExecutable(argv0);
606606
tclInterp = tclContext->xCreateInterp();
607
- if( !tclInterp || !Tcl_InitStubs(tclInterp, "8.4", 0)
608
- || Tcl_InterpDeleted(tclInterp) ){
607
+ if( !tclInterp ||
608
+#if defined(USE_TCL_STUBS)
609
+ !Tcl_InitStubs(tclInterp, "8.4", 0) ||
610
+#endif
611
+ Tcl_InterpDeleted(tclInterp) ){
609612
Th_ErrorMessage(interp,
610613
"Could not create Tcl interpreter", (const char *)"", 0);
611614
return TH_ERROR;
612615
}
613616
tclContext->interp = tclInterp;
614617
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -293,18 +293,18 @@
293 int argc,
294 const char **argv,
295 int *argl
296 ){
297 Tcl_Interp *tclInterp;
298 #ifndef USE_TCL_EVALOBJV
299 Tcl_Command command;
300 Tcl_CmdInfo cmdInfo;
301 #endif
302 int rc;
303 int nResult;
304 const char *zResult;
305 #ifndef USE_TCL_EVALOBJV
306 Tcl_Obj *objPtr;
307 #endif
308 USE_ARGV_TO_OBJV();
309
310 if ( createTclInterp(interp, ctx)!=TH_OK ){
@@ -317,11 +317,11 @@
317 if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
318 Th_ErrorMessage(interp, "invalid Tcl interpreter", (const char *)"", 0);
319 return TH_ERROR;
320 }
321 Tcl_Preserve((ClientData)tclInterp);
322 #ifndef USE_TCL_EVALOBJV
323 objPtr = Tcl_NewStringObj(argv[1], argl[1]);
324 Tcl_IncrRefCount(objPtr);
325 command = Tcl_GetCommandFromObj(tclInterp, objPtr);
326 if( !command || Tcl_GetCommandInfoFromToken(command,&cmdInfo)==0 ){
327 Th_ErrorMessage(interp, "Tcl command not found:", argv[1], argl[1]);
@@ -336,11 +336,11 @@
336 return TH_ERROR;
337 }
338 Tcl_DecrRefCount(objPtr);
339 #endif
340 COPY_ARGV_TO_OBJV();
341 #ifdef USE_TCL_EVALOBJV
342 rc = Tcl_EvalObjv(tclInterp, objc, objv, 0);
343 #else
344 Tcl_ResetResult(tclInterp);
345 rc = cmdInfo.objProc(cmdInfo.objClientData, tclInterp, objc, objv);
346 #endif
@@ -602,12 +602,15 @@
602 if( argc>0 && argv ){
603 argv0 = argv[0];
604 }
605 tclContext->xFindExecutable(argv0);
606 tclInterp = tclContext->xCreateInterp();
607 if( !tclInterp || !Tcl_InitStubs(tclInterp, "8.4", 0)
608 || Tcl_InterpDeleted(tclInterp) ){
 
 
 
609 Th_ErrorMessage(interp,
610 "Could not create Tcl interpreter", (const char *)"", 0);
611 return TH_ERROR;
612 }
613 tclContext->interp = tclInterp;
614
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -293,18 +293,18 @@
293 int argc,
294 const char **argv,
295 int *argl
296 ){
297 Tcl_Interp *tclInterp;
298 #if !defined(USE_TCL_EVALOBJV)
299 Tcl_Command command;
300 Tcl_CmdInfo cmdInfo;
301 #endif
302 int rc;
303 int nResult;
304 const char *zResult;
305 #if !defined(USE_TCL_EVALOBJV)
306 Tcl_Obj *objPtr;
307 #endif
308 USE_ARGV_TO_OBJV();
309
310 if ( createTclInterp(interp, ctx)!=TH_OK ){
@@ -317,11 +317,11 @@
317 if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
318 Th_ErrorMessage(interp, "invalid Tcl interpreter", (const char *)"", 0);
319 return TH_ERROR;
320 }
321 Tcl_Preserve((ClientData)tclInterp);
322 #if !defined(USE_TCL_EVALOBJV)
323 objPtr = Tcl_NewStringObj(argv[1], argl[1]);
324 Tcl_IncrRefCount(objPtr);
325 command = Tcl_GetCommandFromObj(tclInterp, objPtr);
326 if( !command || Tcl_GetCommandInfoFromToken(command,&cmdInfo)==0 ){
327 Th_ErrorMessage(interp, "Tcl command not found:", argv[1], argl[1]);
@@ -336,11 +336,11 @@
336 return TH_ERROR;
337 }
338 Tcl_DecrRefCount(objPtr);
339 #endif
340 COPY_ARGV_TO_OBJV();
341 #if defined(USE_TCL_EVALOBJV)
342 rc = Tcl_EvalObjv(tclInterp, objc, objv, 0);
343 #else
344 Tcl_ResetResult(tclInterp);
345 rc = cmdInfo.objProc(cmdInfo.objClientData, tclInterp, objc, objv);
346 #endif
@@ -602,12 +602,15 @@
602 if( argc>0 && argv ){
603 argv0 = argv[0];
604 }
605 tclContext->xFindExecutable(argv0);
606 tclInterp = tclContext->xCreateInterp();
607 if( !tclInterp ||
608 #if defined(USE_TCL_STUBS)
609 !Tcl_InitStubs(tclInterp, "8.4", 0) ||
610 #endif
611 Tcl_InterpDeleted(tclInterp) ){
612 Th_ErrorMessage(interp,
613 "Could not create Tcl interpreter", (const char *)"", 0);
614 return TH_ERROR;
615 }
616 tclContext->interp = tclInterp;
617

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button