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