Fossil SCM
Permit compilation without Tcl private stubs using Tcl 8.5.
Commit
b500f89c38e351caf5c2983ecd4d6b23af2689dd
Parent
ca3ed9d49c4f41e…
1 file changed
+14
+14
| --- src/th_tcl.c | ||
| +++ src/th_tcl.c | ||
| @@ -24,10 +24,18 @@ | ||
| 24 | 24 | |
| 25 | 25 | #include "sqlite3.h" |
| 26 | 26 | #include "th.h" |
| 27 | 27 | #include "tcl.h" |
| 28 | 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 | + | |
| 29 | 37 | /* |
| 30 | 38 | ** These macros are designed to reduce the redundant code required to marshal |
| 31 | 39 | ** arguments from TH1 to Tcl. |
| 32 | 40 | */ |
| 33 | 41 | #define USE_ARGV_TO_OBJV() \ |
| @@ -285,17 +293,21 @@ | ||
| 285 | 293 | ** Is the loaded version of Tcl one where TIP #285 (asynchronous script |
| 286 | 294 | ** cancellation) is available? This should return non-zero only for Tcl |
| 287 | 295 | ** 8.6 and higher. |
| 288 | 296 | */ |
| 289 | 297 | static int canUseTip285(){ |
| 298 | +#if MINIMUM_TCL_VERSION(8, 6) | |
| 290 | 299 | int major = -1, minor = -1, patchLevel = -1, type = -1; |
| 291 | 300 | |
| 292 | 301 | Tcl_GetVersion(&major, &minor, &patchLevel, &type); |
| 293 | 302 | if( major<0 || minor<0 || patchLevel<0 || type<0 ){ |
| 294 | 303 | return 0; /* NOTE: Invalid version info, assume bad. */ |
| 295 | 304 | } |
| 296 | 305 | return (major>8 || (major==8 && minor>=6)); |
| 306 | +#else | |
| 307 | + return 0; | |
| 308 | +#endif | |
| 297 | 309 | } |
| 298 | 310 | |
| 299 | 311 | /* |
| 300 | 312 | ** Creates and initializes a Tcl interpreter for use with the specified TH1 |
| 301 | 313 | ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied |
| @@ -1064,13 +1076,15 @@ | ||
| 1064 | 1076 | Tcl_Preserve((ClientData)tclInterp); |
| 1065 | 1077 | while( Tcl_DoOneEvent(flags) ){ |
| 1066 | 1078 | if( Tcl_InterpDeleted(tclInterp) ){ |
| 1067 | 1079 | break; |
| 1068 | 1080 | } |
| 1081 | +#if MINIMUM_TCL_VERSION(8, 6) | |
| 1069 | 1082 | if( useTip285 && Tcl_Canceled(tclInterp, 0)!=TCL_OK ){ |
| 1070 | 1083 | break; |
| 1071 | 1084 | } |
| 1085 | +#endif | |
| 1072 | 1086 | } |
| 1073 | 1087 | Tcl_Release((ClientData)tclInterp); |
| 1074 | 1088 | return rc; |
| 1075 | 1089 | } |
| 1076 | 1090 | |
| 1077 | 1091 |
| --- 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 |