1/* 2 * tcldomxmlStubLib.c -- 3 * 4 * Stub object that will be statically linked into extensions that wish 5 * to access the TCLDOMXML API. 6 * 7 * Copyright (c) 1998 Paul Duffin. 8 * Copyright (c) 1998-1999 by Scriptics Corporation. 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: tcldomxmlStubLib.c,v 1.1 2002/10/31 23:40:23 andreas_kupries Exp $ 14 */ 15 16#ifndef USE_TCL_STUBS 17#define USE_TCL_STUBS 18#endif 19 20#include "tcldom-libxml2.h" 21 22TcldomxmlStubs *tcldomxmlStubsPtr; 23 24/* 25 *---------------------------------------------------------------------- 26 * 27 * Tcldomxml_InitStubs -- 28 * 29 * Checks that the correct version of Blt is loaded and that it 30 * supports stubs. It then initialises the stub table pointers. 31 * 32 * Results: 33 * The actual version of BLT that satisfies the request, or 34 * NULL to indicate that an error occurred. 35 * 36 * Side effects: 37 * Sets the stub table pointers. 38 * 39 *---------------------------------------------------------------------- 40 */ 41 42#ifdef Tcldomxml_InitStubs 43#undef Tcldomxml_InitStubs 44#endif 45 46CONST char * 47Tcldomxml_InitStubs(interp, version, exact) 48 Tcl_Interp *interp; 49 CONST char *version; 50 int exact; 51{ 52 CONST char *result; 53 54 /* HACK: de-CONST 'version' if compiled against 8.3. 55 * The API has no CONST despite not modifying the argument 56 * And a debug build with high warning-level on windows 57 * will abort the compilation. 58 */ 59 60#if ((TCL_MAJOR_VERSION < 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 4))) 61#define UNCONST (char*) 62#else 63#define UNCONST 64#endif 65 66 result = Tcl_PkgRequireEx(interp, "dom::libxml2", UNCONST version, exact, 67 (ClientData *) &tcldomxmlStubsPtr); 68 if (!result || !tcldomxmlStubsPtr) { 69 return (char *) NULL; 70 } 71 72 return result; 73} 74#undef UNCONST 75