summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-12-22 20:27:14 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-12-22 20:27:14 (GMT)
commita4001c9841d6451aa215a7387bf4a439b11a18fb (patch)
treec21abe18af5192fe68d7241c7e1215ee9474377c /generic/tclCompCmds.c
parenta11afffa9f17e5c95a97d579ce36b386363c0133 (diff)
downloadtcl-a4001c9841d6451aa215a7387bf4a439b11a18fb.zip
tcl-a4001c9841d6451aa215a7387bf4a439b11a18fb.tar.gz
tcl-a4001c9841d6451aa215a7387bf4a439b11a18fb.tar.bz2
Convert the LocalScalar*() macros to rest on TclPushVarName rather than on
TclIsLocalScalar().
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 18071b1..bde07bb 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -3234,6 +3234,54 @@ TclCompileFormatCmd(
/*
*----------------------------------------------------------------------
*
+ * TclLocalScalarFromToken --
+ *
+ * Get the index into the table of compiled locals that corresponds
+ * to a local scalar variable name.
+ *
+ * Results:
+ * Returns the non-negative integer index value into the table of
+ * compiled locals corresponding to a local scalar variable name.
+ * If the arguments passed in do not identify a local scalar variable
+ * then return -1.
+ *
+ * Side effects:
+ * May add an entery into the table of compiled locals.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclLocalScalarFromToken(
+ Tcl_Token *tokenPtr,
+ CompileEnv *envPtr)
+{
+ int isScalar, index;
+
+ TclPushVarName(NULL, tokenPtr, envPtr, TCL_NO_ELEMENT, &index, &isScalar);
+ if (!isScalar) {
+ index = -1;
+ }
+ return index;
+}
+
+int
+TclLocalScalar(
+ const char *bytes,
+ int numBytes,
+ CompileEnv *envPtr)
+{
+ Tcl_Token token[2] = {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1},
+ {TCL_TOKEN_TEXT, NULL, 0, 0}};
+
+ token[1].start = bytes;
+ token[1].size = numBytes;
+ return TclLocalScalarFromToken(token, envPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TclPushVarName --
*
* Procedure used in the compiling where pushing a variable name is