summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorericm <ericm>2000-05-23 22:10:48 (GMT)
committerericm <ericm>2000-05-23 22:10:48 (GMT)
commitde3734d2d5031072fc62227f3958364b3479ab7b (patch)
treef33bb09809b6a1d88e4d4ac1ab8e54659e9a1a03 /generic/tclExecute.c
parent74b0da139ec49407e3c2bc15444e8b941e04e1fd (diff)
downloadtcl-de3734d2d5031072fc62227f3958364b3479ab7b.zip
tcl-de3734d2d5031072fc62227f3958364b3479ab7b.tar.gz
tcl-de3734d2d5031072fc62227f3958364b3479ab7b.tar.bz2
* generic/tclInt.h: Added function prototypes for
TclCompileStringCmd and TclCompileReturnCmd. * generic/tclCompile.h: Added definition of INST_STRLEN opcode and updated LAST_INST_OPCODE value. * generic/tclBasic.c: Added information about TclCompileStringCmd and TclCompileReturnCmd to BuiltInCmds table. * generic/tclExecute.c (TclExecuteByteCode): Added support for the INST_STRLEN opcode. * generic/tclCompCmds.c (TclCompileStringCmd): Basic implementation of byte-compiled [string] command. Not all subcommands are implemented; those that are not an out-line compiled. (TclCompileReturnCmd): Byte-compiled implementation of [return] command. Only "simple" returns are byte-compiled; in particular, if the -code, -errorinfo or -errorcode flags are used, the command is not byte-compiled.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index f19a968..1169689 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.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: tclExecute.c,v 1.11 2000/05/09 00:00:34 hobbs Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.12 2000/05/23 22:10:51 ericm Exp $
*/
#include "tclInt.h"
@@ -1806,6 +1806,25 @@ TclExecuteByteCode(interp, codePtr)
}
ADJUST_PC(1);
+ case INST_STRLEN:
+ {
+ int length1;
+ valuePtr = POP_OBJECT();
+ if (valuePtr->typePtr == &tclByteArrayType) {
+ (void) Tcl_GetByteArrayFromObj(valuePtr, &length1);
+ } else {
+ length1 = Tcl_GetCharLength(valuePtr);
+ }
+ if (Tcl_IsShared(valuePtr)) {
+ PUSH_OBJECT(Tcl_NewIntObj(length1));
+ TclDecrRefCount(valuePtr);
+ } else {
+ Tcl_SetIntObj(valuePtr, length1);
+ ++stackTop;
+ }
+ }
+ ADJUST_PC(1);
+
case INST_EQ:
case INST_NEQ:
case INST_LT: