summaryrefslogtreecommitdiffstats
path: root/generic/tclUtf.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-14 16:06:23 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-14 16:06:23 (GMT)
commit46ed0441c3f458d86557c1813efb3b34c389a0e3 (patch)
tree95a9f3feedbd70636393285f7c1f111e8f000268 /generic/tclUtf.c
parent45575a4a8e2156ffca18e28394a2f5025931aa7e (diff)
downloadtcl-46ed0441c3f458d86557c1813efb3b34c389a0e3.zip
tcl-46ed0441c3f458d86557c1813efb3b34c389a0e3.tar.gz
tcl-46ed0441c3f458d86557c1813efb3b34c389a0e3.tar.bz2
More progress
Diffstat (limited to 'generic/tclUtf.c')
-rw-r--r--generic/tclUtf.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 68a0e32..02f4358 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -1850,8 +1850,8 @@ Tcl_UniCharLen(
int
TclUniCharNcmp(
- const int *ucs, /* Unicode string to compare to uct. */
- const int *uct, /* Unicode string ucs is compared to. */
+ const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */
+ const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
unsigned long numChars) /* Number of unichars to compare. */
{
#if defined(WORDS_BIGENDIAN) && (TCL_UTF_MAX > 3)
@@ -1875,6 +1875,7 @@ TclUniCharNcmp(
#endif /* WORDS_BIGENDIAN */
}
+#if TCL_UTF_MAX > 3
int
Tcl_UniCharNcmp(
const unsigned short *ucs, /* Unicode string to compare to uct. */
@@ -1907,6 +1908,7 @@ Tcl_UniCharNcmp(
return 0;
#endif /* WORDS_BIGENDIAN */
}
+#endif
/*
*----------------------------------------------------------------------
*
@@ -1926,23 +1928,17 @@ Tcl_UniCharNcmp(
*/
int
-Tcl_UniCharNcasecmp(
- const unsigned short *ucs, /* Unicode string to compare to uct. */
- const unsigned short *uct, /* Unicode string ucs is compared to. */
+TclUniCharNcasecmp(
+ const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */
+ const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
unsigned long numChars) /* Number of unichars to compare. */
{
for ( ; numChars != 0; numChars--, ucs++, uct++) {
if (*ucs != *uct) {
- unsigned short lcs = Tcl_UniCharToLower(*ucs);
- unsigned short lct = Tcl_UniCharToLower(*uct);
+ int lcs = Tcl_UniCharToLower(*ucs);
+ int lct = Tcl_UniCharToLower(*uct);
if (lcs != lct) {
- /* special case for handling upper surrogates */
- if (((lcs & 0xFC00) == 0xD800) && ((lct & 0xFC00) != 0xD800)) {
- return 1;
- } else if (((lct & 0xFC00) == 0xD800)) {
- return -1;
- }
return (lcs - lct);
}
}
@@ -1950,24 +1946,32 @@ Tcl_UniCharNcasecmp(
return 0;
}
+#if TCL_UTF_MAX > 3
int
-TclUniCharNcasecmp(
- const int *ucs, /* Unicode string to compare to uct. */
- const int *uct, /* Unicode string ucs is compared to. */
+Tcl_UniCharNcasecmp(
+ const unsigned short *ucs, /* Unicode string to compare to uct. */
+ const unsigned short *uct, /* Unicode string ucs is compared to. */
unsigned long numChars) /* Number of unichars to compare. */
{
for ( ; numChars != 0; numChars--, ucs++, uct++) {
if (*ucs != *uct) {
- int lcs = Tcl_UniCharToLower(*ucs);
- int lct = Tcl_UniCharToLower(*uct);
+ unsigned short lcs = Tcl_UniCharToLower(*ucs);
+ unsigned short lct = Tcl_UniCharToLower(*uct);
if (lcs != lct) {
+ /* special case for handling upper surrogates */
+ if (((lcs & 0xFC00) == 0xD800) && ((lct & 0xFC00) != 0xD800)) {
+ return 1;
+ } else if (((lct & 0xFC00) == 0xD800)) {
+ return -1;
+ }
return (lcs - lct);
}
}
}
return 0;
}
+#endif
/*
@@ -2333,8 +2337,8 @@ Tcl_UniCharIsWordChar(
int
TclUniCharCaseMatch(
- const int *uniStr, /* Unicode String. */
- const int *uniPattern,
+ const Tcl_UniChar *uniStr, /* Unicode String. */
+ const Tcl_UniChar *uniPattern,
/* Pattern, which may contain special
* characters. */
int nocase) /* 0 for case sensitive, 1 for insensitive */
@@ -2498,6 +2502,7 @@ TclUniCharCaseMatch(
}
}
+#if TCL_UTF_MAX > 3
int
Tcl_UniCharCaseMatch(
const unsigned short *uniStr, /* Unicode String. */
@@ -2664,6 +2669,7 @@ Tcl_UniCharCaseMatch(
uniPattern++;
}
}
+#endif
/*