1/* tcldom.h -- 2 * 3 * Generic layer of TclDOM API. 4 * 5 * Copyright (c) 2002 Zveno Pty Ltd 6 * http://www.zveno.com/ 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 * $Id: tcldom.h,v 1.7 2002/10/31 23:40:07 andreas_kupries Exp $ 18 */ 19 20#ifndef __TCLDOM_H__ 21#define __TCLDOM_H__ 22 23#include <tcl.h> 24 25/* 26 * For C++ compilers, use extern "C" 27 */ 28 29#ifdef __cplusplus 30extern "C" { 31#endif 32 33/* 34 35 * These macros are used to control whether functions are being declared for 36 * import or export in Windows, 37 * They map to no-op declarations on non-Windows systems. 38 * Assumes that tcl.h defines DLLEXPORT & DLLIMPORT correctly. 39 * The default build on windows is for a DLL, which causes the DLLIMPORT 40 * and DLLEXPORT macros to be nonempty. To build a static library, the 41 * macro STATIC_BUILD should be defined before the inclusion of tcl.h 42 * 43 * If a function is being declared while it is being built 44 * to be included in a shared library, then it should have the DLLEXPORT 45 * storage class. If is being declared for use by a module that is going to 46 * link against the shared library, then it should have the DLLIMPORT storage 47 * class. If the symbol is beind declared for a static build or for use from a 48 * stub library, then the storage class should be empty. 49 * 50 * The convention is that a macro called BUILD_xxxx, where xxxx is the 51 * name of a library we are building, is set on the compile line for sources 52 * that are to be placed in the library. When this macro is set, the 53 * storage class will be set to DLLEXPORT. At the end of the header file, the 54 * storage class will be reset to DLLIMPORt. 55 */ 56 57#undef TCL_STORAGE_CLASS 58#ifdef BUILD_tcldom 59# define TCL_STORAGE_CLASS DLLEXPORT 60#else 61# ifdef USE_TCL_STUBS 62# define TCL_STORAGE_CLASS 63# else 64# define TCL_STORAGE_CLASS DLLIMPORT 65# endif 66#endif 67 68/* 69 * C API for TclDOM generic layer 70 * 71 * C callback functions to application code and their registration functions. 72 * These all mimic the Tcl callbacks. 73 */ 74 75/* 76 * The structure below is used to refer to a DOM Implementation. 77 */ 78 79typedef struct TclDOM_Implementation { 80 Tcl_Obj *name; /* Name of this implementation */ 81 Tcl_ObjType *type; /* Object type pointer of this impl */ 82 83 Tcl_ObjCmdProc *create; 84 Tcl_ObjCmdProc *parse; 85 Tcl_ObjCmdProc *serialize; 86 Tcl_ObjCmdProc *document; 87 Tcl_ObjCmdProc *documentfragment; 88 Tcl_ObjCmdProc *node; 89 Tcl_ObjCmdProc *element; 90 Tcl_ObjCmdProc *select; 91} TclDOM_Implementation; 92 93/* 94 * The following function is required to be defined in all stubs aware 95 * extensions of TclDOM. The function is actually implemented in the stub 96 * library, not the main Tcldom library, although there is a trivial 97 * implementation in the main library in case an extension is statically 98 * linked into an application. 99 */ 100 101EXTERN CONST char * Tcldom_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, 102 CONST char *version, int exact)); 103 104#ifndef USE_TCLDOM_STUBS 105 106/* 107 * When not using stubs, make it a macro. 108 */ 109 110#define Tcldom_InitStubs(interp, version, exact) \ 111 Tcl_PkgRequire(interp, "dom::generic", version, exact) 112 113#endif 114 115/* 116 *---------------------------------------------------------------------------- 117 * 118 * Function prototypes for publically accessible routines 119 * 120 *---------------------------------------------------------------------------- 121 */ 122 123#include "tcldomDecls.h" 124 125#undef TCL_STORAGE_CLASS 126#define TCL_STORAGE_CLASS DLLIMPORT 127 128#ifdef __cplusplus 129} 130#endif 131 132#endif /* __TCLDOM_H__ */ 133