diff options
-rw-r--r-- | doc/AllowExc.3 | 3 | ||||
-rw-r--r-- | doc/CrtInterp.3 | 4 | ||||
-rw-r--r-- | doc/Eval.3 | 20 | ||||
-rw-r--r-- | generic/tcl.decls | 16 | ||||
-rw-r--r-- | generic/tclBasic.c | 80 | ||||
-rw-r--r-- | generic/tclDecls.h | 16 | ||||
-rw-r--r-- | generic/tclIOCmd.c | 14 | ||||
-rw-r--r-- | generic/tclStubInit.c | 4 |
8 files changed, 30 insertions, 127 deletions
diff --git a/doc/AllowExc.3 b/doc/AllowExc.3 index 0477c88..5a757ae 100644 --- a/doc/AllowExc.3 +++ b/doc/AllowExc.3 @@ -29,8 +29,7 @@ terminates with a completion code other than \fBTCL_OK\fR, \fBTCL_ERROR\fR or \fBTCL_RETURN\fR, then Tcl normally converts this into a \fBTCL_ERROR\fR return with an appropriate message. The particular script evaluation procedures of Tcl that act in the manner are -\fBTcl_EvalObjEx\fR, \fBTcl_EvalObjv\fR, \fBTcl_Eval\fR, \fBTcl_EvalEx\fR, -\fBTcl_VarEval\fR and \fBTcl_VarEvalVA\fR. +\fBTcl_EvalObjEx\fR, \fBTcl_EvalObjv\fR, \fBTcl_Eval\fR, \fBTcl_EvalEx\fR. .PP However, if \fBTcl_AllowExceptions\fR is invoked immediately before calling one of those a procedures, then arbitrary completion diff --git a/doc/CrtInterp.3 b/doc/CrtInterp.3 index d8ee2cc..aac3a1d 100644 --- a/doc/CrtInterp.3 +++ b/doc/CrtInterp.3 @@ -107,7 +107,7 @@ uses. \fBInterpreter Creation And Deletion\fR . When a new interpreter is created and used in a call to \fBTcl_Eval\fR, -\fBTcl_VarEval\fR, \fBTcl_SetVar\fR, or \fBTcl_GetVar\fR, a pair of calls +\fBTcl_SetVar\fR, or \fBTcl_GetVar\fR, a pair of calls to \fBTcl_Preserve\fR and \fBTcl_Release\fR should be wrapped around all uses of the interpreter. Remember that it is unsafe to use the interpreter once \fBTcl_Release\fR has been called. To ensure that the interpreter is @@ -120,7 +120,7 @@ code. . When an interpreter is retrieved from a data structure (e.g. the client data of a callback) for use in one of the evaluation functions -(\fBTcl_Eval\fR, \fBTcl_VarEval\fR, \fBTcl_EvalObjv\fR etc.) or variable +(\fBTcl_Eval\fR, \fBTcl_EvalObjv\fR etc.) or variable access functions (\fBTcl_SetVar\fR, \fBTcl_GetVar\fR, \fBTcl_SetVar2Ex\fR, etc.), a pair of calls to \fBTcl_Preserve\fR and \fBTcl_Release\fR should be wrapped around all uses of the interpreter; it is unsafe to reuse the @@ -10,7 +10,7 @@ .TH Tcl_Eval 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME -Tcl_EvalObjEx, Tcl_EvalObjv, Tcl_Eval, Tcl_EvalEx, Tcl_VarEval, Tcl_VarEvalVA \- execute Tcl scripts +Tcl_EvalObjEx, Tcl_EvalObjv, Tcl_Eval, Tcl_EvalEx \- execute Tcl scripts .SH SYNOPSIS .nf \fB#include <tcl.h>\fR @@ -26,12 +26,6 @@ int .sp int \fBTcl_EvalEx\fR(\fIinterp, script, numBytes, flags\fR) -.sp -int -\fBTcl_VarEval\fR(\fIinterp, part, part, ... \fB(char *) NULL\fR) -.sp -int -\fBTcl_VarEvalVA\fR(\fIinterp, argList\fR) .SH ARGUMENTS .AS Tcl_Interp **termPtr .AP Tcl_Interp *interp in @@ -108,18 +102,6 @@ executed again, \fBTcl_Eval\fR may be faster than \fBTcl_EvalObjEx\fR. \fBTcl_EvalEx\fR is an extended version of \fBTcl_Eval\fR that takes additional arguments \fInumBytes\fR and \fIflags\fR. \fBTcl_EvalEx\fR is generally preferred over \fBTcl_Eval\fR. -.PP -\fBTcl_VarEval\fR takes any number of string arguments -of any length, concatenates them into a single string, -then calls \fBTcl_Eval\fR to execute that string as a Tcl command. -It returns the result of the command and also modifies -\fIinterp->result\fR in the same way as \fBTcl_Eval\fR. -The last argument to \fBTcl_VarEval\fR must be NULL to indicate the end -of arguments. \fBTcl_VarEval\fR is now deprecated. -.PP -\fBTcl_VarEvalVA\fR is the same as \fBTcl_VarEval\fR except that -instead of taking a variable number of arguments it takes an argument -list. Like \fBTcl_VarEval\fR, \fBTcl_VarEvalVA\fR is deprecated. .SH "FLAG BITS" .PP diff --git a/generic/tcl.decls b/generic/tcl.decls index 76d5298..fe1d763 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -635,7 +635,7 @@ declare 176 { const char *Tcl_GetVar2(Tcl_Interp *interp, const char *part1, const char *part2, int flags) } -# Removed in Tcl 9.0 +# Removed in 9.0 #declare 177 { # int Tcl_GlobalEval(Tcl_Interp *interp, const char *command) #} @@ -923,9 +923,10 @@ declare 259 { int Tcl_UpVar2(Tcl_Interp *interp, const char *frameName, const char *part1, const char *part2, const char *localName, int flags) } -declare 260 { - int Tcl_VarEval(Tcl_Interp *interp, ...) -} +# Removed in 9.0 +#declare 260 { +# int Tcl_VarEval(Tcl_Interp *interp, ...) +#} declare 261 { ClientData Tcl_VarTraceInfo(Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData) @@ -983,9 +984,10 @@ declare 274 { declare 275 { void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList) } -declare 276 { - int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList) -} +# Removed in 9.0 +#declare 276 { +# int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList) +#} declare 277 { Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options) } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 7202184..4f70cee 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6357,86 +6357,6 @@ Tcl_AddObjErrorInfo( } /* - *--------------------------------------------------------------------------- - * - * Tcl_VarEvalVA -- - * - * 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 the interp's result. - * - * Side effects: - * Depends on what was done by the command. - * - *--------------------------------------------------------------------------- - */ - -int -Tcl_VarEvalVA( - Tcl_Interp *interp, /* Interpreter in which to evaluate command */ - va_list argList) /* Variable argument list. */ -{ - Tcl_DString buf; - char *string; - int result; - - /* - * Copy the strings one after the other into a single larger string. Use - * stack-allocated space for small commands, but if the command gets too - * large than call ckalloc to create the space. - */ - - Tcl_DStringInit(&buf); - while (1) { - string = va_arg(argList, char *); - if (string == NULL) { - break; - } - Tcl_DStringAppend(&buf, string, -1); - } - - result = Tcl_Eval(interp, Tcl_DStringValue(&buf)); - Tcl_DStringFree(&buf); - return result; -} - -/* - *---------------------------------------------------------------------- - * - * 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 the interp. - * - * Side effects: - * Depends on what was done by the command. - * - *---------------------------------------------------------------------- - */ - /* ARGSUSED */ -int -Tcl_VarEval( - Tcl_Interp *interp, - ...) -{ - va_list argList; - int result; - - va_start(argList, interp); - result = Tcl_VarEvalVA(interp, argList); - va_end(argList); - - return result; -} - -/* *---------------------------------------------------------------------- * * Tcl_SetRecursionLimit -- diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 5c206aa..0770e98 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -747,8 +747,7 @@ TCLAPI int Tcl_UpVar(Tcl_Interp *interp, const char *frameName, TCLAPI int Tcl_UpVar2(Tcl_Interp *interp, const char *frameName, const char *part1, const char *part2, const char *localName, int flags); -/* 260 */ -TCLAPI int Tcl_VarEval(Tcl_Interp *interp, ...); +/* Slot 260 is reserved */ /* 261 */ TCLAPI ClientData Tcl_VarTraceInfo(Tcl_Interp *interp, const char *varName, int flags, @@ -795,8 +794,7 @@ TCLAPI const char * Tcl_PkgRequire(Tcl_Interp *interp, const char *name, /* 275 */ TCLAPI void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList); -/* 276 */ -TCLAPI int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList); +/* Slot 276 is reserved */ /* 277 */ TCLAPI Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options); /* 278 */ @@ -2063,7 +2061,7 @@ typedef struct TclStubs { void (*tcl_UpdateLinkedVar) (Tcl_Interp *interp, const char *varName); /* 257 */ int (*tcl_UpVar) (Tcl_Interp *interp, const char *frameName, const char *varName, const char *localName, int flags); /* 258 */ int (*tcl_UpVar2) (Tcl_Interp *interp, const char *frameName, const char *part1, const char *part2, const char *localName, int flags); /* 259 */ - int (*tcl_VarEval) (Tcl_Interp *interp, ...); /* 260 */ + void (*reserved260)(void); ClientData (*tcl_VarTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 261 */ ClientData (*tcl_VarTraceInfo2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 262 */ int (*tcl_Write) (Tcl_Channel chan, const char *s, int slen); /* 263 */ @@ -2079,7 +2077,7 @@ typedef struct TclStubs { int (*tclPkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */ const char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */ void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */ - int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */ + void (*reserved276)(void); Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */ void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */ void (*tcl_GetVersion) (int *major, int *minor, int *patchLevel, int *type); /* 279 */ @@ -2979,8 +2977,7 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_UpVar) /* 258 */ #define Tcl_UpVar2 \ (tclStubsPtr->tcl_UpVar2) /* 259 */ -#define Tcl_VarEval \ - (tclStubsPtr->tcl_VarEval) /* 260 */ +/* Slot 260 is reserved */ #define Tcl_VarTraceInfo \ (tclStubsPtr->tcl_VarTraceInfo) /* 261 */ #define Tcl_VarTraceInfo2 \ @@ -3011,8 +3008,7 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_PkgRequire) /* 274 */ #define Tcl_SetErrorCodeVA \ (tclStubsPtr->tcl_SetErrorCodeVA) /* 275 */ -#define Tcl_VarEvalVA \ - (tclStubsPtr->tcl_VarEvalVA) /* 276 */ +/* Slot 276 is reserved */ #define Tcl_WaitPid \ (tclStubsPtr->tcl_WaitPid) /* 277 */ #define Tcl_PanicVA \ diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index f738b1a..27f156f 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1324,11 +1324,11 @@ AcceptCallbackProc( if (acceptCallbackPtr->interp != NULL) { char portBuf[TCL_INTEGER_SPACE]; - char *script = acceptCallbackPtr->script; + Tcl_Obj *script = Tcl_NewStringObj(acceptCallbackPtr->script, -1); Tcl_Interp *interp = acceptCallbackPtr->interp; int result; - Tcl_Preserve(script); + Tcl_IncrRefCount(script); Tcl_Preserve(interp); TclFormatInt(portBuf, port); @@ -1341,8 +1341,12 @@ AcceptCallbackProc( Tcl_RegisterChannel(NULL, chan); - result = Tcl_VarEval(interp, script, " ", Tcl_GetChannelName(chan), - " ", address, " ", portBuf, NULL); + result = Tcl_ListObjAppendElement(interp, script, Tcl_NewStringObj(Tcl_GetChannelName(chan), -1)); + if (result == TCL_OK) { + Tcl_ListObjAppendElement(NULL, script, Tcl_NewStringObj(address, -1)); + Tcl_ListObjAppendElement(NULL, script, Tcl_NewStringObj(portBuf, -1)); + result = Tcl_EvalObjEx(interp, script, 0); + } if (result != TCL_OK) { Tcl_BackgroundException(interp, result); Tcl_UnregisterChannel(interp, chan); @@ -1356,7 +1360,7 @@ AcceptCallbackProc( Tcl_UnregisterChannel(NULL, chan); Tcl_Release(interp); - Tcl_Release(script); + Tcl_DecrRefCount(script); } else { /* * The interpreter has been deleted, so there is no useful way to use diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 30c2b76..50fc6de 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -930,7 +930,7 @@ const TclStubs tclStubs = { Tcl_UpdateLinkedVar, /* 257 */ Tcl_UpVar, /* 258 */ Tcl_UpVar2, /* 259 */ - Tcl_VarEval, /* 260 */ + 0, /* 260 */ Tcl_VarTraceInfo, /* 261 */ Tcl_VarTraceInfo2, /* 262 */ Tcl_Write, /* 263 */ @@ -946,7 +946,7 @@ const TclStubs tclStubs = { TclPkgProvide, /* 273 */ Tcl_PkgRequire, /* 274 */ Tcl_SetErrorCodeVA, /* 275 */ - Tcl_VarEvalVA, /* 276 */ + 0, /* 276 */ Tcl_WaitPid, /* 277 */ Tcl_PanicVA, /* 278 */ Tcl_GetVersion, /* 279 */ |