1/* 2 * pngtclStubLib.c -- 3 * 4 * Stub object that will be statically linked into extensions that wish 5 * to access the PNGTCL 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 * RCS: @(#) $Id: pngtclStubLib.c 240 2010-04-09 12:03:28Z nijtmans $ 14 */ 15 16#ifndef USE_TCL_STUBS 17#define USE_TCL_STUBS 18#endif 19 20#include "pngtcl.h" 21 22const PngtclStubs *pngtclStubsPtr; 23 24/* 25 *---------------------------------------------------------------------- 26 * 27 * Pngtcl_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 Pngtcl_InitStubs 43#undef Pngtcl_InitStubs 44#endif 45 46MODULE_SCOPE const char * 47Pngtcl_InitStubs(interp, version, exact) 48 Tcl_Interp *interp; 49 const char *version; 50 int exact; 51{ 52 const char *result; 53 ClientData data; 54 55 result = Tcl_PkgRequireEx(interp, PACKAGE_NAME, (CONST84 char *) version, exact, &data); 56 if (!result || !data) { 57 return NULL; 58 } 59 60 pngtclStubsPtr = (const PngtclStubs *) data; 61 return result; 62} 63