diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-18 17:31:11 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-18 17:31:11 (GMT) |
commit | 066971b1e6e77991d9161bb0216a63ba94ea04f9 (patch) | |
tree | 6de02f79b7a4bb08a329581aa67b444fb9001bfd /tcl8.6/generic/tclTomMathStubLib.c | |
parent | ba065c2de121da1c1dfddd0aa587d10e7e150f05 (diff) | |
parent | 9966985d896629eede849a84f18e406d1164a16c (diff) | |
download | blt-066971b1e6e77991d9161bb0216a63ba94ea04f9.zip blt-066971b1e6e77991d9161bb0216a63ba94ea04f9.tar.gz blt-066971b1e6e77991d9161bb0216a63ba94ea04f9.tar.bz2 |
Merge commit '9966985d896629eede849a84f18e406d1164a16c' as 'tcl8.6'
Diffstat (limited to 'tcl8.6/generic/tclTomMathStubLib.c')
-rw-r--r-- | tcl8.6/generic/tclTomMathStubLib.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tcl8.6/generic/tclTomMathStubLib.c b/tcl8.6/generic/tclTomMathStubLib.c new file mode 100644 index 0000000..324f2a3 --- /dev/null +++ b/tcl8.6/generic/tclTomMathStubLib.c @@ -0,0 +1,79 @@ +/* + * tclTomMathStubLib.c -- + * + * Stub object that will be statically linked into extensions that want + * to access Tcl. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * Copyright (c) 1998 Paul Duffin. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" + +MODULE_SCOPE const TclTomMathStubs *tclTomMathStubsPtr; + +const TclTomMathStubs *tclTomMathStubsPtr = NULL; + + +/* + *---------------------------------------------------------------------- + * + * TclTomMathInitStubs -- + * + * Initializes the Stubs table for Tcl's subset of libtommath + * + * Results: + * Returns a standard Tcl result. + * + * This procedure should not be called directly, but rather through + * the TclTomMath_InitStubs macro, to insure that the Stubs table + * matches the header files used in compilation. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE const char * +TclTomMathInitializeStubs( + Tcl_Interp *interp, /* Tcl interpreter */ + const char *version, /* Tcl version needed */ + int epoch, /* Stubs table epoch from the header files */ + int revision) /* Stubs table revision number from the + * header files */ +{ + int exact = 0; + const char *packageName = "tcl::tommath"; + const char *errMsg = NULL; + TclTomMathStubs *stubsPtr = NULL; + const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, + packageName, version, exact, &stubsPtr); + + if (actualVersion == NULL) { + return NULL; + } + if (stubsPtr == NULL) { + errMsg = "missing stub table pointer"; + } else if(stubsPtr->tclBN_epoch() != epoch) { + errMsg = "epoch number mismatch"; + } else if(stubsPtr->tclBN_revision() != revision) { + errMsg = "requires a later revision"; + } else { + tclTomMathStubsPtr = stubsPtr; + return actualVersion; + } + tclStubsPtr->tcl_ResetResult(interp); + tclStubsPtr->tcl_AppendResult(interp, "Error loading ", packageName, + " (requested version ", version, ", actual version ", + actualVersion, "): ", errMsg, NULL); + return NULL; +} + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ |