1 /*
2 * tifftcl.c --
3 *
4 * Generic interface to XML parsers.
5 *
6 * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
7 *
8 * Zveno Pty Ltd makes this software and associated documentation
9 * available free of charge for any purpose. You may make copies
10 * of the software but you must include all of this notice on any copy.
11 *
12 * Zveno Pty Ltd does not warrant that this software is error free
13 * or fit for any purpose. Zveno Pty Ltd disclaims any liability for
14 * all claims, expenses, losses, damages and costs any user may incur
15 * as a result of using, copying or modifying the software.
16 *
17 */
18
19 /*
20 * Macros PACKAGE_NAME and PACKAGE_VERSION are correctly supplied on
21 * the command line, but are overwritten by settings in tif_config.h
22 * when using libtiff version 4.X.
23 * So we save the supplied macro values before including any header
24 * file and use these values in (Tcl_PkgProvideEx.
25 */
26 static const char * MY_PACKAGE_NAME = { PACKAGE_NAME };
27 static const char * MY_PACKAGE_VERSION = { PACKAGE_VERSION };
28
29 #include <tiff.h>
30
31 /*
32 * Declarations for externally visible functions.
33 */
34
35 extern DLLEXPORT int Tifftcl_Init(Tcl_Interp *interp);
36 extern DLLEXPORT int Tifftcl_SafeInit(Tcl_Interp *interp);
37
38 /*
39 * Prototypes for procedures defined later in this file:
40 */
41
42 /*
43 *----------------------------------------------------------------------------
44 *
45 * Tifftcl_Init --
46 *
47 * Initialisation routine for loadable module
48 *
49 * Results:
50 * None.
51 *
52 * Side effects:
53 * Creates commands in the interpreter,
54 * loads xml package.
55 *
56 *----------------------------------------------------------------------------
57 */
58
59 int
Tifftcl_Init(interp)60 Tifftcl_Init (interp)
61 Tcl_Interp *interp; /* Interpreter to initialise. */
62 {
63 extern const TifftclStubs tifftclStubs;
64
65 if (Tcl_InitStubs(interp, "8.3", 0) == NULL) {
66 return TCL_ERROR;
67 }
68 if (Tcl_PkgProvideEx(interp, MY_PACKAGE_NAME, MY_PACKAGE_VERSION,
69 (ClientData) &tifftclStubs) != TCL_OK) {
70 return TCL_ERROR;
71 }
72 return TCL_OK;
73 }
74
75 /*
76 *----------------------------------------------------------------------------
77 *
78 * Tifftcl_SafeInit --
79 *
80 * Initialisation routine for loadable module in a safe interpreter.
81 *
82 * Results:
83 * None.
84 *
85 * Side effects:
86 * Creates commands in the interpreter,
87 * loads xml package.
88 *
89 *----------------------------------------------------------------------------
90 */
91
92 int
Tifftcl_SafeInit(interp)93 Tifftcl_SafeInit (interp)
94 Tcl_Interp *interp; /* Interpreter to initialise. */
95 {
96 return Tifftcl_Init(interp);
97 }
98
99 /*
100 *----------------------------------------------------------------------------
101 *
102 * Tifftcl_XXX --
103 *
104 * Wrappers around the zlib functionality.
105 *
106 * Results:
107 * Depends on function.
108 *
109 * Side effects:
110 * Depends on function.
111 *
112 *----------------------------------------------------------------------------
113 */
114
115 /*
116 * No wrappers are required. Due to intelligent definition of the stub
117 * table using the function names of the libz sources the stub table
118 * contains jumps to the actual functionality.
119 */
120