summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-03-06 22:19:29 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-03-06 22:19:29 (GMT)
commit590b69308f62e20ef06bc1dddb80c910187ec9a0 (patch)
tree143a00b3e9c1727409f8c0498c59131b75126e4f /generic
parent85e04692fde0b069530d71cd79b6f9fedb42571b (diff)
parenta083ddc8208f8e9f625ef92db90f941262a260a6 (diff)
downloadtcl-590b69308f62e20ef06bc1dddb80c910187ec9a0.zip
tcl-590b69308f62e20ef06bc1dddb80c910187ec9a0.tar.gz
tcl-590b69308f62e20ef06bc1dddb80c910187ec9a0.tar.bz2
* generic/tclBasic.c: More replacements of Tcl_UtfBackslash() calls
* generic/tclCompile.c: with TclParseBackslash() where possible. * generic/tclParse.c: * generic/tclUtil.c:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c4
-rw-r--r--generic/tclCompile.c8
-rw-r--r--generic/tclObj.c2
-rw-r--r--generic/tclParse.c4
-rw-r--r--generic/tclUtil.c31
5 files changed, 26 insertions, 23 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 33fed8d..36ece2c 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -4066,7 +4066,7 @@ TclEvalEx(
int line, /* The line the script starts on. */
int* clNextOuter, /* Information about an outer context for */
CONST char* outerScript) /* continuation line data. This is set only in
- * EvalTokensStandard(), to properly handle
+ * TclSubstTokens(), to properly handle
* [...]-nested commands. The 'outerScript'
* refers to the most-outer script containing the
* embedded command, which is refered to by
@@ -4573,7 +4573,7 @@ TclAdvanceContinuations (line,clNextPtrPtr,loc)
/*
* Track the invisible continuation lines embedded in a script, if
* any. Here they are just spaces (already). They were removed by
- * EvalTokensStandard() via Tcl_UtfBackslash().
+ * TclSubstTokens() via TclParseBackslash().
*
* *clNextPtrPtr <=> We have continuation lines to track.
* **clNextPtrPtr >= 0 <=> We are not beyond the last possible location.
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 6b00a0e..f2c4fdc 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1136,7 +1136,8 @@ TclWordKnownAtCompileTime(
case TCL_TOKEN_BS:
if (tempPtr != NULL) {
char utfBuf[TCL_UTF_MAX];
- int length = Tcl_UtfBackslash(tokenPtr->start, NULL, utfBuf);
+ int length = TclParseBackslash(tokenPtr->start,
+ tokenPtr->size, NULL, utfBuf);
Tcl_AppendToObj(tempPtr, utfBuf, length);
}
break;
@@ -1667,7 +1668,7 @@ TclCompileTokens(
* any. The table is extended if needed.
*
* Note: Different to the equivalent code in function
- * 'EvalTokensStandard()' (see file "tclBasic.c") we do not seem to need
+ * 'TclSubstTokens()' (see file "tclParse.c") we do not seem to need
* the 'adjust' variable. We also do not seem to need code which merges
* continuation line information of multiple words which concat'd at
* runtime. Either that or I have not managed to find a test case for
@@ -1700,7 +1701,8 @@ TclCompileTokens(
break;
case TCL_TOKEN_BS:
- length = Tcl_UtfBackslash(tokenPtr->start, NULL, buffer);
+ length = TclParseBackslash(tokenPtr->start, tokenPtr->size,
+ NULL, buffer);
Tcl_DStringAppend(&textBuffer, buffer, length);
/*
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 513a79d..d084692 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -80,7 +80,7 @@ typedef struct ObjData {
typedef struct ThreadSpecificData {
Tcl_HashTable* lineCLPtr; /* This table remembers for each Tcl_Obj
* generated by a call to the function
- * EvalTokensStandard() from a literal text
+ * TclSubstTokens() from a literal text
* where bs+nl sequences occured in it, if
* any. I.e. this table keeps track of
* invisible/stripped continuation lines. Its
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 963fad6..158ff42 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -2219,8 +2219,8 @@ TclSubstTokens(
break;
case TCL_TOKEN_BS:
- appendByteLength = Tcl_UtfBackslash(tokenPtr->start, NULL,
- utfCharBytes);
+ appendByteLength = TclParseBackslash(tokenPtr->start,
+ tokenPtr->size, NULL, utfCharBytes);
append = utfCharBytes;
/*
* If the backslash sequence we found is in a literal, and
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 211a7cd..d6e5b7b 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -327,14 +327,13 @@ TclFindElement(
*
* TclCopyAndCollapse --
*
- * Copy a string and eliminate any backslashes that aren't in braces.
+ * Copy a string and substitute all backslash escape sequences
*
* Results:
- * Count characters get copied from src to dst. Along the way, if
- * backslash sequences are found outside braces, the backslashes are
- * eliminated in the copy. After scanning count chars from source, a null
- * character is placed at the end of dst. Returns the number of
- * characters that got copied.
+ * Count bytes get copied from src to dst. Along the way, backslash
+ * sequences are substituted in the copy. After scanning count bytes
+ * from src, a null character is placed at the end of dst. Returns
+ * the number of bytes that got written to dst.
*
* Side effects:
* None.
@@ -344,26 +343,28 @@ TclFindElement(
int
TclCopyAndCollapse(
- int count, /* Number of characters to copy from src. */
+ int count, /* Number of byte to copy from src. */
CONST char *src, /* Copy from here... */
char *dst) /* ... to here. */
{
- register char c;
- int numRead;
int newCount = 0;
- int backslashCount;
- for (c = *src; count > 0; src++, c = *src, count--) {
+ while (count > 0) {
+ char c = *src;
if (c == '\\') {
- backslashCount = Tcl_UtfBackslash(src, &numRead, dst);
+ int numRead;
+ int backslashCount = TclParseBackslash(src, count, &numRead, dst);
+
dst += backslashCount;
newCount += backslashCount;
- src += numRead-1;
- count -= numRead-1;
+ src += numRead;
+ count -= numRead;
} else {
*dst = c;
dst++;
newCount++;
+ src++;
+ count--;
}
}
*dst = 0;
@@ -740,7 +741,7 @@ Tcl_ScanCountedElement(
} else {
int size;
- Tcl_UtfBackslash(p, &size, NULL);
+ TclParseBackslash(p, lastChar - p, &size, NULL);
p += size-1;
flags |= USE_BRACES;
}