Skip to content

Commit

Permalink
Merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Feb 11, 2024
2 parents cb0dbff + f24b479 commit 1b9073e
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 89 deletions.
17 changes: 4 additions & 13 deletions doc/UniCharIsAlpha.3
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
Tcl_UniCharIsAlnum, Tcl_UniCharIsAlpha, Tcl_UniCharIsControl, Tcl_UniCharIsDigit, Tcl_UniCharIsGraph, Tcl_UniCharIsLower, Tcl_UniCharIsPrint, Tcl_UniCharIsPunct, Tcl_UniCharIsSpace, Tcl_UniCharIsUpper, Tcl_UniCharIsUnicode, Tcl_UniCharIsWordChar \- routines for classification of Tcl_UniChar characters
Tcl_UniCharIsAlnum, Tcl_UniCharIsAlpha, Tcl_UniCharIsControl, Tcl_UniCharIsDigit, Tcl_UniCharIsGraph, Tcl_UniCharIsLower, Tcl_UniCharIsPrint, Tcl_UniCharIsPunct, Tcl_UniCharIsSpace, Tcl_UniCharIsUpper, Tcl_UniCharIsWordChar \- routines for classification of Tcl_UniChar characters
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
Expand Down Expand Up @@ -44,9 +44,6 @@ int
\fBTcl_UniCharIsUpper\fR(\fIch\fR)
.sp
int
\fBTcl_UniCharIsUnicode\fR(\fIch\fR)
.sp
int
\fBTcl_UniCharIsWordChar\fR(\fIch\fR)
.fi
.SH ARGUMENTS
Expand Down Expand Up @@ -82,17 +79,11 @@ except space.
.PP
\fBTcl_UniCharIsPrint\fR tests if the character is a Unicode print character.
.PP
\fBTcl_UniCharIsPunct\fR tests if the character is a Unicode punctuation
character.
.PP
\fBTcl_UniCharIsSpace\fR tests if the character is a whitespace Unicode
character.
\fBTcl_UniCharIsPunct\fR tests if the character is a Unicode punctuation character.
.PP
\fBTcl_UniCharIsUpper\fR tests if the character is an uppercase Unicode
character.
\fBTcl_UniCharIsSpace\fR tests if the character is a whitespace Unicode character.
.PP
\fBTcl_UniCharIsUnicode\fR tests if the character is a Unicode character,
not being a surrogate or noncharacter.
\fBTcl_UniCharIsUpper\fR tests if the character is an uppercase Unicode character.
.PP
\fBTcl_UniCharIsWordChar\fR tests if the character is alphanumeric or
a connector punctuation mark.
Expand Down
7 changes: 0 additions & 7 deletions doc/string.n
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,6 @@ zero width no-break space (U+feff) (=BOM).
.IP \fBtrue\fR 12
Any of the forms allowed to \fBTcl_GetBoolean\fR where the value is
true.
.IP \fBunicode\fR 12
Any Unicode character, except surrogates and noncharacters.
.RS
.PP
\fIWarning: this option is under discussion and may be renamed or replaced
by another solution within the Tcl 9.0 series.\fR
.RE
.IP \fBupper\fR 12
Any upper case alphabet character in the Unicode character set.
.IP \fBwideinteger\fR 12
Expand Down
8 changes: 5 additions & 3 deletions generic/tcl.decls
Original file line number Diff line number Diff line change
Expand Up @@ -2499,9 +2499,11 @@ declare 655 {
declare 656 {
const char *Tcl_UtfPrev(const char *src, const char *start)
}
declare 657 {
int Tcl_UniCharIsUnicode(int ch)
}
# Removed by TIP #652
#
#declare 657 {
# int Tcl_UniCharIsUnicode(int ch)
#}
# TIP 656
declare 658 {
Expand Down
7 changes: 2 additions & 5 deletions generic/tclCmdMZ.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,15 +1534,15 @@ StringIsCmd(
"boolean", "dict", "digit", "double",
"entier", "false", "graph", "integer",
"list", "lower", "print", "punct",
"space", "true", "upper", "unicode",
"space", "true", "upper",
"wideinteger", "wordchar", "xdigit", NULL
};
enum isClassesEnum {
STR_IS_ALNUM, STR_IS_ALPHA, STR_IS_ASCII, STR_IS_CONTROL,
STR_IS_BOOL, STR_IS_DICT, STR_IS_DIGIT, STR_IS_DOUBLE,
STR_IS_ENTIER, STR_IS_FALSE, STR_IS_GRAPH, STR_IS_INT,
STR_IS_LIST, STR_IS_LOWER, STR_IS_PRINT, STR_IS_PUNCT,
STR_IS_SPACE, STR_IS_TRUE, STR_IS_UPPER, STR_IS_UNICODE,
STR_IS_SPACE, STR_IS_TRUE, STR_IS_UPPER,
STR_IS_WIDE, STR_IS_WORD, STR_IS_XDIGIT
} index;
static const char *const isOptions[] = {
Expand Down Expand Up @@ -1871,9 +1871,6 @@ StringIsCmd(
case STR_IS_UPPER:
chcomp = Tcl_UniCharIsUpper;
break;
case STR_IS_UNICODE:
chcomp = Tcl_UniCharIsUnicode;
break;
case STR_IS_WORD:
chcomp = Tcl_UniCharIsWordChar;
break;
Expand Down
8 changes: 2 additions & 6 deletions generic/tclCompCmdsSZ.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,15 @@ TclCompileStringIsCmd(
"boolean", "dict", "digit", "double",
"entier", "false", "graph", "integer",
"list", "lower", "print", "punct",
"space", "true", "upper", "unicode",
"space", "true", "upper",
"wideinteger", "wordchar", "xdigit", NULL
};
enum isClassesEnum {
STR_IS_ALNUM, STR_IS_ALPHA, STR_IS_ASCII, STR_IS_CONTROL,
STR_IS_BOOL, STR_IS_DICT, STR_IS_DIGIT, STR_IS_DOUBLE,
STR_IS_ENTIER, STR_IS_FALSE, STR_IS_GRAPH, STR_IS_INT,
STR_IS_LIST, STR_IS_LOWER, STR_IS_PRINT, STR_IS_PUNCT,
STR_IS_SPACE, STR_IS_TRUE, STR_IS_UPPER, STR_IS_UNICODE,
STR_IS_SPACE, STR_IS_TRUE, STR_IS_UPPER,
STR_IS_WIDE, STR_IS_WORD, STR_IS_XDIGIT
} t;
int range, allowEmpty = 0, end;
Expand Down Expand Up @@ -609,9 +609,6 @@ TclCompileStringIsCmd(
case STR_IS_UPPER:
strClassType = STR_CLASS_UPPER;
goto compileStrClass;
case STR_IS_UNICODE:
strClassType = STR_CLASS_UNICODE;
goto compileStrClass;
case STR_IS_WORD:
strClassType = STR_CLASS_WORD;
goto compileStrClass;
Expand Down Expand Up @@ -1423,7 +1420,6 @@ StringClassDesc const tclStringClassTable[] = {
{"upper", Tcl_UniCharIsUpper},
{"word", Tcl_UniCharIsWordChar},
{"xdigit", UniCharIsHexDigit},
{"unicode", Tcl_UniCharIsUnicode},
{"", NULL}
};

Expand Down
1 change: 0 additions & 1 deletion generic/tclCompile.h
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,6 @@ typedef enum InstStringClassType {
* punctuation) characters. */
STR_CLASS_XDIGIT, /* Characters that can be used as digits in
* hexadecimal numbers ([0-9A-Fa-f]). */
STR_CLASS_UNICODE /* Unicode characters. */
} InstStringClassType;

typedef struct StringClassDesc {
Expand Down
2 changes: 1 addition & 1 deletion generic/tclStubInit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ const TclStubs tclStubs = {
Tcl_UtfCharComplete, /* 654 */
Tcl_UtfNext, /* 655 */
Tcl_UtfPrev, /* 656 */
Tcl_UniCharIsUnicode, /* 657 */
0, /* 657 */
Tcl_ExternalToUtfDStringEx, /* 658 */
Tcl_UtfToExternalDStringEx, /* 659 */
Tcl_AsyncMarkFromSignal, /* 660 */
Expand Down
30 changes: 0 additions & 30 deletions generic/tclUtf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2280,36 +2280,6 @@ Tcl_UniCharIsUpper(
return (GetCategory(ch) == UPPERCASE_LETTER);
}

/*
*----------------------------------------------------------------------
*
* Tcl_UniCharIsUnicode --
*
* Test if a character is a Unicode character.
*
* Results:
* Returns non-zero if character belongs to the Unicode set.
*
* Excluded are:
* 1) All characters > U+10FFFF
* 2) Surrogates U+D800 - U+DFFF
* 3) Last 2 characters of each plane, so U+??FFFE and U+??FFFF
* 4) The characters in the range U+FDD0 - U+FDEF
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/

int
Tcl_UniCharIsUnicode(
int ch) /* Unicode character to test. */
{
return ((unsigned int)ch <= 0x10FFFF) && ((ch & 0xFFF800) != 0xD800)
&& ((ch & 0xFFFE) != 0xFFFE) && ((unsigned int)(ch - 0xFDD0) >= 32);
}

/*
*----------------------------------------------------------------------
*
Expand Down
25 changes: 2 additions & 23 deletions tests/string.test
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,10 @@ test string-6.4.$noComp {string is, too many args} {
} {1 {wrong # args: should be "string is class ?-strict? ?-failindex var? str"}}
test string-6.5.$noComp {string is, class check} {
list [catch {run {string is bogus str}} msg] $msg
} {1 {bad class "bogus": must be alnum, alpha, ascii, control, boolean, dict, digit, double, entier, false, graph, integer, list, lower, print, punct, space, true, upper, unicode, wideinteger, wordchar, or xdigit}}
} {1 {bad class "bogus": must be alnum, alpha, ascii, control, boolean, dict, digit, double, entier, false, graph, integer, list, lower, print, punct, space, true, upper, wideinteger, wordchar, or xdigit}}
test string-6.6.$noComp {string is, ambiguous class} {
list [catch {run {string is al str}} msg] $msg
} {1 {ambiguous class "al": must be alnum, alpha, ascii, control, boolean, dict, digit, double, entier, false, graph, integer, list, lower, print, punct, space, true, upper, unicode, wideinteger, wordchar, or xdigit}}
} {1 {ambiguous class "al": must be alnum, alpha, ascii, control, boolean, dict, digit, double, entier, false, graph, integer, list, lower, print, punct, space, true, upper, wideinteger, wordchar, or xdigit}}
test string-6.7.$noComp {string is alpha, all ok} {
run {string is alpha -strict -failindex var abc}
} 1
Expand Down Expand Up @@ -973,27 +973,6 @@ test string-6.130.1.$noComp {string is entier, false on bad octal} {
test string-6.131.$noComp {string is entier, false on bad hex} {
list [run {string is entier -fail var 0X12345611234123456123456562345612345612345612345612345612345612345612345612345612345345XYZ}] $var
} {0 88}
test string-6.132.$noComp {string is unicode} {
run {string is unicode \U10FFFD\uD7FF\uE000\uFDCF\uFDF0}
} 1
test string-6.133.$noComp {string is unicode, upper surrogate} {
run {string is unicode \uD800}
} 0
test string-6.134.$noComp {string is unicode, lower surrogate} {
run {string is unicode \uDFFF}
} 0
test string-6.135.$noComp {string is unicode, noncharacter} {
run {string is unicode \uFFFE}
} 0
test string-6.136.$noComp {string is unicode, noncharacter} {
run {string is unicode \uFFFF}
} 0
test string-6.137.$noComp {string is unicode, noncharacter} {
run {string is unicode \uFDD0}
} 0
test string-6.138.$noComp {string is unicode, noncharacter} {
run {string is unicode \uFDEF}
} 0
test string-6.139.$noComp {string is integer, bug [76ad7aeba3]} {
run {string is integer 18446744073709551615}
} 1
Expand Down

0 comments on commit 1b9073e

Please sign in to comment.