summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.20002
-rw-r--r--changes2
-rw-r--r--generic/regc_locale.c2
-rw-r--r--generic/tclIO.c16
-rw-r--r--generic/tclIOUtil.c12
-rw-r--r--library/install.tcl6
-rw-r--r--tests/chan.test12
-rw-r--r--tests/chanio.test14
-rw-r--r--tests/io.test16
-rw-r--r--tools/regexpTestLib.tcl4
10 files changed, 44 insertions, 42 deletions
diff --git a/ChangeLog.2000 b/ChangeLog.2000
index 7e78c19..8abe6c2 100644
--- a/ChangeLog.2000
+++ b/ChangeLog.2000
@@ -1356,7 +1356,7 @@
* doc/source.n:
* doc/Eval.3:
* tests/source.test:
- * generic/tclIOUtil.c (Tcl_EvalFile): added explicit \32 (^Z) eofchar
+ * generic/tclIOUtil.c (Tcl_EvalFile): added explicit \x1A (^Z) eofchar
(affects Tcl_EvalFile in C, "source" in Tcl). This was implicit on
Windows already, and is now cross-platform to allow for scripted
documents.
diff --git a/changes b/changes
index 286f30b..d6347f1 100644
--- a/changes
+++ b/changes
@@ -4976,7 +4976,7 @@ msgcat package (duperval, krone, nelson)
trace {add|remove|list} {variable|command} name ops command
(darley, melski)
-2000-09-06 (cross-platform feature) Set ^Z (\32) as default EOF char. (hobbs)
+2000-09-06 (cross-platform feature) Set ^Z (\x1A) as default EOF char. (hobbs)
2000-09-07 partial fix for bug 2460 to prevent exec mem leak on Windows for the
common case (gravereaux)
diff --git a/generic/regc_locale.c b/generic/regc_locale.c
index 7252b88..7d182e4 100644
--- a/generic/regc_locale.c
+++ b/generic/regc_locale.c
@@ -110,7 +110,7 @@ static const struct cname {
{"right-brace", '}'},
{"right-curly-bracket", '}'},
{"tilde", '~'},
- {"DEL", '\177'},
+ {"DEL", '\x7F'},
{NULL, 0}
};
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 374f770..b3b62ed 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -7930,20 +7930,18 @@ Tcl_GetChannelOption(
}
}
if (len == 0 || HaveOpt(2, "-eofchar")) {
+ char buf[4] = "";
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-eofchar");
}
- if (!(flags & TCL_READABLE) || (statePtr->inEofChar == 0)) {
- Tcl_DStringAppendElement(dsPtr, "");
- } else {
- char buf[4];
-
+ if ((flags & TCL_READABLE) && (statePtr->inEofChar != 0)) {
sprintf(buf, "%c", statePtr->inEofChar);
- Tcl_DStringAppendElement(dsPtr, buf);
}
if (len > 0) {
+ Tcl_DStringAppend(dsPtr, buf, TCL_INDEX_NONE);
return TCL_OK;
}
+ Tcl_DStringAppendElement(dsPtr, buf);
}
if (len == 0 || HaveOpt(1, "-nocomplainencoding")) {
if (len == 0) {
@@ -8181,6 +8179,7 @@ Tcl_SetChannelOption(
if (GotFlag(statePtr, TCL_READABLE)) {
statePtr->inEofChar = newValue[0];
}
+#ifndef TCL_NO_DEPRECATED
} else if (Tcl_SplitList(interp, newValue, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;
} else if (argc == 0) {
@@ -8201,11 +8200,12 @@ Tcl_SetChannelOption(
if (GotFlag(statePtr, TCL_READABLE)) {
statePtr->inEofChar = inValue;
}
+#endif
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad value for -eofchar: should be a list of zero,"
- " one, or two elements", -1));
+ "bad value for -eofchar: must be non-NUL ASCII"
+ " character", -1));
}
Tcl_Free((void *)argv);
return TCL_ERROR;
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index aa92754..470977e 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1715,11 +1715,11 @@ Tcl_FSEvalFileEx(
}
/*
- * The eof character is \32 (^Z). This is standard on Windows, and Tcl
- * uses it on every platform to allow for scripted documents. [Bug: 2040]
+ * The eof character is \x1A (^Z). Tcl uses it on every platform to allow
+ * for scripted documents. [Bug: 2040]
*/
- Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}");
+ Tcl_SetChannelOption(interp, chan, "-eofchar", "\x1A");
/*
* If the encoding is specified, set the channel to that encoding.
@@ -1851,11 +1851,11 @@ TclNREvalFile(
TclPkgFileSeen(interp, TclGetString(pathPtr));
/*
- * The eof character is \32 (^Z). This is standard on Windows, and Tcl
- * uses it on every platform to allow for scripted documents. [Bug: 2040]
+ * The eof character is \x1A (^Z). Tcl uses it on every platform to allow
+ * for scripted documents. [Bug: 2040]
*/
- Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}");
+ Tcl_SetChannelOption(interp, chan, "-eofchar", "\x1A");
/*
* If the encoding is specified, set the channel to that encoding.
diff --git a/library/install.tcl b/library/install.tcl
index 50e40df..4abdead 100644
--- a/library/install.tcl
+++ b/library/install.tcl
@@ -35,7 +35,7 @@ proc ::practcl::_pkgindex_directory {path} {
# Read the file, and override assumptions as needed
###
set fin [open $file r]
- fconfigure $fin -encoding utf-8 -eofchar "\x1A {}"
+ fconfigure $fin -encoding utf-8 -eofchar \x1A
set dat [read $fin]
close $fin
# Look for a teapot style Package statement
@@ -59,7 +59,7 @@ proc ::practcl::_pkgindex_directory {path} {
foreach file [glob -nocomplain $path/*.tcl] {
if { [file tail $file] == "version_info.tcl" } continue
set fin [open $file r]
- fconfigure $fin -encoding utf-8 -eofchar "\x1A {}"
+ fconfigure $fin -encoding utf-8 -eofchar \x1A
set dat [read $fin]
close $fin
if {![regexp "package provide" $dat]} continue
@@ -79,7 +79,7 @@ proc ::practcl::_pkgindex_directory {path} {
return $buffer
}
set fin [open $pkgidxfile r]
- fconfigure $fin -encoding utf-8 -eofchar "\x1A {}"
+ fconfigure $fin -encoding utf-8 -eofchar \x1A
set dat [read $fin]
close $fin
set trace 0
diff --git a/tests/chan.test b/tests/chan.test
index 280783f..946e424 100644
--- a/tests/chan.test
+++ b/tests/chan.test
@@ -12,6 +12,8 @@ if {"::tcltest" ni [namespace children]} {
namespace import -force ::tcltest::*
}
+package require tcltests
+
#
# Note: The tests for the chan methods "create" and "postevent"
# currently reside in the file "ioCmd.test".
@@ -49,19 +51,19 @@ test chan-4.1 {chan command: configure subcommand} -body {
} -returnCodes error -result "wrong # args: should be \"chan configure channelId ?-option value ...?\""
test chan-4.2 {chan command: [Bug 800753]} -body {
chan configure stdout -eofchar Ā
-} -returnCodes error -match glob -result {bad value*}
+} -returnCodes error -result {bad value for -eofchar: must be non-NUL ASCII character}
test chan-4.3 {chan command: [Bug 800753]} -body {
chan configure stdout -eofchar \x00
-} -returnCodes error -match glob -result {bad value*}
-test chan-4.4 {chan command: check valid inValue, no outValue} -body {
+} -returnCodes error -result {bad value for -eofchar: must be non-NUL ASCII character}
+test chan-4.4 {chan command: check valid inValue, no outValue} -constraints deprecated -body {
chan configure stdout -eofchar [list \x27 {}]
} -result {}
test chan-4.5 {chan command: check valid inValue, invalid outValue} -body {
chan configure stdout -eofchar [list \x27 \x80]
-} -returnCodes error -match glob -result {bad value for -eofchar:*}
+} -returnCodes error -result {bad value for -eofchar: must be non-NUL ASCII character}
test chan-4.6 {chan command: check no inValue, valid outValue} -body {
chan configure stdout -eofchar [list {} \x27]
-} -returnCodes error -result {bad value for -eofchar: must be non-NUL ASCII character} -cleanup {chan configure stdout -eofchar [list {} {}]}
+} -returnCodes error -result {bad value for -eofchar: must be non-NUL ASCII character} -cleanup {chan configure stdout -eofchar {}}
test chan-5.1 {chan command: copy subcommand} -body {
chan copy foo
diff --git a/tests/chanio.test b/tests/chanio.test
index c7cde60..91cfcd4 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -1889,13 +1889,13 @@ test chan-io-20.2 {Tcl_CreateChannel: initial settings} -constraints {win} -body
list [chan configure $f -eofchar] [chan configure $f -translation]
} -cleanup {
chan close $f
-} -result {{{}} {auto crlf}}
+} -result {{} {auto crlf}}
test chan-io-20.3 {Tcl_CreateChannel: initial settings} -constraints {unix} -body {
set f [open $path(test1) w+]
list [chan configure $f -eofchar] [chan configure $f -translation]
} -cleanup {
chan close $f
-} -result {{{}} {auto lf}}
+} -result {{} {auto lf}}
test chan-io-20.5 {Tcl_CreateChannel: install channel in empty slot} -setup {
set path(stdout) [makeFile {} stdout]
} -constraints {stdio notWinCI} -body {
@@ -5285,7 +5285,7 @@ test chan-io-39.21 {Tcl_SetChannelOption, setting read mode independently} \
test chan-io-39.22 {Tcl_SetChannelOption, invariance} -setup {
file delete $path(test1)
set l ""
-} -constraints {unix} -body {
+} -constraints {unix deprecated} -body {
set f1 [open $path(test1) w+]
lappend l [chan configure $f1 -eofchar]
chan configure $f1 -eofchar {O {}}
@@ -5298,7 +5298,7 @@ test chan-io-39.22 {Tcl_SetChannelOption, invariance} -setup {
test chan-io-39.22a {Tcl_SetChannelOption, invariance} -setup {
file delete $path(test1)
set l [list]
-} -body {
+} -constraints deprecated -body {
set f1 [open $path(test1) w+]
chan configure $f1 -eofchar {O {}}
lappend l [chan configure $f1 -eofchar]
@@ -5307,7 +5307,7 @@ test chan-io-39.22a {Tcl_SetChannelOption, invariance} -setup {
lappend l [list [catch {chan configure $f1 -eofchar {1 2 3}} msg] $msg]
} -cleanup {
chan close $f1
-} -result {O D {1 {bad value for -eofchar: should be a list of zero, one, or two elements}}}
+} -result {O D {1 {bad value for -eofchar: must be non-NUL ASCII character}}}
test chan-io-39.23 {Tcl_GetChannelOption, server socket is not readable or\
writeable, it should still have valid -eofchar and -translation options} -setup {
set l [list]
@@ -5317,7 +5317,7 @@ test chan-io-39.23 {Tcl_GetChannelOption, server socket is not readable or\
[chan configure $sock -translation]
} -cleanup {
chan close $sock
-} -result {{{}} auto}
+} -result {{} auto}
test chan-io-39.24 {Tcl_SetChannelOption, server socket is not readable or\
writable so we can't change -eofchar or -translation} -setup {
set l [list]
@@ -5328,7 +5328,7 @@ test chan-io-39.24 {Tcl_SetChannelOption, server socket is not readable or\
[chan configure $sock -translation]
} -cleanup {
chan close $sock
-} -result {{{}} auto}
+} -result {{} auto}
test chan-io-40.1 {POSIX open access modes: RDWR} -setup {
file delete $path(test3)
diff --git a/tests/io.test b/tests/io.test
index 0db2e9a..04c9cd2 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -2093,13 +2093,13 @@ test io-20.2 {Tcl_CreateChannel: initial settings} {win} {
set x [list [fconfigure $f -eofchar] [fconfigure $f -translation]]
close $f
set x
-} {{{}} {auto crlf}}
+} {{} {auto crlf}}
test io-20.3 {Tcl_CreateChannel: initial settings} {unix} {
set f [open $path(test1) w+]
set x [list [fconfigure $f -eofchar] [fconfigure $f -translation]]
close $f
set x
-} {{{}} {auto lf}}
+} {{} {auto lf}}
set path(stdout) [makeFile {} stdout]
test io-20.5 {Tcl_CreateChannel: install channel in empty slot} stdio {
set f [open $path(script) w]
@@ -5756,7 +5756,7 @@ test io-39.21 {Tcl_SetChannelOption, setting read mode independently} \
close $s2
set modes
} {auto crlf}
-test io-39.22 {Tcl_SetChannelOption, invariance} {unix} {
+test io-39.22 {Tcl_SetChannelOption, invariance} {unix deprecated} {
file delete $path(test1)
set f1 [open $path(test1) w+]
set l ""
@@ -5767,8 +5767,8 @@ test io-39.22 {Tcl_SetChannelOption, invariance} {unix} {
lappend l [fconfigure $f1 -eofchar]
close $f1
set l
-} {{{}} O D}
-test io-39.22a {Tcl_SetChannelOption, invariance} {
+} {{} O D}
+test io-39.22a {Tcl_SetChannelOption, invariance} deprecated {
file delete $path(test1)
set f1 [open $path(test1) w+]
set l [list]
@@ -5779,7 +5779,7 @@ test io-39.22a {Tcl_SetChannelOption, invariance} {
lappend l [list [catch {fconfigure $f1 -eofchar {1 2 3}} msg] $msg]
close $f1
set l
-} {O D {1 {bad value for -eofchar: should be a list of zero, one, or two elements}}}
+} {O D {1 {bad value for -eofchar: must be non-NUL ASCII character}}}
test io-39.23 {Tcl_GetChannelOption, server socket is not readable or
writeable, it should still have valid -eofchar and -translation options } {
set l [list]
@@ -5787,7 +5787,7 @@ test io-39.23 {Tcl_GetChannelOption, server socket is not readable or
lappend l [fconfigure $sock -eofchar] [fconfigure $sock -translation]
close $sock
set l
-} {{{}} auto}
+} {{} auto}
test io-39.24 {Tcl_SetChannelOption, server socket is not readable or
writable so we can't change -eofchar or -translation } {
set l [list]
@@ -5796,7 +5796,7 @@ test io-39.24 {Tcl_SetChannelOption, server socket is not readable or
lappend l [fconfigure $sock -eofchar] [fconfigure $sock -translation]
close $sock
set l
-} {{{}} auto}
+} {{} auto}
test io-40.1 {POSIX open access modes: RDWR} {
file delete $path(test3)
diff --git a/tools/regexpTestLib.tcl b/tools/regexpTestLib.tcl
index 454a4e8..2687e67 100644
--- a/tools/regexpTestLib.tcl
+++ b/tools/regexpTestLib.tcl
@@ -183,9 +183,9 @@ proc convertTestLine {currentLine len lineNum srcLineNum} {
set noBraces 0
if {[regexp {=|>} $flags] == 1} {
regsub -all {_} $currentLine {\\ } currentLine
- regsub -all {A} $currentLine {\\007} currentLine
+ regsub -all {A} $currentLine {\\x07} currentLine
regsub -all {B} $currentLine {\\b} currentLine
- regsub -all {E} $currentLine {\\033} currentLine
+ regsub -all {E} $currentLine {\\x1B} currentLine
regsub -all {F} $currentLine {\\f} currentLine
regsub -all {N} $currentLine {\\n} currentLine