diff options
author | vincentdarley <vincentdarley> | 2002-11-13 22:11:38 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2002-11-13 22:11:38 (GMT) |
commit | fe149949576c0ce56f3649fe2f2072823ba5e701 (patch) | |
tree | 62ea3a2dde7c791ca96c044c35cefabc0c70f126 /generic | |
parent | e624eb0ea85f7ae4a82f916dffab6466c5a26d5a (diff) | |
download | tcl-fe149949576c0ce56f3649fe2f2072823ba5e701.zip tcl-fe149949576c0ce56f3649fe2f2072823ba5e701.tar.gz tcl-fe149949576c0ce56f3649fe2f2072823ba5e701.tar.bz2 |
3 small fixes
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdMZ.c | 21 | ||||
-rw-r--r-- | generic/tclFileName.c | 48 | ||||
-rw-r--r-- | generic/tclStringObj.c | 6 |
3 files changed, 64 insertions, 11 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 8243790..0b2903e 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.78 2002/11/12 02:25:24 hobbs Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.79 2002/11/13 22:11:40 vincentdarley Exp $ */ #include "tclInt.h" @@ -3955,6 +3955,8 @@ TraceCommandProc(clientData, interp, oldName, newName, flags) int flags; /* OR-ed bits giving operation and other * information. */ { + Interp *iPtr = (Interp *) interp; + int stateCode; Tcl_SavedResult state; TraceCommandInfo *tcmdPtr = (TraceCommandInfo *) clientData; int code; @@ -3979,8 +3981,10 @@ TraceCommandProc(clientData, interp, oldName, newName, flags) } /* - * Execute the command. Save the interp's result used for - * the command. We discard any object result the command returns. + * Execute the command. Save the interp's result used for the + * command, including the value of iPtr->returnCode which may be + * modified when Tcl_Eval is invoked. We discard any object + * result the command returns. * * Add the TCL_TRACE_DESTROYED flag to tcmdPtr to indicate to * other areas that this will be destroyed by us, otherwise a @@ -3988,6 +3992,7 @@ TraceCommandProc(clientData, interp, oldName, newName, flags) */ Tcl_SaveResult(interp, &state); + stateCode = iPtr->returnCode; if (flags & TCL_TRACE_DESTROYED) { tcmdPtr->flags |= TCL_TRACE_DESTROYED; } @@ -3999,7 +4004,8 @@ TraceCommandProc(clientData, interp, oldName, newName, flags) } Tcl_RestoreResult(interp, &state); - + iPtr->returnCode = stateCode; + Tcl_DStringFree(&cmd); } /* @@ -4358,6 +4364,7 @@ TraceExecutionProc(ClientData clientData, Tcl_Interp *interp, */ if (call) { Tcl_SavedResult state; + int stateCode; Tcl_DString cmd; Tcl_DString sub; int i; @@ -4406,10 +4413,13 @@ TraceExecutionProc(ClientData clientData, Tcl_Interp *interp, /* * Execute the command. Save the interp's result used for - * the command. We discard any object result the command returns. + * the command, including the value of iPtr->returnCode which + * may be modified when Tcl_Eval is invoked. We discard any + * object result the command returns. */ Tcl_SaveResult(interp, &state); + stateCode = iPtr->returnCode; tcmdPtr->flags |= TCL_TRACE_EXEC_IN_PROGRESS; iPtr->flags |= INTERP_TRACE_IN_PROGRESS; @@ -4429,6 +4439,7 @@ TraceExecutionProc(ClientData clientData, Tcl_Interp *interp, if (traceCode == TCL_OK) { /* Restore result if trace execution was successful */ Tcl_RestoreResult(interp, &state); + iPtr->returnCode = stateCode; } Tcl_DStringFree(&cmd); diff --git a/generic/tclFileName.c b/generic/tclFileName.c index e3ec128..fc0dbcd 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclFileName.c,v 1.38 2002/09/27 00:50:10 hobbs Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.39 2002/11/13 22:11:40 vincentdarley Exp $ */ #include "tclInt.h" @@ -243,9 +243,51 @@ ExtractWinRoot(path, resultPtr, offset, typePtr) return tail; } } else { - *typePtr = TCL_PATH_RELATIVE; - return path; + int abs = 0; + if (path[0] == 'c' && path[1] == 'o') { + if (path[2] == 'm' && path[3] >= '1' && path[3] <= '9') { + /* May have match for 'com[1-9]:?', which is a serial port */ + if (path[4] == '\0') { + abs = 4; + } else if (path [4] == ':' && path[5] == '\0') { + abs = 5; + } + } else if (path[2] == 'n' && path[3] == '\0') { + /* Have match for 'con' */ + abs = 3; + } + } else if (path[0] == 'l' && path[1] == 'p' && path[2] == 't') { + if (path[3] >= '1' && path[3] <= '9') { + /* May have match for 'lpt[1-9]:?' */ + if (path[4] == '\0') { + abs = 4; + } else if (path [4] == ':' && path[5] == '\0') { + abs = 5; + } + } + } else if (path[0] == 'p' && path[1] == 'r' + && path[2] == 'n' && path[3] == '\0') { + /* Have match for 'prn' */ + abs = 3; + } else if (path[0] == 'n' && path[1] == 'u' + && path[2] == 'l' && path[3] == '\0') { + /* Have match for 'nul' */ + abs = 3; + } else if (path[0] == 'a' && path[1] == 'u' + && path[2] == 'x' && path[3] == '\0') { + /* Have match for 'aux' */ + abs = 3; + } + if (abs != 0) { + *typePtr = TCL_PATH_ABSOLUTE; + Tcl_DStringSetLength(resultPtr, offset); + Tcl_DStringAppend(resultPtr, path, abs); + return path + abs; + } } + /* Anything else is treated as relative */ + *typePtr = TCL_PATH_RELATIVE; + return path; } /* diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 47d0388..c951ae5 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -11,7 +11,7 @@ * of properly formed UTF-8 characters. There is a one-to-one map between * Unicode and UTF characters. Because Unicode characters have a fixed * width, operations such as indexing operate on Unicode data. The String - * ojbect is opitmized for the case where each UTF char in a string is + * object is optimized for the case where each UTF char in a string is * only one byte. In this case, we store the value of numChars, but we * don't store the Unicode data (unless Tcl_GetUnicode is explicitly * called). @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.25 2002/11/12 02:26:15 hobbs Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.26 2002/11/13 22:11:41 vincentdarley Exp $ */ #include "tclInt.h" @@ -1695,7 +1695,7 @@ SetStringFromAny(interp, objPtr) register Tcl_Obj *objPtr; /* The object to convert. */ { /* - * The Unicode object is opitmized for the case where each UTF char + * The Unicode object is optimized for the case where each UTF char * in a string is only one byte. In this case, we store the value of * numChars, but we don't copy the bytes to the unicodeObj->unicode. */ |