diff options
author | dkf <dkf@noemail.net> | 2013-12-12 09:13:39 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2013-12-12 09:13:39 (GMT) |
commit | 12287ca48d2056d1f5e9fdb953b0c874b38ccb9b (patch) | |
tree | 0452907d177676bbc3258a647e4f3a616961101a /generic/tclCompile.c | |
parent | 66fe145b374ed8c152690f9448fd405c250834e0 (diff) | |
parent | d1c54b173608ee00ce3cc4776837e7975897f730 (diff) | |
download | tcl-12287ca48d2056d1f5e9fdb953b0c874b38ccb9b.zip tcl-12287ca48d2056d1f5e9fdb953b0c874b38ccb9b.tar.gz tcl-12287ca48d2056d1f5e9fdb953b0c874b38ccb9b.tar.bz2 |
merge trunk; document added instructions
FossilOrigin-Name: 3c12b66379960bab02fbcbb598d9f57241b67cc3
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r-- | generic/tclCompile.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 418dd1c..14d9451 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -545,6 +545,34 @@ InstructionDesc const tclInstructionTable[] = { /* Drops an element from the auxiliary stack, popping stack elements * until the matching stack depth is reached. */ + /* New foreach implementation */ + {"foreach_start", 5, +2, 1, {OPERAND_AUX4}}, + /* Initialize execution of a foreach loop. Operand is aux data index + * of the ForeachInfo structure for the foreach command. It pushes 2 + * elements which hold runtime params for foreach_step, they are later + * dropped by foreach_end together with the value lists. NOTE that the + * iterator-tracker and info reference must not be passed to bytecodes + * that handle normal Tcl values. NOTE that this instruction jumps to + * the foreach_step instruction paired with it; the stack info below + * is only nominal. + * Stack: ... listObjs... => ... listObjs... iterTracker info */ + {"foreach_step", 1, 0, 0, {OPERAND_NONE}}, + /* "Step" or begin next iteration of foreach loop. Assigns to foreach + * iteration variables. May jump to straight after the foreach_start + * that pushed the iterTracker and info values. MUST be followed + * immediately by a foreach_end. + * Stack: ... listObjs... iterTracker info => + * ... listObjs... iterTracker info */ + {"foreach_end", 1, 0, 0, {OPERAND_NONE}}, + /* Clean up a foreach loop by dropping the info value, the tracker + * value and the lists that were being iterated over. + * Stack: ... listObjs... iterTracker info => ... */ + {"lmap_collect", 1, -1, 0, {OPERAND_NONE}}, + /* Appends the value at the top of the stack to the list located on + * the stack the "other side" of the foreach-related values. + * Stack: ... collector listObjs... iterTracker info value => + * ... collector listObjs... iterTracker info */ + {"strtrim", 1, -1, 0, {OPERAND_NONE}}, /* [string trim] core: removes the characters (designated by the value * at the top of the stack) from both ends of the string and pushes @@ -579,17 +607,6 @@ InstructionDesc const tclInstructionTable[] = { * the default (extended "C" locale) rules. * Stack: ... string => ... newString */ - /* New foreach implementation */ - {"foreach_start", 5, +2, 1, {OPERAND_AUX4}}, - /* Initialize execution of a foreach loop. Operand is aux data index - * of the ForeachInfo structure for the foreach command. It pushes 2 - * elements which hold runtime params for foreach_step, they are later - * dropped by foreach_end together with the value lists. */ - {"foreach_step", 1, 0, 0, {OPERAND_NONE}}, - /* "Step" or begin next iteration of foreach loop. */ - {"foreach_end", 1, 0, 0, {OPERAND_NONE}}, - {"lmap_collect", 1, -1, 0, {OPERAND_NONE}}, - {NULL, 0, 0, 0, {OPERAND_NONE}} }; |