#pragma prototyped
#include "tkshlib.h"
{
{
}
else
return name;
}
/*
*----------------------------------------------------------------------
*
* TclUpdateReturnInfo --
*
* This procedure is called when procedures return, and at other
* points where the TCL_RETURN code is used. It examines fields
* such as iPtr->returnCode and iPtr->errorCode and modifies
* the real return status accordingly.
*
* Results:
* The return value is the true completion code to use for
* the procedure, instead of TCL_RETURN.
*
* Side effects:
* The errorInfo and errorCode variables may get modified.
*
*----------------------------------------------------------------------
*/
int
* exception is being processed. */
{
int code;
}
}
return code;
}
/*
*-----------------------------------------------------------------
*
* Tcl_Eval --
*
* Parse and execute a command in the Tcl language.
*
* Results:
* The return value is one of the return codes defined in tcl.hd
* (such as TCL_OK), and interp->result contains a string value
* to supplement the return code. The value of interp->result
* will persist only until the next call to Tcl_Eval: copy it or
* lose it! *TermPtr is filled in with the character just after
* the last one that was part of the command (usually a NULL
* character or a closing bracket).
*
* Side effects:
* Almost certainly; depends on the command.
*
*-----------------------------------------------------------------
*/
int
* by a previous call to Tcl_CreateInterp). */
char *cmd; /* Pointer to TCL command to interpret. */
{
/*
* The storage immediately below is used to generate a copy
* of the command, after all argument substitutions. Pv will
* contain the argv values passed to the command procedure.
*/
char *oldBuffer;
/*
* This procedure generates an (argv, argc) array for the command,
* It starts out with stack-allocated space but uses dynamically-
* allocated storage to increase it if needed.
*/
char *(argStorage[NUM_ARGS]);
int argc;
* in cmd. */
* (either ']' or '\0'). Zero means
* that newlines terminate commands. */
* procedure was called. */
* last one in the command. */
* command (used in calling trace
* procedures). */
* set to "..." to indicate that not
* all of offending command is included
* in errorInfo. "" means that the
* command is all there. */
#ifdef TKSH_NOT_USED
#else
int oldInterpType;
dprintf(("------- TCL EVAL ------------\n"));
#endif
/*
* Initialize the result to an empty string and clear out any
* error information. This makes sure that we return an empty
* result if there are no commands in the command string.
*/
iPtr->resultSpace[0] = 0;
/*
* Initialize the area in which command copies will be assembled.
*/
if (flags & TCL_BRACKET_TERM) {
termChar = ']';
} else {
termChar = 0;
}
/*
* Check depth of nested calls to Tcl_Eval: if this gets too large,
* it's probably because of an infinite loop somewhere.
*/
return TCL_ERROR;
}
/*
* There can be many sub-commands (separated by semi-colons or
* newlines) in one command string. This outer loop iterates over
* individual commands.
*/
/*
* Skim off leading white space and semi-colons, and skip
* comments.
*/
while (1) {
register char c = *src;
break;
}
src += 1;
}
if (*src == '#') {
src++;
break;
}
}
continue;
}
/*
* Parse the words of the command, generating the argc and
* argv for the command procedure. May have to call
* TclParseWords several times, expanding the argv array
* between calls.
*/
argc = 0;
while (1) {
char **newArgv;
int i;
/*
* Note: the "- 2" below guarantees that we won't use the
* last two argv slots here. One is for a NULL pointer to
* mark the end of the list, and the other is to leave room
* for inserting the command name "unknown" as the first
* argument (see below).
*/
ellipsis = "...";
goto done;
}
/*
* Careful! Buffer space may have gotten reallocated while
* parsing words. If this happened, be sure to update all
* of the older argv pointers to refer to the new space.
*/
int i;
for (i = 0; i < argc; i++) {
}
}
break;
}
/*
* Args didn't all fit in the current array. Make it bigger.
*/
argSize *= 2;
newArgv = (char **)
for (i = 0; i < argc; i++) {
}
if (argv != argStorage) {
}
}
/*
* If this is an empty command (or if we're just parsing
* commands without evaluating them), then just skip to the
* next command.
*/
continue;
}
/*
* Save information for the history module, if needed.
*/
#ifdef TKSH_NOT_USED
if (flags & TCL_RECORD_BOUNDS) {
}
/*
* Find the procedure to execute this command. If there isn't
* one, then see if there is a command "unknown". If so,
* invoke it instead, passing it the words of the original
* command as arguments.
*/
int i;
goto done;
}
for (i = argc; i >= 0; i--) {
}
argv[0] = "unknown";
argc++;
}
/*
* Call trace procedures, if any.
*/
char saved;
continue;
}
*src = 0;
}
#endif
/*
* At long last, invoke the command procedure. Reset the
* result to its default empty value first (it could have
* gotten changed by earlier commands in the same command
* string).
*/
#ifdef TKSH_NOT_USED
#endif
iPtr->resultSpace[0] = 0;
#ifdef TKSH_NOT_USED
#else
{
{
}
else
/* NOTE: 2008-03-16 &sh is a cheat here */
if (f)
{
sfputc(f,0); /* null terminate */
s[sfvalue(f)-2] = 0;
sfclose(f);
}
}
else
{
/* We need to check aliases too XX - also check mapped name? */
{
int oldMode;
char *cmd;
/* TkshSetListMode(oldMode); */
result = Tksh_ReturnVal();
}
else
{
int i;
{
"invalid command name \"", argv[0],
"\"", (char *) NULL);
goto done;
}
for (i = argc; i >= 0; i--) {
}
argv[0] = "unknown";
argc++;
}
}
#endif
if (Tcl_AsyncReady()) {
}
break;
}
}
done:
/*
* Free up any extra resources that were allocated.
*/
}
if (argv != argStorage) {
}
if (result == TCL_RETURN) {
}
#if TCL_MINOR_VERSION == 3
#else
&& !(flags & TCL_ALLOW_EXCEPTIONS)) {
#endif
} else if (result == TCL_CONTINUE) {
} else {
result);
}
}
/*
* Someone tried to delete the interpreter, but it couldn't
* actually be deleted because commands were in the middle of
* being evaluated. Delete the interpreter now. Also, return
* immediately: we can't execute the remaining code in the
* procedure because it accesses fields of the dead interpreter.
*/
return result;
}
}
/*
* If an error occurred, record information about what was being
* executed when the error occurred.
*/
int numChars;
register char *p;
/*
* Compute the line number where the error occurred.
*/
if (*p == '\n') {
}
}
if (*p == '\n') {
}
}
/*
* Figure out how much of the command to print in the error
* message (up to a certain number of characters, or up to
* the first new-line).
*/
ellipsis = " ...";
}
} else {
}
} else {
}
sh_sigcheck(0);
return result;
}