| 1 |
/* |
| 2 |
* ORIGINAL SOURCE: tk/generic/tkStubLib.c, version 1.9 2004/03/17 |
| 3 |
*/ |
| 4 |
|
| 5 |
#include "tclOOInt.h" |
| 6 |
|
| 7 |
MODULE_SCOPE const TclOOStubs *tclOOStubsPtr; |
| 8 |
MODULE_SCOPE const TclOOIntStubs *tclOOIntStubsPtr; |
| 9 |
|
| 10 |
const TclOOStubs *tclOOStubsPtr = NULL; |
| 11 |
const TclOOIntStubs *tclOOIntStubsPtr = NULL; |
| 12 |
|
| 13 |
/* |
| 14 |
*---------------------------------------------------------------------- |
| 15 |
* |
| 16 |
* TclOOInitializeStubs -- |
| 17 |
* Load the tclOO package, initialize stub table pointer. Do not call |
| 18 |
* this function directly, use Tcl_OOInitStubs() macro instead. |
| 19 |
* |
| 20 |
* Results: |
| 21 |
* The actual version of the package that satisfies the request, or NULL |
| 22 |
* to indicate that an error occurred. |
| 23 |
* |
| 24 |
* Side effects: |
| 25 |
* Sets the stub table pointers. |
| 26 |
* |
| 27 |
*---------------------------------------------------------------------- |
| 28 |
*/ |
| 29 |
|
| 30 |
#undef TclOOInitializeStubs |
| 31 |
|
| 32 |
MODULE_SCOPE const char * |
| 33 |
TclOOInitializeStubs( |
| 34 |
Tcl_Interp *interp, |
| 35 |
const char *version) |
| 36 |
{ |
| 37 |
int exact = 0; |
| 38 |
const char *packageName = "TclOO"; |
| 39 |
const char *errMsg = NULL; |
| 40 |
TclOOStubs *stubsPtr = NULL; |
| 41 |
const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, |
| 42 |
packageName, version, exact, &stubsPtr); |
| 43 |
|
| 44 |
if (actualVersion == NULL) { |
| 45 |
return NULL; |
| 46 |
} |
| 47 |
if (stubsPtr == NULL) { |
| 48 |
errMsg = "missing stub table pointer"; |
| 49 |
} else { |
| 50 |
tclOOStubsPtr = stubsPtr; |
| 51 |
if (stubsPtr->hooks) { |
| 52 |
tclOOIntStubsPtr = stubsPtr->hooks->tclOOIntStubs; |
| 53 |
} else { |
| 54 |
tclOOIntStubsPtr = NULL; |
| 55 |
} |
| 56 |
return actualVersion; |
| 57 |
} |
| 58 |
tclStubsPtr->tcl_ResetResult(interp); |
| 59 |
tclStubsPtr->tcl_AppendResult(interp, "Error loading ", packageName, |
| 60 |
" (requested version ", version, ", actual version ", |
| 61 |
actualVersion, "): ", errMsg, NULL); |
| 62 |
return NULL; |
| 63 |
} |
| 64 |
|
| 65 |
/* |
| 66 |
* Local Variables: |
| 67 |
* mode: c |
| 68 |
* c-basic-offset: 4 |
| 69 |
* fill-column: 78 |
| 70 |
* End: |
| 71 |
*/ |