Fossil SCM

Permit compilation without Tcl private stubs using Tcl 8.5.

mistachkin 2015-11-02 23:05 trunk
Commit b500f89c38e351caf5c2983ecd4d6b23af2689dd
1 file changed +14
+14
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -24,10 +24,18 @@
2424
2525
#include "sqlite3.h"
2626
#include "th.h"
2727
#include "tcl.h"
2828
29
+/*
30
+** This macro is used to verify that the header version of Tcl meets some
31
+** minimum requirement.
32
+*/
33
+#define MINIMUM_TCL_VERSION(major, minor) \
34
+ ((TCL_MAJOR_VERSION > (major)) || \
35
+ ((TCL_MAJOR_VERSION == (major)) && (TCL_MINOR_VERSION >= (minor))))
36
+
2937
/*
3038
** These macros are designed to reduce the redundant code required to marshal
3139
** arguments from TH1 to Tcl.
3240
*/
3341
#define USE_ARGV_TO_OBJV() \
@@ -285,17 +293,21 @@
285293
** Is the loaded version of Tcl one where TIP #285 (asynchronous script
286294
** cancellation) is available? This should return non-zero only for Tcl
287295
** 8.6 and higher.
288296
*/
289297
static int canUseTip285(){
298
+#if MINIMUM_TCL_VERSION(8, 6)
290299
int major = -1, minor = -1, patchLevel = -1, type = -1;
291300
292301
Tcl_GetVersion(&major, &minor, &patchLevel, &type);
293302
if( major<0 || minor<0 || patchLevel<0 || type<0 ){
294303
return 0; /* NOTE: Invalid version info, assume bad. */
295304
}
296305
return (major>8 || (major==8 && minor>=6));
306
+#else
307
+ return 0;
308
+#endif
297309
}
298310
299311
/*
300312
** Creates and initializes a Tcl interpreter for use with the specified TH1
301313
** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
@@ -1064,13 +1076,15 @@
10641076
Tcl_Preserve((ClientData)tclInterp);
10651077
while( Tcl_DoOneEvent(flags) ){
10661078
if( Tcl_InterpDeleted(tclInterp) ){
10671079
break;
10681080
}
1081
+#if MINIMUM_TCL_VERSION(8, 6)
10691082
if( useTip285 && Tcl_Canceled(tclInterp, 0)!=TCL_OK ){
10701083
break;
10711084
}
1085
+#endif
10721086
}
10731087
Tcl_Release((ClientData)tclInterp);
10741088
return rc;
10751089
}
10761090
10771091
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -24,10 +24,18 @@
24
25 #include "sqlite3.h"
26 #include "th.h"
27 #include "tcl.h"
28
 
 
 
 
 
 
 
 
29 /*
30 ** These macros are designed to reduce the redundant code required to marshal
31 ** arguments from TH1 to Tcl.
32 */
33 #define USE_ARGV_TO_OBJV() \
@@ -285,17 +293,21 @@
285 ** Is the loaded version of Tcl one where TIP #285 (asynchronous script
286 ** cancellation) is available? This should return non-zero only for Tcl
287 ** 8.6 and higher.
288 */
289 static int canUseTip285(){
 
290 int major = -1, minor = -1, patchLevel = -1, type = -1;
291
292 Tcl_GetVersion(&major, &minor, &patchLevel, &type);
293 if( major<0 || minor<0 || patchLevel<0 || type<0 ){
294 return 0; /* NOTE: Invalid version info, assume bad. */
295 }
296 return (major>8 || (major==8 && minor>=6));
 
 
 
297 }
298
299 /*
300 ** Creates and initializes a Tcl interpreter for use with the specified TH1
301 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
@@ -1064,13 +1076,15 @@
1064 Tcl_Preserve((ClientData)tclInterp);
1065 while( Tcl_DoOneEvent(flags) ){
1066 if( Tcl_InterpDeleted(tclInterp) ){
1067 break;
1068 }
 
1069 if( useTip285 && Tcl_Canceled(tclInterp, 0)!=TCL_OK ){
1070 break;
1071 }
 
1072 }
1073 Tcl_Release((ClientData)tclInterp);
1074 return rc;
1075 }
1076
1077
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -24,10 +24,18 @@
24
25 #include "sqlite3.h"
26 #include "th.h"
27 #include "tcl.h"
28
29 /*
30 ** This macro is used to verify that the header version of Tcl meets some
31 ** minimum requirement.
32 */
33 #define MINIMUM_TCL_VERSION(major, minor) \
34 ((TCL_MAJOR_VERSION > (major)) || \
35 ((TCL_MAJOR_VERSION == (major)) && (TCL_MINOR_VERSION >= (minor))))
36
37 /*
38 ** These macros are designed to reduce the redundant code required to marshal
39 ** arguments from TH1 to Tcl.
40 */
41 #define USE_ARGV_TO_OBJV() \
@@ -285,17 +293,21 @@
293 ** Is the loaded version of Tcl one where TIP #285 (asynchronous script
294 ** cancellation) is available? This should return non-zero only for Tcl
295 ** 8.6 and higher.
296 */
297 static int canUseTip285(){
298 #if MINIMUM_TCL_VERSION(8, 6)
299 int major = -1, minor = -1, patchLevel = -1, type = -1;
300
301 Tcl_GetVersion(&major, &minor, &patchLevel, &type);
302 if( major<0 || minor<0 || patchLevel<0 || type<0 ){
303 return 0; /* NOTE: Invalid version info, assume bad. */
304 }
305 return (major>8 || (major==8 && minor>=6));
306 #else
307 return 0;
308 #endif
309 }
310
311 /*
312 ** Creates and initializes a Tcl interpreter for use with the specified TH1
313 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
@@ -1064,13 +1076,15 @@
1076 Tcl_Preserve((ClientData)tclInterp);
1077 while( Tcl_DoOneEvent(flags) ){
1078 if( Tcl_InterpDeleted(tclInterp) ){
1079 break;
1080 }
1081 #if MINIMUM_TCL_VERSION(8, 6)
1082 if( useTip285 && Tcl_Canceled(tclInterp, 0)!=TCL_OK ){
1083 break;
1084 }
1085 #endif
1086 }
1087 Tcl_Release((ClientData)tclInterp);
1088 return rc;
1089 }
1090
1091

Keyboard Shortcuts

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