os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/generic/tclStubLib.c
First public contribution.
4 * Stub object that will be statically linked into extensions that wish
7 * Copyright (c) 1998-1999 by Scriptics Corporation.
8 * Copyright (c) 1998 Paul Duffin.
10 * See the file "license.terms" for information on usage and redistribution
11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * RCS: @(#) $Id: tclStubLib.c,v 1.6.2.1 2005/11/20 18:23:03 jenglish Exp $
17 * We need to ensure that we use the stub macros so that this file contains
18 * no references to any of the stub functions. This will make it possible
19 * to build an extension that references Tcl_InitStubs but doesn't end up
20 * including the rest of the stub functions.
26 #undef USE_TCL_STUB_PROCS
32 * Ensure that Tcl_InitStubs is built as an exported symbol. The other stub
33 * functions should be built as non-exported symbols.
36 TclStubs *tclStubsPtr = NULL;
37 TclPlatStubs *tclPlatStubsPtr = NULL;
38 TclIntStubs *tclIntStubsPtr = NULL;
39 TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
41 static TclStubs * HasStubSupport _ANSI_ARGS_((Tcl_Interp *interp));
44 HasStubSupport (interp)
47 Interp *iPtr = (Interp *) interp;
49 if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {
50 return iPtr->stubTable;
52 interp->result = "This interpreter does not support stubs-enabled extensions.";
53 interp->freeProc = TCL_STATIC;
59 *----------------------------------------------------------------------
63 * Tries to initialise the stub table pointers and ensures that
64 * the correct version of Tcl is loaded.
67 * The actual version of Tcl that satisfies the request, or
68 * NULL to indicate that an error occurred.
71 * Sets the stub table pointers.
73 *----------------------------------------------------------------------
81 Tcl_InitStubs (interp, version, exact)
86 CONST char *actualVersion = NULL;
87 ClientData pkgData = NULL;
90 * We can't optimize this check by caching tclStubsPtr because
91 * that prevents apps from being able to load/unload Tcl dynamically
92 * multiple times. [Bug 615304]
95 tclStubsPtr = HasStubSupport(interp);
100 actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact, &pkgData);
101 if (actualVersion == NULL) {
104 tclStubsPtr = (TclStubs*)pkgData;
106 if (tclStubsPtr->hooks) {
107 tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
108 tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
109 tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
111 tclPlatStubsPtr = NULL;
112 tclIntStubsPtr = NULL;
113 tclIntPlatStubsPtr = NULL;
116 return actualVersion;