1/* 2 * tcldomStubLib.c -- 3 * 4 * Stub object that will be statically linked into extensions that wish 5 * to access the TCLDOM 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: tcldomStubLib.c,v 1.3 2002/10/31 23:40:07 andreas_kupries Exp $ 14 */ 15 16#ifndef USE_TCL_STUBS 17#define USE_TCL_STUBS 18#endif 19 20#include "tcldom.h" 21 22TcldomStubs *tcldomStubsPtr; 23 24/* 25 *---------------------------------------------------------------------- 26 * 27 * Tcldom_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 Tcldom_InitStubs 43#undef Tcldom_InitStubs 44#endif 45 46CONST char * 47Tcldom_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::generic", UNCONST version, exact, 67 (ClientData *) &tcldomStubsPtr); 68 if (!result || !tcldomStubsPtr) { 69 return (char *) NULL; 70 } 71 72 return result; 73} 74#undef UNCONST 75