/[dtapublic]/projs/ets/trunk/src/c_tk_base_7_5_w_mods/tkstublib.c
ViewVC logotype

Diff of /projs/ets/trunk/src/c_tk_base_7_5_w_mods/tkstublib.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.69  
changed lines
  Added in v.71

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25