1 /*
2 * jpegtclStubLib.c --
3 *
4 * Stub object that will be statically linked into extensions that wish
5 * to access the JPEGTCL API.
6 *
7 * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
8 * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
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
14 #ifndef USE_TCL_STUBS
15 #define USE_TCL_STUBS
16 #endif
17
18 #include <jpeglib.h>
19
20 const JpegtclStubs *jpegtclStubsPtr;
21
22 /*
23 *----------------------------------------------------------------------
24 *
25 * Jpegtcl_InitStubs --
26 *
27 * Checks that the correct version of Blt is loaded and that it
28 * supports stubs. It then initialises the stub table pointers.
29 *
30 * Results:
31 * The actual version of BLT that satisfies the request, or
32 * NULL to indicate that an error occurred.
33 *
34 * Side effects:
35 * Sets the stub table pointers.
36 *
37 *----------------------------------------------------------------------
38 */
39
40 #ifdef Jpegtcl_InitStubs
41 #undef Jpegtcl_InitStubs
42 #endif
43
44 MODULE_SCOPE const char *
Jpegtcl_InitStubs(interp,version,exact)45 Jpegtcl_InitStubs(interp, version, exact)
46 Tcl_Interp *interp;
47 const char *version;
48 int exact;
49 {
50 const char *result;
51 ClientData data;
52
53 result = Tcl_PkgRequireEx(interp, PACKAGE_NAME, (const char *) version, exact, &data);
54 if (!result || !data) {
55 return NULL;
56 }
57
58 jpegtclStubsPtr = (const JpegtclStubs *) data;
59 return result;
60 }
61