summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.h
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-11-14 20:44:43 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-11-14 20:44:43 (GMT)
commit17f540b256d78b8a6fc8bd9121a633dac6c23b19 (patch)
tree1abdc7a020d4095171e8cb7f16def9be025cb664 /generic/tclCompile.h
parentf745c9aa31bbdf8f71589fa25d30ce50cad94652 (diff)
downloadtcl-17f540b256d78b8a6fc8bd9121a633dac6c23b19.zip
tcl-17f540b256d78b8a6fc8bd9121a633dac6c23b19.tar.gz
tcl-17f540b256d78b8a6fc8bd9121a633dac6c23b19.tar.bz2
* doc/ParseCmd.3: Implementation of TIP 157. Adds recognition
* doc/Tcl.n: of the new leading {expand} syntax on words. * generic/tcl.h: Parses such words as the new Tcl_Token type * generic/tclBasic.c: TCL_TOKEN_EXPAND_WORD. Updated Tcl_EvalEx * generic/tclCompile.c: and the bytecode compiler/execution engine * generic/tclCompile.h: to recognize the new token type. New opcodes * generic/tclExecute.c: INST_LIST_VERIFY and INST_INVOKE_EXP and a new * generic/tclParse.c: operand type OPERAND_ULIST1 are defined. Docs * generic/tclTest.c: and tests are included. * tests/basic.test: * tests/compile.test: * tests/parse.test: * library/auto.tcl: Replaced several [eval]s used to perform * library/package.tcl: argument expansion with the new syntax. * library/safe.tcl: In the test files lindex.test and lset.test, * tests/cmdInfo.test: replaced use of [eval] to force direct * tests/encoding.test: string evaluation with use of [testevalex] * tests/execute.test: which more directly and robustly serves the * tests/fCmd.test: same purpose. * tests/http.test: * tests/init.test: * tests/interp.test: * tests/io.test: * tests/ioUtil.test: * tests/iogt.test: * tests/lindex.test: * tests/lset.test: * tests/namespace-old.test: * tests/namespace.test: * tests/pkg.test: * tests/pkgMkIndex.test: * tests/proc.test: * tests/reg.test: * tests/trace.test: * tests/upvar.test: * tests/winConsole.test: * tests/winFCmd.test:
Diffstat (limited to 'generic/tclCompile.h')
-rw-r--r--generic/tclCompile.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 89f27a5..869c7ad 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompile.h,v 1.38 2003/09/15 09:46:22 dkf Exp $
+ * RCS: @(#) $Id: tclCompile.h,v 1.39 2003/11/14 20:44:44 dgp Exp $
*/
#ifndef _TCLCOMPILATION
@@ -526,8 +526,11 @@ typedef struct ByteCode {
#define INST_EXPON 99 /* TIP#123 - exponentiation */
+#define INST_LIST_VERIFY 100
+#define INST_INVOKE_EXP 101
+
/* The last opcode */
-#define LAST_INST_OPCODE 99
+#define LAST_INST_OPCODE 101
/*
* Table describing the Tcl bytecode instructions: their name (for
@@ -545,7 +548,8 @@ typedef enum InstOperandType {
OPERAND_INT1, /* One byte signed integer. */
OPERAND_INT4, /* Four byte signed integer. */
OPERAND_UINT1, /* One byte unsigned integer. */
- OPERAND_UINT4 /* Four byte unsigned integer. */
+ OPERAND_UINT4, /* Four byte unsigned integer. */
+ OPERAND_ULIST1 /* List of one byte unsigned integers. */
} InstOperandType;
typedef struct InstructionDesc {
@@ -927,6 +931,25 @@ EXTERN int TclCompileVariableCmd _ANSI_ARGS_((
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) );\
TclUpdateStackReqs(op, i, envPtr)
+
+/*
+ * Macro to emit an immediate list of index deltas in the code stream.
+ * The ANSI C "prototypes" for this macro is:
+ *
+ * EXTERN void TclEmitImmList1 _ANSI_ARGS_((Tcl_Obj *listPtr,
+ * CompileEnv *envPtr));
+ */
+
+#define TclEmitImmDeltaList1(listPtr, envPtr) \
+ { \
+ int numBytes = Tcl_DStringLength(listPtr) + 1; \
+ while (((envPtr)->codeNext + numBytes) > (envPtr)->codeEnd) { \
+ TclExpandCodeArray(envPtr); \
+ } \
+ memcpy((VOID *) (envPtr)->codeNext, \
+ (VOID *)Tcl_DStringValue(listPtr), (size_t) numBytes); \
+ (envPtr)->codeNext += numBytes; \
+ }
/*
* Macro to push a Tcl object onto the Tcl evaluation stack. It emits the