From 4656afb575cda58ec7b6ce77f0a96b98173ca36d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 17 Oct 2022 19:44:08 +0000 Subject: More octal -> hex usage --- doc/Eval.3 | 6 ++-- doc/FileSystem.3 | 6 ++-- doc/Number.3 | 8 ++--- doc/source.n | 4 +-- doc/tclsh.1 | 8 ++--- generic/regc_lex.c | 4 +-- generic/regc_locale.c | 86 +++++++++++++++++++++++++-------------------------- generic/tclObj.c | 6 ++-- library/auto.tcl | 4 +-- library/init.tcl | 2 +- library/safe.tcl | 2 +- tools/genStubs.tcl | 2 +- 12 files changed, 64 insertions(+), 74 deletions(-) diff --git a/doc/Eval.3 b/doc/Eval.3 index 3ae0bce..02a8da5 100644 --- a/doc/Eval.3 +++ b/doc/Eval.3 @@ -99,13 +99,11 @@ its contents as a Tcl script. It returns the same information as If the file could not be read then a Tcl error is returned to describe why the file could not be read. The eofchar for files is -.QW \e32 +.QW \ex1A (^Z) for all platforms. If you require a .QW ^Z in code for string comparison, you can use -.QW \e032 -or -.QW \eu001a , +.QW \ex1A , which will be safely substituted by the Tcl interpreter into .QW ^Z . .PP diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 index 4951ec5..e7cc4ab 100644 --- a/doc/FileSystem.3 +++ b/doc/FileSystem.3 @@ -425,14 +425,12 @@ reading the file contents. If the file could not be read then a Tcl error is returned to describe why the file could not be read. The eofchar for files is -.QW \e32 +.QW \ex1A (^Z) for all platforms. If you require a .QW ^Z in code for string comparison, you can use -.QW \e032 -or -.QW \eu001a , +.QW \ex1A , which will be safely substituted by the Tcl interpreter into .QW ^Z . \fBTcl_FSEvalFile\fR is a simpler version of diff --git a/doc/Number.3 b/doc/Number.3 index f93d75d..f405060 100644 --- a/doc/Number.3 +++ b/doc/Number.3 @@ -50,7 +50,7 @@ Tcl recognizes many values as numbers. Several examples include: \fB"1_000_000"\fR, \fB"4.0"\fR, \fB"1e-7"\fR, \fB"NaN"\fR, or \fB"Inf"\fR. When built-in Tcl commands act on these values as numbers, they are converted to a numeric representation for efficient handling in C code. Tcl makes -use of three C types to store these representations: \fBdouble\fR, +use of three C types to store these representations: \fBdouble\fR, \fBTcl_WideInt\fR, and \fBmp_int\fR. The \fBdouble\fR type is provided by the C language standard. The \fBTcl_WideInt\fR type is declared in the Tcl header file, \fBtcl.h\fR, and is equivalent to the C standard type @@ -76,7 +76,7 @@ If Tcl does recognize the examined value as a number, both routines return and \fItypePtr\fR (which may not be NULL) to report information the caller can use to retrieve the numeric representation. Both routines write to *\fIclientDataPtr\fR a pointer to the internal storage location -where Tcl holds the converted numeric value. +where Tcl holds the converted numeric value. .PP When the converted numeric value is stored as a \fBdouble\fR, a call to math library routine \fBisnan\fR determines whether that @@ -91,13 +91,13 @@ the \fBdouble\fR numeric value may be read through it. .PP When the converted numeric value is stored as a \fBTcl_WideInt\fR, both \fBTcl_GetNumber\fR and \fBTcl_GetNumberFromObj\fR write the -value \fBTCL_NUMBER_INT\fR to *\fItypePtr\fR. +value \fBTCL_NUMBER_INT\fR to *\fItypePtr\fR. The storage pointer may be cast to type \fBconst Tcl_WideInt *\fR and the \fBTcl_WideInt\fR numeric value may be read through it. .PP When the converted numeric value is stored as an \fBmp_int\fR, both \fBTcl_GetNumber\fR and \fBTcl_GetNumberFromObj\fR write the -value \fBTCL_NUMBER_BIG\fR to *\fItypePtr\fR. +value \fBTCL_NUMBER_BIG\fR to *\fItypePtr\fR. The storage pointer may be cast to type \fBconst mp_int *\fR and the \fBmp_int\fR numeric value may be read through it. .PP diff --git a/doc/source.n b/doc/source.n index 8757cb8..cee1312 100644 --- a/doc/source.n +++ b/doc/source.n @@ -37,9 +37,7 @@ allowing for files containing code and data segments (scripted documents). If you require a .QW ^Z in code for string comparison, you can use -.QW \e032 -or -.QW \eu001a , +.QW \ex1A , which will be safely substituted by the Tcl interpreter into .QW ^Z . .PP diff --git a/doc/tclsh.1 b/doc/tclsh.1 index 8dbacc0..3a78737 100644 --- a/doc/tclsh.1 +++ b/doc/tclsh.1 @@ -38,15 +38,11 @@ read Tcl commands from the named file; \fBtclsh\fR will exit when it reaches the end of the file. The end of the file may be marked either by the physical end of the medium, or by the character, -.QW \e032 -.PQ \eu001a ", control-Z" . +.PQ \ex1A ", control-Z" . If this character is present in the file, the \fBtclsh\fR application will read text up to but not including the character. An application that requires this character in the file may safely encode it as -.QW \e032 , -.QW \ex1A , -or -.QW \eu001a ; +.QW \ex1A ; or may generate it by use of commands such as \fBformat\fR or \fBbinary\fR. There is no automatic evaluation of \fB.tclshrc\fR when the name of a script file is presented on the \fBtclsh\fR command diff --git a/generic/regc_lex.c b/generic/regc_lex.c index bad91ce..eb068b4 100644 --- a/generic/regc_lex.c +++ b/generic/regc_lex.c @@ -775,7 +775,7 @@ lexescape( NOTE(REG_UNONPOSIX); switch (c) { case CHR('a'): - RETV(PLAIN, chrnamed(v, alert, ENDOF(alert), CHR('\007'))); + RETV(PLAIN, chrnamed(v, alert, ENDOF(alert), CHR('\x07'))); break; case CHR('A'): RETV(SBEGIN, 0); @@ -803,7 +803,7 @@ lexescape( break; case CHR('e'): NOTE(REG_UUNPORT); - RETV(PLAIN, chrnamed(v, esc, ENDOF(esc), CHR('\033'))); + RETV(PLAIN, chrnamed(v, esc, ENDOF(esc), CHR('\x1B'))); break; case CHR('f'): RETV(PLAIN, CHR('\f')); diff --git a/generic/regc_locale.c b/generic/regc_locale.c index e74b147..1ac04ef 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -16,49 +16,49 @@ static const struct cname { const char *name; const char code; } cnames[] = { - {"NUL", '\0'}, - {"SOH", '\001'}, - {"STX", '\002'}, - {"ETX", '\003'}, - {"EOT", '\004'}, - {"ENQ", '\005'}, - {"ACK", '\006'}, - {"BEL", '\007'}, - {"alert", '\007'}, - {"BS", '\010'}, - {"backspace", '\b'}, - {"HT", '\011'}, - {"tab", '\t'}, - {"LF", '\012'}, - {"newline", '\n'}, - {"VT", '\013'}, - {"vertical-tab", '\v'}, - {"FF", '\014'}, - {"form-feed", '\f'}, - {"CR", '\015'}, - {"carriage-return", '\r'}, - {"SO", '\016'}, - {"SI", '\017'}, - {"DLE", '\020'}, - {"DC1", '\021'}, - {"DC2", '\022'}, - {"DC3", '\023'}, - {"DC4", '\024'}, - {"NAK", '\025'}, - {"SYN", '\026'}, - {"ETB", '\027'}, - {"CAN", '\030'}, - {"EM", '\031'}, - {"SUB", '\032'}, - {"ESC", '\033'}, - {"IS4", '\034'}, - {"FS", '\034'}, - {"IS3", '\035'}, - {"GS", '\035'}, - {"IS2", '\036'}, - {"RS", '\036'}, - {"IS1", '\037'}, - {"US", '\037'}, + {"NUL", '\x00'}, + {"SOH", '\x01'}, + {"STX", '\x02'}, + {"ETX", '\x03'}, + {"EOT", '\x04'}, + {"ENQ", '\x05'}, + {"ACK", '\x06'}, + {"BEL", '\x07'}, + {"alert", '\x07'}, + {"BS", '\x08'}, + {"backspace", '\x08'}, + {"HT", '\x09'}, + {"tab", '\x09'}, + {"LF", '\x0A'}, + {"newline", '\x0A'}, + {"VT", '\x0B'}, + {"vertical-tab", '\x0B'}, + {"FF", '\x0C'}, + {"form-feed", '\x0C'}, + {"CR", '\x0D'}, + {"carriage-return", '\x0D'}, + {"SO", '\x0E'}, + {"SI", '\x0F'}, + {"DLE", '\x10'}, + {"DC1", '\x11'}, + {"DC2", '\x12'}, + {"DC3", '\x13'}, + {"DC4", '\x14'}, + {"NAK", '\x15'}, + {"SYN", '\x16'}, + {"ETB", '\x17'}, + {"CAN", '\x18'}, + {"EM", '\x19'}, + {"SUB", '\x1A'}, + {"ESC", '\x1B'}, + {"IS4", '\x1C'}, + {"FS", '\x1C'}, + {"IS3", '\x1D'}, + {"GS", '\x1D'}, + {"IS2", '\x1E'}, + {"RS", '\x1E'}, + {"IS1", '\x1F'}, + {"US", '\x1F'}, {"space", ' '}, {"exclamation-mark",'!'}, {"quotation-mark", '"'}, diff --git a/generic/tclObj.c b/generic/tclObj.c index 8970ab0..4a660b2 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -785,7 +785,7 @@ TclContinuationsGet( static void TclThreadFinalizeContLines( - TCL_UNUSED(ClientData)) + TCL_UNUSED(void *)) { /* * Release the hashtable tracking invisible continuation lines. @@ -3956,7 +3956,7 @@ Tcl_GetNumber( Tcl_Interp *interp, const char *bytes, size_t numBytes, - ClientData *clientDataPtr, + void **clientDataPtr, int *typePtr) { static Tcl_ThreadDataKey numberCacheKey; @@ -4851,7 +4851,7 @@ SetCmdNameFromAny( int Tcl_RepresentationCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) diff --git a/library/auto.tcl b/library/auto.tcl index dc37328..3b1bb05 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -302,7 +302,7 @@ proc auto_mkindex_old {dir args} { set f "" set error [catch { set f [open $file] - fconfigure $f -encoding utf-8 -eofchar "\032 {}" + fconfigure $f -encoding utf-8 -eofchar "\x1A {}" while {[gets $f line] >= 0} { if {[regexp {^proc[ ]+([^ ]*)} $line match procName]} { set procName [lindex [auto_qualify $procName "::"] 0] @@ -414,7 +414,7 @@ proc auto_mkindex_parser::mkindex {file} { set scriptFile $file set fid [open $file] - fconfigure $fid -encoding utf-8 -eofchar "\032 {}" + fconfigure $fid -encoding utf-8 -eofchar "\x1A {}" set contents [read $fid] close $fid diff --git a/library/init.tcl b/library/init.tcl index a879fe5..bbff158 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -442,7 +442,7 @@ proc auto_load_index {} { continue } else { set error [catch { - fconfigure $f -encoding utf-8 -eofchar "\032 {}" + fconfigure $f -encoding utf-8 -eofchar "\x1A {}" set id [gets $f] if {$id eq "# Tcl autoload index file, version 2.0"} { eval [read $f] diff --git a/library/safe.tcl b/library/safe.tcl index 2e04f8e..9050880 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -980,7 +980,7 @@ proc ::safe::AliasSource {child args} { set replacementMsg "script error" set code [catch { set f [open $realfile] - fconfigure $f -encoding $encoding -eofchar "\032 {}" + fconfigure $f -encoding $encoding -eofchar "\x1A {}" set contents [read $f] close $f ::interp eval $child [list info script $file] diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 282abcc..89e4ccc 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -257,7 +257,7 @@ proc genStubs::rewriteFile {file text} { return } set in [open ${file} r] - fconfigure $in -eofchar "\032 {}" -encoding utf-8 + fconfigure $in -eofchar "\x1A {}" -encoding utf-8 set out [open ${file}.new w] fconfigure $out -translation lf -encoding utf-8 -- cgit v0.12