Debian Codegraph @

pTk/mTk/generic/tkStubLib.c

raw symbols SCIP
1 /*
2 * tkStubLib.c --
3 *
4 * Stub object that will be statically linked into extensions that wish
5 * to access Tk.
6 *
7 * Copyright (c) 1998 Paul Duffin.
8 * Copyright (c) 1998-1999 by Scriptics Corporation.
9 *
10 * See the file "license.terms" for information on usage and redistribution
11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 *
13 * RCS: @(#) $Id: tkStubLib.c,v 1.8 2002/08/31 06:12:27 das Exp $
14 */
15
16
17 /*
18 * We need to ensure that we use the stub macros so that this file contains
19 * no references to any of the stub functions. This will make it possible
20 * to build an extension that references Tk_InitStubs but doesn't end up
21 * including the rest of the stub functions.
22 */
23
24 #ifndef USE_TCL_STUBS
25 #define USE_TCL_STUBS
26 #endif
27 #undef USE_TCL_STUB_PROCS
28
29 #ifndef USE_TK_STUBS
30 #define USE_TK_STUBS
31 #endif
32 #undef USE_TK_STUB_PROCS
33
34 #include "tkPort.h"
35 #include "tkInt.h"
36
37 #ifdef __WIN32__
38 #include "tkWinInt.h"
39 #endif
40
41 #ifdef MAC_TCL
42 #include "tkMacInt.h"
43 #endif
44
45 #ifdef MAC_OSX_TK
46 #include "tkMacOSXInt.h"
47 #endif
48
49 #include "tkDecls.h"
50 #include "tkIntDecls.h"
51 #include "tkPlatDecls.h"
52 #include "tkIntPlatDecls.h"
53 #include "tkIntXlibDecls.h"
54
55 /*
56 * Ensure that Tk_InitStubs is built as an exported symbol. The other stub
57 * functions should be built as non-exported symbols.
58 */
59
60 #undef TCL_STORAGE_CLASS
61 #define TCL_STORAGE_CLASS DLLEXPORT
62
63 TkStubs *tkStubsPtr;
64 TkPlatStubs *tkPlatStubsPtr;
65 TkIntStubs *tkIntStubsPtr;
66 TkIntPlatStubs *tkIntPlatStubsPtr;
67 TkIntXlibStubs *tkIntXlibStubsPtr;
68
69
70 /*
71 *----------------------------------------------------------------------
72 *
73 * Tk_InitStubs --
74 *
75 * Checks that the correct version of Tk is loaded and that it
76 * supports stubs. It then initialises the stub table pointers.
77 *
78 * Results:
79 * The actual version of Tk that satisfies the request, or
80 * NULL to indicate that an error occurred.
81 *
82 * Side effects:
83 * Sets the stub table pointers.
84 *
85 *----------------------------------------------------------------------
86 */
87
88 #ifdef Tk_InitStubs
89 #undef Tk_InitStubs
90 #endif
91
92 CONST char *
93 Tk_InitStubs(interp, version, exact)
94 Tcl_Interp *interp;
95 char *version;
96 int exact;
97 {
98 CONST char *actualVersion;
99
100 actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, exact,
101 (ClientData *) &tkStubsPtr);
102 if (!actualVersion) {
103 return NULL;
104 }
105
106 if (!tkStubsPtr) {
107 Tcl_SetResult(interp,
108 "This implementation of Tk does not support stubs",
109 TCL_STATIC);
110 return NULL;
111 }
112
113 tkPlatStubsPtr = tkStubsPtr->hooks->tkPlatStubs;
114 tkIntStubsPtr = tkStubsPtr->hooks->tkIntStubs;
115 tkIntPlatStubsPtr = tkStubsPtr->hooks->tkIntPlatStubs;
116 tkIntXlibStubsPtr = tkStubsPtr->hooks->tkIntXlibStubs;
117
118 return actualVersion;
119 }