| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef USE_TCL_STUBS |
| 24 |
#define USE_TCL_STUBS |
| 25 |
#endif |
| 26 |
#undef USE_TCL_STUB_PROCS |
| 27 |
|
| 28 |
#include "tclInt.h" |
| 29 |
#include "tclPort.h" |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
#undef TCL_STORAGE_CLASS |
| 37 |
#define TCL_STORAGE_CLASS DLLEXPORT |
| 38 |
|
| 39 |
TclStubs *tclStubsPtr = NULL; |
| 40 |
TclPlatStubs *tclPlatStubsPtr = NULL; |
| 41 |
TclIntStubs *tclIntStubsPtr = NULL; |
| 42 |
TclIntPlatStubs *tclIntPlatStubsPtr = NULL; |
| 43 |
|
| 44 |
static TclStubs * HasStubSupport _ANSI_ARGS_((Tcl_Interp *interp)); |
| 45 |
|
| 46 |
static TclStubs * |
| 47 |
HasStubSupport (interp) |
| 48 |
Tcl_Interp *interp; |
| 49 |
{ |
| 50 |
Interp *iPtr = (Interp *) interp; |
| 51 |
|
| 52 |
if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) { |
| 53 |
return iPtr->stubTable; |
| 54 |
} |
| 55 |
interp->result = "This interpreter does not support stubs-enabled extensions."; |
| 56 |
interp->freeProc = TCL_STATIC; |
| 57 |
|
| 58 |
return NULL; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
#ifdef Tcl_InitStubs |
| 80 |
#undef Tcl_InitStubs |
| 81 |
#endif |
| 82 |
|
| 83 |
CONST char * |
| 84 |
Tcl_InitStubs (interp, version, exact) |
| 85 |
Tcl_Interp *interp; |
| 86 |
CONST char *version; |
| 87 |
int exact; |
| 88 |
{ |
| 89 |
CONST char *actualVersion = NULL; |
| 90 |
TclStubs *tmp; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
tclStubsPtr = HasStubSupport(interp); |
| 99 |
if (!tclStubsPtr) { |
| 100 |
return NULL; |
| 101 |
} |
| 102 |
|
| 103 |
actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact, |
| 104 |
(ClientData *) &tmp); |
| 105 |
if (actualVersion == NULL) { |
| 106 |
tclStubsPtr = NULL; |
| 107 |
return NULL; |
| 108 |
} |
| 109 |
|
| 110 |
if (tclStubsPtr->hooks) { |
| 111 |
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs; |
| 112 |
tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs; |
| 113 |
tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs; |
| 114 |
} else { |
| 115 |
tclPlatStubsPtr = NULL; |
| 116 |
tclIntStubsPtr = NULL; |
| 117 |
tclIntPlatStubsPtr = NULL; |
| 118 |
} |
| 119 |
|
| 120 |
return actualVersion; |
| 121 |
} |