diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2013-06-08 13:17:26 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2013-06-08 13:17:26 (GMT) |
commit | 10c2a79550f9ca620b2c90fe2b4d1490980de7a7 (patch) | |
tree | 5fe83f026e9cb4e353b5d924d702594bfd02f715 /generic/tclCompile.h | |
parent | 61b945b1318228d66f41c3352fd8134372acd70b (diff) | |
download | tcl-10c2a79550f9ca620b2c90fe2b4d1490980de7a7.zip tcl-10c2a79550f9ca620b2c90fe2b4d1490980de7a7.tar.gz tcl-10c2a79550f9ca620b2c90fe2b4d1490980de7a7.tar.bz2 |
Factor out stereotypical ways of getting variable indices.
Diffstat (limited to 'generic/tclCompile.h')
-rw-r--r-- | generic/tclCompile.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 908dceb..9af4911 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1559,6 +1559,20 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); } /* + * How to get an anonymous local variable (used for holding temporary values + * off the stack) or a local simple scalar. + */ + +#define AnonymousLocal(envPtr) \ + (TclFindCompiledLocal(NULL, /*nameChars*/ 0, /*create*/ 1, (envPtr))) +#define LocalScalar(chars,len,envPtr) \ + (!TclIsLocalScalar((chars), (len)) ? -1 : \ + TclFindCompiledLocal((chars), (len), /*create*/ 1, (envPtr))) +#define LocalScalarFromToken(tokenPtr,envPtr) \ + ((tokenPtr)->type != TCL_TOKEN_SIMPLE_WORD ? -1 : \ + LocalScalar((tokenPtr)[1].start, (tokenPtr)[1].size, (envPtr))) + +/* * Flags bits used by TclPushVarName. */ |