Fossil SCM
Support overriding the USE_TCL_EVALOBJV define via a custom Makefile.
Commit
5782fa032e1b67a7b84de0a5aff24f927fee23ff
Parent
249f6075d9c207d…
1 file changed
+15
-9
+15
-9
| --- src/th_tcl.c | ||
| +++ src/th_tcl.c | ||
| @@ -23,10 +23,15 @@ | ||
| 23 | 23 | #ifdef FOSSIL_ENABLE_TCL |
| 24 | 24 | |
| 25 | 25 | #include "th.h" |
| 26 | 26 | #include "tcl.h" |
| 27 | 27 | |
| 28 | +/* | |
| 29 | +** Has the decision about whether or not to use Tcl_EvalObjv already been made | |
| 30 | +** via the Makefile? | |
| 31 | + */ | |
| 32 | +#if !defined(USE_TCL_EVALOBJV) | |
| 28 | 33 | /* |
| 29 | 34 | ** Are we being compiled against Tcl 8.6 or higher? |
| 30 | 35 | */ |
| 31 | 36 | #if (TCL_MAJOR_VERSION > 8) || \ |
| 32 | 37 | ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 6)) |
| @@ -33,11 +38,12 @@ | ||
| 33 | 38 | /* |
| 34 | 39 | ** Workaround NRE-specific issue in Tcl_EvalObjCmd (SF bug #3399564) by using |
| 35 | 40 | ** Tcl_EvalObjv instead of invoking the objProc directly. |
| 36 | 41 | */ |
| 37 | 42 | # define USE_TCL_EVALOBJV 1 |
| 38 | -#endif | |
| 43 | +#endif /* (TCL_MAJOR_VERSION > 8) ... */ | |
| 44 | +#endif /* !defined(USE_TCL_EVALOBJV) */ | |
| 39 | 45 | |
| 40 | 46 | /* |
| 41 | 47 | ** These macros are designed to reduce the redundant code required to marshal |
| 42 | 48 | ** arguments from TH1 to Tcl. |
| 43 | 49 | */ |
| @@ -421,20 +427,20 @@ | ||
| 421 | 427 | int argc, |
| 422 | 428 | const char **argv, |
| 423 | 429 | int *argl |
| 424 | 430 | ){ |
| 425 | 431 | Tcl_Interp *tclInterp; |
| 426 | -#if !defined(USE_TCL_EVALOBJV) | |
| 432 | +#if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV | |
| 427 | 433 | Tcl_Command command; |
| 428 | 434 | Tcl_CmdInfo cmdInfo; |
| 429 | -#endif /* !defined(USE_TCL_EVALOBJV) */ | |
| 435 | +#endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */ | |
| 430 | 436 | int rc = TH_OK; |
| 431 | 437 | int nResult; |
| 432 | 438 | const char *zResult; |
| 433 | -#if !defined(USE_TCL_EVALOBJV) | |
| 439 | +#if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV | |
| 434 | 440 | Tcl_Obj *objPtr; |
| 435 | -#endif /* !defined(USE_TCL_EVALOBJV) */ | |
| 441 | +#endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */ | |
| 436 | 442 | USE_ARGV_TO_OBJV(); |
| 437 | 443 | |
| 438 | 444 | if( createTclInterp(interp, ctx)!=TH_OK ){ |
| 439 | 445 | return TH_ERROR; |
| 440 | 446 | } |
| @@ -449,11 +455,11 @@ | ||
| 449 | 455 | rc = notifyPreOrPostEval(0, interp, ctx, argc, argv, argl, rc); |
| 450 | 456 | if( rc!=TH_OK ){ |
| 451 | 457 | return rc; |
| 452 | 458 | } |
| 453 | 459 | Tcl_Preserve((ClientData)tclInterp); |
| 454 | -#if !defined(USE_TCL_EVALOBJV) | |
| 460 | +#if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV | |
| 455 | 461 | objPtr = Tcl_NewStringObj(argv[1], argl[1]); |
| 456 | 462 | Tcl_IncrRefCount(objPtr); |
| 457 | 463 | command = Tcl_GetCommandFromObj(tclInterp, objPtr); |
| 458 | 464 | if( !command || Tcl_GetCommandInfoFromToken(command, &cmdInfo)==0 ){ |
| 459 | 465 | Th_ErrorMessage(interp, "Tcl command not found:", argv[1], argl[1]); |
| @@ -466,18 +472,18 @@ | ||
| 466 | 472 | Tcl_DecrRefCount(objPtr); |
| 467 | 473 | Tcl_Release((ClientData)tclInterp); |
| 468 | 474 | return TH_ERROR; |
| 469 | 475 | } |
| 470 | 476 | Tcl_DecrRefCount(objPtr); |
| 471 | -#endif /* !defined(USE_TCL_EVALOBJV) */ | |
| 477 | +#endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */ | |
| 472 | 478 | COPY_ARGV_TO_OBJV(); |
| 473 | -#if defined(USE_TCL_EVALOBJV) | |
| 479 | +#if defined(USE_TCL_EVALOBJV) && USE_TCL_EVALOBJV | |
| 474 | 480 | rc = Tcl_EvalObjv(tclInterp, objc, objv, 0); |
| 475 | 481 | #else |
| 476 | 482 | Tcl_ResetResult(tclInterp); |
| 477 | 483 | rc = cmdInfo.objProc(cmdInfo.objClientData, tclInterp, objc, objv); |
| 478 | -#endif /* defined(USE_TCL_EVALOBJV) */ | |
| 484 | +#endif /* defined(USE_TCL_EVALOBJV) && USE_TCL_EVALOBJV */ | |
| 479 | 485 | FREE_ARGV_TO_OBJV(); |
| 480 | 486 | zResult = getTclResult(tclInterp, &nResult); |
| 481 | 487 | Th_SetResult(interp, zResult, nResult); |
| 482 | 488 | Tcl_Release((ClientData)tclInterp); |
| 483 | 489 | rc = notifyPreOrPostEval(1, interp, ctx, argc, argv, argl, rc); |
| 484 | 490 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -23,10 +23,15 @@ | |
| 23 | #ifdef FOSSIL_ENABLE_TCL |
| 24 | |
| 25 | #include "th.h" |
| 26 | #include "tcl.h" |
| 27 | |
| 28 | /* |
| 29 | ** Are we being compiled against Tcl 8.6 or higher? |
| 30 | */ |
| 31 | #if (TCL_MAJOR_VERSION > 8) || \ |
| 32 | ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 6)) |
| @@ -33,11 +38,12 @@ | |
| 33 | /* |
| 34 | ** Workaround NRE-specific issue in Tcl_EvalObjCmd (SF bug #3399564) by using |
| 35 | ** Tcl_EvalObjv instead of invoking the objProc directly. |
| 36 | */ |
| 37 | # define USE_TCL_EVALOBJV 1 |
| 38 | #endif |
| 39 | |
| 40 | /* |
| 41 | ** These macros are designed to reduce the redundant code required to marshal |
| 42 | ** arguments from TH1 to Tcl. |
| 43 | */ |
| @@ -421,20 +427,20 @@ | |
| 421 | int argc, |
| 422 | const char **argv, |
| 423 | int *argl |
| 424 | ){ |
| 425 | Tcl_Interp *tclInterp; |
| 426 | #if !defined(USE_TCL_EVALOBJV) |
| 427 | Tcl_Command command; |
| 428 | Tcl_CmdInfo cmdInfo; |
| 429 | #endif /* !defined(USE_TCL_EVALOBJV) */ |
| 430 | int rc = TH_OK; |
| 431 | int nResult; |
| 432 | const char *zResult; |
| 433 | #if !defined(USE_TCL_EVALOBJV) |
| 434 | Tcl_Obj *objPtr; |
| 435 | #endif /* !defined(USE_TCL_EVALOBJV) */ |
| 436 | USE_ARGV_TO_OBJV(); |
| 437 | |
| 438 | if( createTclInterp(interp, ctx)!=TH_OK ){ |
| 439 | return TH_ERROR; |
| 440 | } |
| @@ -449,11 +455,11 @@ | |
| 449 | rc = notifyPreOrPostEval(0, interp, ctx, argc, argv, argl, rc); |
| 450 | if( rc!=TH_OK ){ |
| 451 | return rc; |
| 452 | } |
| 453 | Tcl_Preserve((ClientData)tclInterp); |
| 454 | #if !defined(USE_TCL_EVALOBJV) |
| 455 | objPtr = Tcl_NewStringObj(argv[1], argl[1]); |
| 456 | Tcl_IncrRefCount(objPtr); |
| 457 | command = Tcl_GetCommandFromObj(tclInterp, objPtr); |
| 458 | if( !command || Tcl_GetCommandInfoFromToken(command, &cmdInfo)==0 ){ |
| 459 | Th_ErrorMessage(interp, "Tcl command not found:", argv[1], argl[1]); |
| @@ -466,18 +472,18 @@ | |
| 466 | Tcl_DecrRefCount(objPtr); |
| 467 | Tcl_Release((ClientData)tclInterp); |
| 468 | return TH_ERROR; |
| 469 | } |
| 470 | Tcl_DecrRefCount(objPtr); |
| 471 | #endif /* !defined(USE_TCL_EVALOBJV) */ |
| 472 | COPY_ARGV_TO_OBJV(); |
| 473 | #if defined(USE_TCL_EVALOBJV) |
| 474 | rc = Tcl_EvalObjv(tclInterp, objc, objv, 0); |
| 475 | #else |
| 476 | Tcl_ResetResult(tclInterp); |
| 477 | rc = cmdInfo.objProc(cmdInfo.objClientData, tclInterp, objc, objv); |
| 478 | #endif /* defined(USE_TCL_EVALOBJV) */ |
| 479 | FREE_ARGV_TO_OBJV(); |
| 480 | zResult = getTclResult(tclInterp, &nResult); |
| 481 | Th_SetResult(interp, zResult, nResult); |
| 482 | Tcl_Release((ClientData)tclInterp); |
| 483 | rc = notifyPreOrPostEval(1, interp, ctx, argc, argv, argl, rc); |
| 484 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -23,10 +23,15 @@ | |
| 23 | #ifdef FOSSIL_ENABLE_TCL |
| 24 | |
| 25 | #include "th.h" |
| 26 | #include "tcl.h" |
| 27 | |
| 28 | /* |
| 29 | ** Has the decision about whether or not to use Tcl_EvalObjv already been made |
| 30 | ** via the Makefile? |
| 31 | */ |
| 32 | #if !defined(USE_TCL_EVALOBJV) |
| 33 | /* |
| 34 | ** Are we being compiled against Tcl 8.6 or higher? |
| 35 | */ |
| 36 | #if (TCL_MAJOR_VERSION > 8) || \ |
| 37 | ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 6)) |
| @@ -33,11 +38,12 @@ | |
| 38 | /* |
| 39 | ** Workaround NRE-specific issue in Tcl_EvalObjCmd (SF bug #3399564) by using |
| 40 | ** Tcl_EvalObjv instead of invoking the objProc directly. |
| 41 | */ |
| 42 | # define USE_TCL_EVALOBJV 1 |
| 43 | #endif /* (TCL_MAJOR_VERSION > 8) ... */ |
| 44 | #endif /* !defined(USE_TCL_EVALOBJV) */ |
| 45 | |
| 46 | /* |
| 47 | ** These macros are designed to reduce the redundant code required to marshal |
| 48 | ** arguments from TH1 to Tcl. |
| 49 | */ |
| @@ -421,20 +427,20 @@ | |
| 427 | int argc, |
| 428 | const char **argv, |
| 429 | int *argl |
| 430 | ){ |
| 431 | Tcl_Interp *tclInterp; |
| 432 | #if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV |
| 433 | Tcl_Command command; |
| 434 | Tcl_CmdInfo cmdInfo; |
| 435 | #endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */ |
| 436 | int rc = TH_OK; |
| 437 | int nResult; |
| 438 | const char *zResult; |
| 439 | #if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV |
| 440 | Tcl_Obj *objPtr; |
| 441 | #endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */ |
| 442 | USE_ARGV_TO_OBJV(); |
| 443 | |
| 444 | if( createTclInterp(interp, ctx)!=TH_OK ){ |
| 445 | return TH_ERROR; |
| 446 | } |
| @@ -449,11 +455,11 @@ | |
| 455 | rc = notifyPreOrPostEval(0, interp, ctx, argc, argv, argl, rc); |
| 456 | if( rc!=TH_OK ){ |
| 457 | return rc; |
| 458 | } |
| 459 | Tcl_Preserve((ClientData)tclInterp); |
| 460 | #if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV |
| 461 | objPtr = Tcl_NewStringObj(argv[1], argl[1]); |
| 462 | Tcl_IncrRefCount(objPtr); |
| 463 | command = Tcl_GetCommandFromObj(tclInterp, objPtr); |
| 464 | if( !command || Tcl_GetCommandInfoFromToken(command, &cmdInfo)==0 ){ |
| 465 | Th_ErrorMessage(interp, "Tcl command not found:", argv[1], argl[1]); |
| @@ -466,18 +472,18 @@ | |
| 472 | Tcl_DecrRefCount(objPtr); |
| 473 | Tcl_Release((ClientData)tclInterp); |
| 474 | return TH_ERROR; |
| 475 | } |
| 476 | Tcl_DecrRefCount(objPtr); |
| 477 | #endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */ |
| 478 | COPY_ARGV_TO_OBJV(); |
| 479 | #if defined(USE_TCL_EVALOBJV) && USE_TCL_EVALOBJV |
| 480 | rc = Tcl_EvalObjv(tclInterp, objc, objv, 0); |
| 481 | #else |
| 482 | Tcl_ResetResult(tclInterp); |
| 483 | rc = cmdInfo.objProc(cmdInfo.objClientData, tclInterp, objc, objv); |
| 484 | #endif /* defined(USE_TCL_EVALOBJV) && USE_TCL_EVALOBJV */ |
| 485 | FREE_ARGV_TO_OBJV(); |
| 486 | zResult = getTclResult(tclInterp, &nResult); |
| 487 | Th_SetResult(interp, zResult, nResult); |
| 488 | Tcl_Release((ClientData)tclInterp); |
| 489 | rc = notifyPreOrPostEval(1, interp, ctx, argc, argv, argl, rc); |
| 490 |