Fossil SCM

Support overriding the USE_TCL_EVALOBJV define via a custom Makefile.

mistachkin 2013-09-17 09:31 trunk
Commit 5782fa032e1b67a7b84de0a5aff24f927fee23ff
1 file changed +15 -9
+15 -9
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -23,10 +23,15 @@
2323
#ifdef FOSSIL_ENABLE_TCL
2424
2525
#include "th.h"
2626
#include "tcl.h"
2727
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)
2833
/*
2934
** Are we being compiled against Tcl 8.6 or higher?
3035
*/
3136
#if (TCL_MAJOR_VERSION > 8) || \
3237
((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 6))
@@ -33,11 +38,12 @@
3338
/*
3439
** Workaround NRE-specific issue in Tcl_EvalObjCmd (SF bug #3399564) by using
3540
** Tcl_EvalObjv instead of invoking the objProc directly.
3641
*/
3742
# define USE_TCL_EVALOBJV 1
38
-#endif
43
+#endif /* (TCL_MAJOR_VERSION > 8) ... */
44
+#endif /* !defined(USE_TCL_EVALOBJV) */
3945
4046
/*
4147
** These macros are designed to reduce the redundant code required to marshal
4248
** arguments from TH1 to Tcl.
4349
*/
@@ -421,20 +427,20 @@
421427
int argc,
422428
const char **argv,
423429
int *argl
424430
){
425431
Tcl_Interp *tclInterp;
426
-#if !defined(USE_TCL_EVALOBJV)
432
+#if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV
427433
Tcl_Command command;
428434
Tcl_CmdInfo cmdInfo;
429
-#endif /* !defined(USE_TCL_EVALOBJV) */
435
+#endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */
430436
int rc = TH_OK;
431437
int nResult;
432438
const char *zResult;
433
-#if !defined(USE_TCL_EVALOBJV)
439
+#if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV
434440
Tcl_Obj *objPtr;
435
-#endif /* !defined(USE_TCL_EVALOBJV) */
441
+#endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */
436442
USE_ARGV_TO_OBJV();
437443
438444
if( createTclInterp(interp, ctx)!=TH_OK ){
439445
return TH_ERROR;
440446
}
@@ -449,11 +455,11 @@
449455
rc = notifyPreOrPostEval(0, interp, ctx, argc, argv, argl, rc);
450456
if( rc!=TH_OK ){
451457
return rc;
452458
}
453459
Tcl_Preserve((ClientData)tclInterp);
454
-#if !defined(USE_TCL_EVALOBJV)
460
+#if !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV
455461
objPtr = Tcl_NewStringObj(argv[1], argl[1]);
456462
Tcl_IncrRefCount(objPtr);
457463
command = Tcl_GetCommandFromObj(tclInterp, objPtr);
458464
if( !command || Tcl_GetCommandInfoFromToken(command, &cmdInfo)==0 ){
459465
Th_ErrorMessage(interp, "Tcl command not found:", argv[1], argl[1]);
@@ -466,18 +472,18 @@
466472
Tcl_DecrRefCount(objPtr);
467473
Tcl_Release((ClientData)tclInterp);
468474
return TH_ERROR;
469475
}
470476
Tcl_DecrRefCount(objPtr);
471
-#endif /* !defined(USE_TCL_EVALOBJV) */
477
+#endif /* !defined(USE_TCL_EVALOBJV) || !USE_TCL_EVALOBJV */
472478
COPY_ARGV_TO_OBJV();
473
-#if defined(USE_TCL_EVALOBJV)
479
+#if defined(USE_TCL_EVALOBJV) && USE_TCL_EVALOBJV
474480
rc = Tcl_EvalObjv(tclInterp, objc, objv, 0);
475481
#else
476482
Tcl_ResetResult(tclInterp);
477483
rc = cmdInfo.objProc(cmdInfo.objClientData, tclInterp, objc, objv);
478
-#endif /* defined(USE_TCL_EVALOBJV) */
484
+#endif /* defined(USE_TCL_EVALOBJV) && USE_TCL_EVALOBJV */
479485
FREE_ARGV_TO_OBJV();
480486
zResult = getTclResult(tclInterp, &nResult);
481487
Th_SetResult(interp, zResult, nResult);
482488
Tcl_Release((ClientData)tclInterp);
483489
rc = notifyPreOrPostEval(1, interp, ctx, argc, argv, argl, rc);
484490
--- 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

Keyboard Shortcuts

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