#ifndef USE_TCL_STUBS
#define USE_TCL_STUBS
#endif
#undef USE_TCL_STUB_PROCS
#include "tclInt.h"
#include "tclPort.h"
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
TclStubs *tclStubsPtr;
TclPlatStubs *tclPlatStubsPtr;
TclIntStubs *tclIntStubsPtr;
TclIntPlatStubs *tclIntPlatStubsPtr;
static TclStubs * HasStubSupport _ANSI_ARGS_((Tcl_Interp *interp));
static TclStubs *
HasStubSupport (interp)
Tcl_Interp *interp;
{
Interp *iPtr = (Interp *) interp;
if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {
return iPtr->stubTable;
}
interp->result = "This interpreter does not support stubs-enabled extensions.";
interp->freeProc = TCL_STATIC;
return NULL;
}
#ifdef Tcl_InitStubs
#undef Tcl_InitStubs
#endif
CONST char *
Tcl_InitStubs (interp, version, exact)
Tcl_Interp *interp;
CONST char *version;
int exact;
{
CONST char *actualVersion;
TclStubs *tmp;
if (!tclStubsPtr) {
tclStubsPtr = HasStubSupport(interp);
if (!tclStubsPtr) {
return NULL;
}
}
actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact,
(ClientData *) &tmp);
if (actualVersion == NULL) {
tclStubsPtr = NULL;
return NULL;
}
if (tclStubsPtr->hooks) {
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
} else {
tclPlatStubsPtr = NULL;
tclIntStubsPtr = NULL;
tclIntPlatStubsPtr = NULL;
}
return actualVersion;
}