summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authorstanton <stanton>1999-03-10 05:52:45 (GMT)
committerstanton <stanton>1999-03-10 05:52:45 (GMT)
commit0b4be24161f5971f3181adec27a32becf7cb8870 (patch)
tree92131df26a09a5f7b28f854fb7c0a62ba26cb8ac /generic/tclBasic.c
parenta5bface5b6607af37870fc5f5ee5019f6d5fb3f1 (diff)
downloadtcl-0b4be24161f5971f3181adec27a32becf7cb8870.zip
tcl-0b4be24161f5971f3181adec27a32becf7cb8870.tar.gz
tcl-0b4be24161f5971f3181adec27a32becf7cb8870.tar.bz2
Merged stubs changes into mainline for 8.0
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c84
1 files changed, 75 insertions, 9 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 70c437e..74d8bd1 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.15 1999/02/03 00:55:04 stanton Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.16 1999/03/10 05:52:46 stanton Exp $
*/
#include "tclInt.h"
@@ -237,6 +237,35 @@ static CmdInfo builtInCmds[] = {
/*
*----------------------------------------------------------------------
*
+ * Tcl_InitStubs --
+ *
+ * Ensures that the correct version of Tcl is loaded. This is
+ * a trivial implementation of the stubs library initializer
+ * that will get called if a stubs aware extension is directly
+ * linked with the Tcl library.
+ *
+ * Results:
+ * The actual version of Tcl that satisfies the request, or
+ * NULL to indicate that an error occurred.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+Tcl_InitStubs (interp, version, exact)
+ Tcl_Interp *interp;
+ char *version;
+ int exact;
+{
+ return Tcl_PkgRequire(interp, "Tcl", version, exact);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* Tcl_CreateInterp --
*
* Create a new TCL command interpreter.
@@ -340,6 +369,12 @@ Tcl_CreateInterp()
iPtr->execEnvPtr = TclCreateExecEnv((Tcl_Interp *) iPtr);
/*
+ * Initialise the stub table pointer.
+ */
+
+ iPtr->stubTable = tclStubsPtr;
+
+ /*
* Create the core commands. Do it here, rather than calling
* Tcl_CreateCommand, because it's faster (there's no need to check for
* a pre-existing command by the same name). If a command has a
@@ -455,7 +490,8 @@ Tcl_CreateInterp()
* Register Tcl's version number.
*/
- Tcl_PkgProvide((Tcl_Interp *) iPtr, "Tcl", TCL_VERSION);
+ Tcl_PkgProvideEx((Tcl_Interp *) iPtr, "Tcl", TCL_VERSION,
+ (ClientData) tclStubsPtr);
return (Tcl_Interp *) iPtr;
}
@@ -3897,7 +3933,7 @@ Tcl_AddObjErrorInfo(interp, message, length)
/*
*----------------------------------------------------------------------
*
- * Tcl_VarEval --
+ * Tcl_VarEvalVA --
*
* Given a variable number of string arguments, concatenate them
* all together and execute the result as a Tcl command.
@@ -3911,14 +3947,14 @@ Tcl_AddObjErrorInfo(interp, message, length)
*
*----------------------------------------------------------------------
*/
- /* VARARGS2 */ /* ARGSUSED */
+
int
-Tcl_VarEval TCL_VARARGS_DEF(Tcl_Interp *,arg1)
+Tcl_VarEvalVA (interp, argList)
+ Tcl_Interp *interp; /* Interpreter in which to evaluate command. */
+ va_list argList; /* Variable argument list. */
{
- va_list argList;
Tcl_DString buf;
char *string;
- Tcl_Interp *interp;
int result;
/*
@@ -3928,7 +3964,6 @@ Tcl_VarEval TCL_VARARGS_DEF(Tcl_Interp *,arg1)
* space.
*/
- interp = TCL_VARARGS_START(Tcl_Interp *,arg1,argList);
Tcl_DStringInit(&buf);
while (1) {
string = va_arg(argList, char *);
@@ -3937,7 +3972,6 @@ Tcl_VarEval TCL_VARARGS_DEF(Tcl_Interp *,arg1)
}
Tcl_DStringAppend(&buf, string, -1);
}
- va_end(argList);
result = Tcl_Eval(interp, Tcl_DStringValue(&buf));
Tcl_DStringFree(&buf);
@@ -3947,6 +3981,38 @@ Tcl_VarEval TCL_VARARGS_DEF(Tcl_Interp *,arg1)
/*
*----------------------------------------------------------------------
*
+ * Tcl_VarEval --
+ *
+ * Given a variable number of string arguments, concatenate them
+ * all together and execute the result as a Tcl command.
+ *
+ * Results:
+ * A standard Tcl return result. An error message or other
+ * result may be left in interp->result.
+ *
+ * Side effects:
+ * Depends on what was done by the command.
+ *
+ *----------------------------------------------------------------------
+ */
+ /* VARARGS2 */ /* ARGSUSED */
+int
+Tcl_VarEval TCL_VARARGS_DEF(Tcl_Interp *,arg1)
+{
+ Tcl_Interp *interp;
+ va_list argList;
+ int result;
+
+ interp = TCL_VARARGS_START(Tcl_Interp *,arg1,argList);
+ result = Tcl_VarEvalVA(interp, argList);
+ va_end(argList);
+
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* Tcl_GlobalEval --
*
* Evaluate a command at global level in an interpreter.