OSDN Git Service

Import of Itcl 3.3.
[pf3gnuchains/pf3gnuchains3x.git] / itcl / itk / generic / itkStubLib.c
1 /* 
2  * itkStubLib.c --
3  *
4  *      Stub object that will be statically linked into extensions that wish
5  *      to access Itk.
6  *
7  * Copyright (c) 1998-1999 by XXXX
8  * Copyright (c) 1998 Paul Duffin.
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$
14  */
15
16 /*
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.
21  */
22
23 #ifndef USE_TCL_STUBS
24 #define USE_TCL_STUBS
25 #endif
26 #undef USE_TCL_STUB_PROCS
27
28 #ifndef USE_ITK_STUBS
29 #define USE_ITK_STUBS
30 #endif
31 #undef USE_ITK_STUB_PROCS
32
33 #include "itk.h"
34
35 ItkStubs *itkStubsPtr;
36
37
38 /*
39  *----------------------------------------------------------------------
40  *
41  * Itk_InitStubs --
42  *
43  *      Tries to initialise the stub table pointers and ensures that
44  *      the correct version of Itk is loaded.
45  *
46  * Results:
47  *      The actual version of Itk that satisfies the request, or
48  *      NULL to indicate that an error occurred.
49  *
50  * Side effects:
51  *      Sets the stub table pointers.
52  *
53  *----------------------------------------------------------------------
54  */
55
56 CONST char *
57 Itk_InitStubs (interp, version, exact)
58     Tcl_Interp *interp;
59     CONST char *version;
60     int exact;
61 {
62     CONST char *actualVersion;
63     
64     actualVersion = Tcl_PkgRequireEx(interp, "Itk", (CONST84 char *)version, exact,
65         (ClientData *) &itkStubsPtr);
66
67     if (actualVersion == NULL) {
68         itkStubsPtr = NULL;
69         return NULL;
70     }
71     
72     return actualVersion;
73 }