summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmdsSZ.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2024-05-13 15:41:44 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2024-05-13 15:41:44 (GMT)
commit444e06f208e9503a7e93cd68a51ed73c3c82298b (patch)
tree5b346cf1401c23c69c43d84a1eb6986e442c7dfd /generic/tclCompCmdsSZ.c
parent6b9279d4f7c2ab12d40ffbce3629b8c79bc94136 (diff)
downloadtcl-444e06f208e9503a7e93cd68a51ed73c3c82298b.zip
tcl-444e06f208e9503a7e93cd68a51ed73c3c82298b.tar.gz
tcl-444e06f208e9503a7e93cd68a51ed73c3c82298b.tar.bz2
Clean up a lot of small whitespace issues
This is the dullest commit ever. Sorry.
Diffstat (limited to 'generic/tclCompCmdsSZ.c')
-rw-r--r--generic/tclCompCmdsSZ.c125
1 files changed, 63 insertions, 62 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index bc37155..968cc73 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -1129,66 +1129,66 @@ TclCompileStringReplaceCmd(
}
if (parsePtr->numWords == 5) {
- /*
- * When we have a string replacement, we have to take care about
- * not replacing empty substrings that [string replace] promises
- * not to replace
- *
- * The remaining index values might be suitable for conventional
- * string replacement, but only if they cannot possibly meet the
- * conditions described above at runtime. If there's a chance they
- * might, we would have to emit bytecode to check and at that point
- * we're paying more in bytecode execution time than would make
- * things worthwhile. Trouble is we are very limited in
- * how much we can detect that at compile time. After decoding,
- * we need, first:
- *
- * (first <= end)
- *
- * The encoded indices (first <= TCL_INDEX END) and
- * (first == TCL_INDEX_NONE) always meets this condition, but
- * any other encoded first index has some list for which it fails.
- *
- * We also need, second:
- *
- * (last >= 0)
- *
- * The encoded index (last >= TCL_INDEX_START) always meet this
- * condition but any other encoded last index has some list for
- * which it fails.
- *
- * Finally we need, third:
- *
- * (first <= last)
- *
- * Considered in combination with the constraints we already have,
- * we see that we can proceed when (first == TCL_INDEX_NONE).
- * These also permit simplification of the prefix|replace|suffix
- * construction. The other constraints, though, interfere with
- * getting a guarantee that first <= last.
- */
+ /*
+ * When we have a string replacement, we have to take care about
+ * not replacing empty substrings that [string replace] promises
+ * not to replace
+ *
+ * The remaining index values might be suitable for conventional
+ * string replacement, but only if they cannot possibly meet the
+ * conditions described above at runtime. If there's a chance they
+ * might, we would have to emit bytecode to check and at that point
+ * we're paying more in bytecode execution time than would make
+ * things worthwhile. Trouble is we are very limited in
+ * how much we can detect that at compile time. After decoding,
+ * we need, first:
+ *
+ * (first <= end)
+ *
+ * The encoded indices (first <= TCL_INDEX END) and
+ * (first == TCL_INDEX_NONE) always meets this condition, but
+ * any other encoded first index has some list for which it fails.
+ *
+ * We also need, second:
+ *
+ * (last >= 0)
+ *
+ * The encoded index (last >= TCL_INDEX_START) always meet this
+ * condition but any other encoded last index has some list for
+ * which it fails.
+ *
+ * Finally we need, third:
+ *
+ * (first <= last)
+ *
+ * Considered in combination with the constraints we already have,
+ * we see that we can proceed when (first == TCL_INDEX_NONE).
+ * These also permit simplification of the prefix|replace|suffix
+ * construction. The other constraints, though, interfere with
+ * getting a guarantee that first <= last.
+ */
- if ((first == (int)TCL_INDEX_START) && (last >= (int)TCL_INDEX_START)) {
- /* empty prefix */
- tokenPtr = TokenAfter(tokenPtr);
- CompileWord(envPtr, tokenPtr, interp, 4);
- OP4( REVERSE, 2);
- if (last == INT_MAX) {
- OP( POP); /* Pop original */
- } else {
- OP44( STR_RANGE_IMM, last + 1, (int)TCL_INDEX_END);
- OP1( STR_CONCAT1, 2);
+ if ((first == (int)TCL_INDEX_START) && (last >= (int)TCL_INDEX_START)) {
+ /* empty prefix */
+ tokenPtr = TokenAfter(tokenPtr);
+ CompileWord(envPtr, tokenPtr, interp, 4);
+ OP4( REVERSE, 2);
+ if (last == INT_MAX) {
+ OP( POP); /* Pop original */
+ } else {
+ OP44( STR_RANGE_IMM, last + 1, (int)TCL_INDEX_END);
+ OP1( STR_CONCAT1, 2);
+ }
+ return TCL_OK;
}
- return TCL_OK;
- }
- if ((last == (int)TCL_INDEX_NONE) && (first <= (int)TCL_INDEX_END)) {
- OP44( STR_RANGE_IMM, 0, first-1);
- tokenPtr = TokenAfter(tokenPtr);
- CompileWord(envPtr, tokenPtr, interp, 4);
- OP1( STR_CONCAT1, 2);
- return TCL_OK;
- }
+ if ((last == (int)TCL_INDEX_NONE) && (first <= (int)TCL_INDEX_END)) {
+ OP44( STR_RANGE_IMM, 0, first-1);
+ tokenPtr = TokenAfter(tokenPtr);
+ CompileWord(envPtr, tokenPtr, interp, 4);
+ OP1( STR_CONCAT1, 2);
+ return TCL_OK;
+ }
/* FLOW THROUGH TO genericReplace */
@@ -1474,12 +1474,12 @@ TclCompileSubstCmd(
wordTokenPtr = TokenAfter(wordTokenPtr);
}
-/*
+#if 0
if (TclSubstOptions(NULL, numOpts, objv, &flags) == TCL_OK) {
toSubst = objv[numOpts];
Tcl_IncrRefCount(toSubst);
}
-*/
+#endif
/* TODO: Figure out expansion to cover WordKnownAtCompileTime
* The difficulty is that WKACT makes a copy, and if TclSubstParse
@@ -2115,7 +2115,7 @@ IssueSwitchChainedTests(
* switch can match against and bodies to
* execute when the match succeeds. */
Tcl_Token **bodyToken, /* Array of pointers to pattern list items. */
- Tcl_Size *bodyLines, /* Array of line numbers for body list
+ Tcl_Size *bodyLines, /* Array of line numbers for body list
* items. */
Tcl_Size **bodyContLines) /* Array of continuation line info. */
{
@@ -2123,7 +2123,8 @@ IssueSwitchChainedTests(
int foundDefault; /* Flag to indicate whether a "default" clause
* is present. */
JumpFixup *fixupArray; /* Array of forward-jump fixup records. */
- unsigned int *fixupTargetArray; /* Array of places for fixups to point at. */
+ unsigned int *fixupTargetArray;
+ /* Array of places for fixups to point at. */
int fixupCount; /* Number of places to fix up. */
int contFixIndex; /* Where the first of the jumps due to a group
* of continuation bodies starts, or -1 if
@@ -2363,7 +2364,7 @@ IssueSwitchJumpTable(
* switch can match against and bodies to
* execute when the match succeeds. */
Tcl_Token **bodyToken, /* Array of pointers to pattern list items. */
- Tcl_Size *bodyLines, /* Array of line numbers for body list
+ Tcl_Size *bodyLines, /* Array of line numbers for body list
* items. */
Tcl_Size **bodyContLines) /* Array of continuation line info. */
{