Fossil SCM

Support the ability to determine at runtime if the private stubs mechanism was used for Tcl.

mistachkin 2013-09-16 23:38 trunk
Commit e10d1171252498a3cb68ccf92fb993cdfecdf236
+3
--- src/main.c
+++ src/main.c
@@ -821,10 +821,13 @@
821821
TCL_PATCH_LEVEL, zRc, Th_GetResult(g.interp, 0)
822822
);
823823
#endif
824824
#if defined(FOSSIL_ENABLE_TCL_STUBS)
825825
fossil_print("TCL_STUBS\n");
826
+#endif
827
+#if defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS)
828
+ fossil_print("TCL_PRIVATE_STUBS\n");
826829
#endif
827830
#if defined(FOSSIL_ENABLE_JSON)
828831
fossil_print("JSON (API %s)\n", FOSSIL_JSON_API_VERSION);
829832
#endif
830833
}
831834
--- src/main.c
+++ src/main.c
@@ -821,10 +821,13 @@
821 TCL_PATCH_LEVEL, zRc, Th_GetResult(g.interp, 0)
822 );
823 #endif
824 #if defined(FOSSIL_ENABLE_TCL_STUBS)
825 fossil_print("TCL_STUBS\n");
 
 
 
826 #endif
827 #if defined(FOSSIL_ENABLE_JSON)
828 fossil_print("JSON (API %s)\n", FOSSIL_JSON_API_VERSION);
829 #endif
830 }
831
--- src/main.c
+++ src/main.c
@@ -821,10 +821,13 @@
821 TCL_PATCH_LEVEL, zRc, Th_GetResult(g.interp, 0)
822 );
823 #endif
824 #if defined(FOSSIL_ENABLE_TCL_STUBS)
825 fossil_print("TCL_STUBS\n");
826 #endif
827 #if defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS)
828 fossil_print("TCL_PRIVATE_STUBS\n");
829 #endif
830 #if defined(FOSSIL_ENABLE_JSON)
831 fossil_print("JSON (API %s)\n", FOSSIL_JSON_API_VERSION);
832 #endif
833 }
834
+16 -10
--- src/th_main.c
+++ src/th_main.c
@@ -296,15 +296,16 @@
296296
** TH command: hasfeature STRING
297297
**
298298
** Return true if the fossil binary has the given compile-time feature
299299
** enabled. The set of features includes:
300300
**
301
-** "ssl" = FOSSIL_ENABLE_SSL
302
-** "tcl" = FOSSIL_ENABLE_TCL
303
-** "tclStubs" = FOSSIL_ENABLE_TCL_STUBS
304
-** "json" = FOSSIL_ENABLE_JSON
305
-** "markdown" = FOSSIL_ENABLE_MARKDOWN
301
+** "ssl" = FOSSIL_ENABLE_SSL
302
+** "tcl" = FOSSIL_ENABLE_TCL
303
+** "tclStubs" = FOSSIL_ENABLE_TCL_STUBS
304
+** "tclPrivateStubs" = FOSSIL_ENABLE_TCL_PRIVATE_STUBS
305
+** "json" = FOSSIL_ENABLE_JSON
306
+** "markdown" = FOSSIL_ENABLE_MARKDOWN
306307
**
307308
*/
308309
static int hasfeatureCmd(
309310
Th_Interp *interp,
310311
void *p,
@@ -320,30 +321,35 @@
320321
zArg = (char const*)argv[1];
321322
if(NULL==zArg){
322323
/* placeholder for following ifdefs... */
323324
}
324325
#if defined(FOSSIL_ENABLE_SSL)
325
- else if( 0 == fossil_strnicmp( zArg, "ssl", 3 ) ){
326
+ else if( 0 == fossil_strnicmp( zArg, "ssl\0", 4 ) ){
326327
rc = 1;
327328
}
328329
#endif
329330
#if defined(FOSSIL_ENABLE_TCL)
330
- else if( 0 == fossil_strnicmp( zArg, "tcl", 3 ) ){
331
+ else if( 0 == fossil_strnicmp( zArg, "tcl\0", 4 ) ){
331332
rc = 1;
332333
}
333334
#endif
334335
#if defined(FOSSIL_ENABLE_TCL_STUBS)
335
- else if( 0 == fossil_strnicmp( zArg, "tclStubs", 8 ) ){
336
+ else if( 0 == fossil_strnicmp( zArg, "tclStubs\0", 9 ) ){
337
+ rc = 1;
338
+ }
339
+#endif
340
+#if defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS)
341
+ else if( 0 == fossil_strnicmp( zArg, "tclPrivateStubs\0", 16 ) ){
336342
rc = 1;
337343
}
338344
#endif
339345
#if defined(FOSSIL_ENABLE_JSON)
340
- else if( 0 == fossil_strnicmp( zArg, "json", 4 ) ){
346
+ else if( 0 == fossil_strnicmp( zArg, "json\0", 5 ) ){
341347
rc = 1;
342348
}
343349
#endif
344
- else if( 0 == fossil_strnicmp( zArg, "markdown", 8 ) ){
350
+ else if( 0 == fossil_strnicmp( zArg, "markdown\0", 9 ) ){
345351
rc = 1;
346352
}
347353
if( g.thTrace ){
348354
Th_Trace("[hasfeature %#h] => %d<br />\n", argl[1], zArg, rc);
349355
}
350356
--- src/th_main.c
+++ src/th_main.c
@@ -296,15 +296,16 @@
296 ** TH command: hasfeature STRING
297 **
298 ** Return true if the fossil binary has the given compile-time feature
299 ** enabled. The set of features includes:
300 **
301 ** "ssl" = FOSSIL_ENABLE_SSL
302 ** "tcl" = FOSSIL_ENABLE_TCL
303 ** "tclStubs" = FOSSIL_ENABLE_TCL_STUBS
304 ** "json" = FOSSIL_ENABLE_JSON
305 ** "markdown" = FOSSIL_ENABLE_MARKDOWN
 
306 **
307 */
308 static int hasfeatureCmd(
309 Th_Interp *interp,
310 void *p,
@@ -320,30 +321,35 @@
320 zArg = (char const*)argv[1];
321 if(NULL==zArg){
322 /* placeholder for following ifdefs... */
323 }
324 #if defined(FOSSIL_ENABLE_SSL)
325 else if( 0 == fossil_strnicmp( zArg, "ssl", 3 ) ){
326 rc = 1;
327 }
328 #endif
329 #if defined(FOSSIL_ENABLE_TCL)
330 else if( 0 == fossil_strnicmp( zArg, "tcl", 3 ) ){
331 rc = 1;
332 }
333 #endif
334 #if defined(FOSSIL_ENABLE_TCL_STUBS)
335 else if( 0 == fossil_strnicmp( zArg, "tclStubs", 8 ) ){
 
 
 
 
 
336 rc = 1;
337 }
338 #endif
339 #if defined(FOSSIL_ENABLE_JSON)
340 else if( 0 == fossil_strnicmp( zArg, "json", 4 ) ){
341 rc = 1;
342 }
343 #endif
344 else if( 0 == fossil_strnicmp( zArg, "markdown", 8 ) ){
345 rc = 1;
346 }
347 if( g.thTrace ){
348 Th_Trace("[hasfeature %#h] => %d<br />\n", argl[1], zArg, rc);
349 }
350
--- src/th_main.c
+++ src/th_main.c
@@ -296,15 +296,16 @@
296 ** TH command: hasfeature STRING
297 **
298 ** Return true if the fossil binary has the given compile-time feature
299 ** enabled. The set of features includes:
300 **
301 ** "ssl" = FOSSIL_ENABLE_SSL
302 ** "tcl" = FOSSIL_ENABLE_TCL
303 ** "tclStubs" = FOSSIL_ENABLE_TCL_STUBS
304 ** "tclPrivateStubs" = FOSSIL_ENABLE_TCL_PRIVATE_STUBS
305 ** "json" = FOSSIL_ENABLE_JSON
306 ** "markdown" = FOSSIL_ENABLE_MARKDOWN
307 **
308 */
309 static int hasfeatureCmd(
310 Th_Interp *interp,
311 void *p,
@@ -320,30 +321,35 @@
321 zArg = (char const*)argv[1];
322 if(NULL==zArg){
323 /* placeholder for following ifdefs... */
324 }
325 #if defined(FOSSIL_ENABLE_SSL)
326 else if( 0 == fossil_strnicmp( zArg, "ssl\0", 4 ) ){
327 rc = 1;
328 }
329 #endif
330 #if defined(FOSSIL_ENABLE_TCL)
331 else if( 0 == fossil_strnicmp( zArg, "tcl\0", 4 ) ){
332 rc = 1;
333 }
334 #endif
335 #if defined(FOSSIL_ENABLE_TCL_STUBS)
336 else if( 0 == fossil_strnicmp( zArg, "tclStubs\0", 9 ) ){
337 rc = 1;
338 }
339 #endif
340 #if defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS)
341 else if( 0 == fossil_strnicmp( zArg, "tclPrivateStubs\0", 16 ) ){
342 rc = 1;
343 }
344 #endif
345 #if defined(FOSSIL_ENABLE_JSON)
346 else if( 0 == fossil_strnicmp( zArg, "json\0", 5 ) ){
347 rc = 1;
348 }
349 #endif
350 else if( 0 == fossil_strnicmp( zArg, "markdown\0", 9 ) ){
351 rc = 1;
352 }
353 if( g.thTrace ){
354 Th_Trace("[hasfeature %#h] => %d<br />\n", argl[1], zArg, rc);
355 }
356
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -228,10 +228,11 @@
228228
static char *getTclResult(
229229
Tcl_Interp *pInterp,
230230
int *pN
231231
){
232232
Tcl_Obj *resultPtr;
233
+
233234
if( !pInterp ){ /* This should not happen. */
234235
if( pN ) *pN = 0;
235236
return 0;
236237
}
237238
resultPtr = Tcl_GetObjResult(pInterp);
@@ -570,10 +571,11 @@
570571
ClientData clientData,
571572
Tcl_Interp *interp
572573
){
573574
int i;
574575
Th_Interp *th1Interp = (Th_Interp *)clientData;
576
+
575577
if( !th1Interp ) return;
576578
/* Remove the Tcl integration commands. */
577579
for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
578580
Th_RenameCommand(th1Interp, aCommand[i].zName, -1, NULL, 0);
579581
}
@@ -594,10 +596,11 @@
594596
tcl_DeleteInterpProc **pxDeleteInterp
595597
){
596598
#if defined(USE_TCL_STUBS)
597599
char fileName[] = TCL_LIBRARY_NAME;
598600
#endif /* defined(USE_TCL_STUBS) */
601
+
599602
if( !pLibrary || !pxFindExecutable || !pxCreateInterp || !pxDeleteInterp ){
600603
Th_ErrorMessage(interp,
601604
"invalid Tcl loader argument(s)", (const char *)"", 0);
602605
return TH_ERROR;
603606
}
@@ -672,10 +675,11 @@
672675
){
673676
Tcl_Obj *objPtr;
674677
Tcl_Obj *resultObjPtr;
675678
Tcl_Obj *listPtr;
676679
int rc = TCL_OK;
680
+
677681
if( argc<=0 || !argv ){
678682
return TCL_OK;
679683
}
680684
objPtr = Tcl_NewStringObj(argv[0], -1);
681685
Tcl_IncrRefCount(objPtr);
@@ -816,10 +820,11 @@
816820
int th_register_tcl(
817821
Th_Interp *interp,
818822
void *pContext
819823
){
820824
int i;
825
+
821826
/* Add the Tcl integration commands to TH1. */
822827
for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
823828
void *ctx;
824829
if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
825830
ctx = aCommand[i].pContext;
826831
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -228,10 +228,11 @@
228 static char *getTclResult(
229 Tcl_Interp *pInterp,
230 int *pN
231 ){
232 Tcl_Obj *resultPtr;
 
233 if( !pInterp ){ /* This should not happen. */
234 if( pN ) *pN = 0;
235 return 0;
236 }
237 resultPtr = Tcl_GetObjResult(pInterp);
@@ -570,10 +571,11 @@
570 ClientData clientData,
571 Tcl_Interp *interp
572 ){
573 int i;
574 Th_Interp *th1Interp = (Th_Interp *)clientData;
 
575 if( !th1Interp ) return;
576 /* Remove the Tcl integration commands. */
577 for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
578 Th_RenameCommand(th1Interp, aCommand[i].zName, -1, NULL, 0);
579 }
@@ -594,10 +596,11 @@
594 tcl_DeleteInterpProc **pxDeleteInterp
595 ){
596 #if defined(USE_TCL_STUBS)
597 char fileName[] = TCL_LIBRARY_NAME;
598 #endif /* defined(USE_TCL_STUBS) */
 
599 if( !pLibrary || !pxFindExecutable || !pxCreateInterp || !pxDeleteInterp ){
600 Th_ErrorMessage(interp,
601 "invalid Tcl loader argument(s)", (const char *)"", 0);
602 return TH_ERROR;
603 }
@@ -672,10 +675,11 @@
672 ){
673 Tcl_Obj *objPtr;
674 Tcl_Obj *resultObjPtr;
675 Tcl_Obj *listPtr;
676 int rc = TCL_OK;
 
677 if( argc<=0 || !argv ){
678 return TCL_OK;
679 }
680 objPtr = Tcl_NewStringObj(argv[0], -1);
681 Tcl_IncrRefCount(objPtr);
@@ -816,10 +820,11 @@
816 int th_register_tcl(
817 Th_Interp *interp,
818 void *pContext
819 ){
820 int i;
 
821 /* Add the Tcl integration commands to TH1. */
822 for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
823 void *ctx;
824 if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
825 ctx = aCommand[i].pContext;
826
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -228,10 +228,11 @@
228 static char *getTclResult(
229 Tcl_Interp *pInterp,
230 int *pN
231 ){
232 Tcl_Obj *resultPtr;
233
234 if( !pInterp ){ /* This should not happen. */
235 if( pN ) *pN = 0;
236 return 0;
237 }
238 resultPtr = Tcl_GetObjResult(pInterp);
@@ -570,10 +571,11 @@
571 ClientData clientData,
572 Tcl_Interp *interp
573 ){
574 int i;
575 Th_Interp *th1Interp = (Th_Interp *)clientData;
576
577 if( !th1Interp ) return;
578 /* Remove the Tcl integration commands. */
579 for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
580 Th_RenameCommand(th1Interp, aCommand[i].zName, -1, NULL, 0);
581 }
@@ -594,10 +596,11 @@
596 tcl_DeleteInterpProc **pxDeleteInterp
597 ){
598 #if defined(USE_TCL_STUBS)
599 char fileName[] = TCL_LIBRARY_NAME;
600 #endif /* defined(USE_TCL_STUBS) */
601
602 if( !pLibrary || !pxFindExecutable || !pxCreateInterp || !pxDeleteInterp ){
603 Th_ErrorMessage(interp,
604 "invalid Tcl loader argument(s)", (const char *)"", 0);
605 return TH_ERROR;
606 }
@@ -672,10 +675,11 @@
675 ){
676 Tcl_Obj *objPtr;
677 Tcl_Obj *resultObjPtr;
678 Tcl_Obj *listPtr;
679 int rc = TCL_OK;
680
681 if( argc<=0 || !argv ){
682 return TCL_OK;
683 }
684 objPtr = Tcl_NewStringObj(argv[0], -1);
685 Tcl_IncrRefCount(objPtr);
@@ -816,10 +820,11 @@
820 int th_register_tcl(
821 Th_Interp *interp,
822 void *pContext
823 ){
824 int i;
825
826 /* Add the Tcl integration commands to TH1. */
827 for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
828 void *ctx;
829 if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
830 ctx = aCommand[i].pContext;
831
--- win/fossil.rc
+++ win/fossil.rc
@@ -108,10 +108,15 @@
108108
#if defined(FOSSIL_ENABLE_TCL_STUBS)
109109
VALUE "TclStubsEnabled", "Yes\0"
110110
#else
111111
VALUE "TclStubsEnabled", "No\0"
112112
#endif /* defined(FOSSIL_ENABLE_TCL_STUBS) */
113
+#if defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS)
114
+ VALUE "TclPrivateStubsEnabled", "Yes\0"
115
+#else
116
+ VALUE "TclPrivateStubsEnabled", "No\0"
117
+#endif /* defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS) */
113118
#endif /* defined(FOSSIL_ENABLE_TCL) */
114119
#if defined(FOSSIL_ENABLE_JSON)
115120
VALUE "JsonEnabled", "Yes, cson " FOSSIL_JSON_API_VERSION "\0"
116121
#endif /* defined(FOSSIL_ENABLE_JSON) */
117122
VALUE "MarkdownEnabled", "Yes\0"
118123
--- win/fossil.rc
+++ win/fossil.rc
@@ -108,10 +108,15 @@
108 #if defined(FOSSIL_ENABLE_TCL_STUBS)
109 VALUE "TclStubsEnabled", "Yes\0"
110 #else
111 VALUE "TclStubsEnabled", "No\0"
112 #endif /* defined(FOSSIL_ENABLE_TCL_STUBS) */
 
 
 
 
 
113 #endif /* defined(FOSSIL_ENABLE_TCL) */
114 #if defined(FOSSIL_ENABLE_JSON)
115 VALUE "JsonEnabled", "Yes, cson " FOSSIL_JSON_API_VERSION "\0"
116 #endif /* defined(FOSSIL_ENABLE_JSON) */
117 VALUE "MarkdownEnabled", "Yes\0"
118
--- win/fossil.rc
+++ win/fossil.rc
@@ -108,10 +108,15 @@
108 #if defined(FOSSIL_ENABLE_TCL_STUBS)
109 VALUE "TclStubsEnabled", "Yes\0"
110 #else
111 VALUE "TclStubsEnabled", "No\0"
112 #endif /* defined(FOSSIL_ENABLE_TCL_STUBS) */
113 #if defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS)
114 VALUE "TclPrivateStubsEnabled", "Yes\0"
115 #else
116 VALUE "TclPrivateStubsEnabled", "No\0"
117 #endif /* defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS) */
118 #endif /* defined(FOSSIL_ENABLE_TCL) */
119 #if defined(FOSSIL_ENABLE_JSON)
120 VALUE "JsonEnabled", "Yes, cson " FOSSIL_JSON_API_VERSION "\0"
121 #endif /* defined(FOSSIL_ENABLE_JSON) */
122 VALUE "MarkdownEnabled", "Yes\0"
123

Keyboard Shortcuts

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