Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge 8.7 Add function Tcl_UniCharFold(). It's the same as Tcl_UniCharToLower() for now, but that will change. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | tip-575 |
Files: | files | file ages | folders |
SHA3-256: |
c338858460ea36616170a5e1470d0345 |
User & Date: | jan.nijtmans 2020-05-22 14:36:34.324 |
Context
2020-05-22
| ||
15:27 | New "string" subcommands: "nextchar", "nextword", "prevchar", "prevword". Not implemented yet (for n... check-in: 04d41e57ba user: jan.nijtmans tags: tip-575 | |
14:36 | Merge 8.7 Add function Tcl_UniCharFold(). It's the same as Tcl_UniCharToLower() for now, but that wi... check-in: c338858460 user: jan.nijtmans tags: tip-575 | |
2020-05-20
| ||
19:09 | Adapt some comments, which are not correct for Tcl 8.7 any more check-in: 1203d7b979 user: jan.nijtmans tags: core-8-branch | |
2020-05-18
| ||
10:51 | Merge 8.7. Update documentation check-in: 566357910d user: jan.nijtmans tags: tip-575 | |
Changes
Changes to doc/ToUpper.3.
1 2 3 4 5 6 7 8 9 10 | '\" '\" Copyright (c) 1997 by Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tcl_UtfToUpper 3 "8.1" Tcl "Tcl Library Procedures" .so man.macros .BS .SH NAME | | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | '\" '\" Copyright (c) 1997 by Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tcl_UtfToUpper 3 "8.1" Tcl "Tcl Library Procedures" .so man.macros .BS .SH NAME Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharFold, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_UtfToLower, Tcl_UtfToTitle \- routines for manipulating the case of Unicode characters and UTF-8 strings .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp int \fBTcl_UniCharToUpper\fR(\fIch\fR) .sp int \fBTcl_UniCharFold\fR(\fIch\fR) .sp int \fBTcl_UniCharToLower\fR(\fIch\fR) .sp int \fBTcl_UniCharToTitle\fR(\fIch\fR) .sp int |
︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | character. If no upper-case character is defined, it returns the character unchanged. .PP If \fIch\fR represents an upper-case character, \fBTcl_UniCharToLower\fR returns the corresponding lower-case character. If no lower-case character is defined, it returns the character unchanged. .PP If \fIch\fR represents a lower-case character, \fBTcl_UniCharToTitle\fR returns the corresponding title-case character. If no title-case character is defined, it returns the corresponding upper-case character. If no upper-case character is defined, it returns the character unchanged. Title-case is defined for a small number of characters that have a different appearance when | > > > > > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | character. If no upper-case character is defined, it returns the character unchanged. .PP If \fIch\fR represents an upper-case character, \fBTcl_UniCharToLower\fR returns the corresponding lower-case character. If no lower-case character is defined, it returns the character unchanged. .PP If \fIch\fR represents an upper-case or lower-case character, \fBTcl_UniCharFold\fR returns the corresponding folded character. If no upper-case or lower-case character is defined, it returns the character unchanged. .PP If \fIch\fR represents a lower-case character, \fBTcl_UniCharToTitle\fR returns the corresponding title-case character. If no title-case character is defined, it returns the corresponding upper-case character. If no upper-case character is defined, it returns the character unchanged. Title-case is defined for a small number of characters that have a different appearance when |
︙ | ︙ |
Changes to generic/regc_locale.c.
︙ | ︙ | |||
1265 1266 1267 1268 1269 1270 1271 | */ static int /* 0 for equal, nonzero for unequal */ casecmp( const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { for (; len > 0; len--, x++, y++) { | | | 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | */ static int /* 0 for equal, nonzero for unequal */ casecmp( const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { for (; len > 0; len--, x++, y++) { if ((*x!=*y) && (Tcl_UniCharFold(*x) != Tcl_UniCharFold(*y))) { return 1; } } return 0; } /* |
︙ | ︙ |
Changes to generic/tcl.decls.
︙ | ︙ | |||
2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 | } declare 650 { const char *Tcl_UtfNext(const char *src) } declare 651 { const char *Tcl_UtfPrev(const char *src, const char *start) } # ----- BASELINE -- FOR -- 8.7.0 ----- # ############################################################################## # Define the platform specific public Tcl interface. These functions are only # available on the designated platform. | > > > | 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 | } declare 650 { const char *Tcl_UtfNext(const char *src) } declare 651 { const char *Tcl_UtfPrev(const char *src, const char *start) } declare 652 { int Tcl_UniCharFold(int ch) } # ----- BASELINE -- FOR -- 8.7.0 ----- # ############################################################################## # Define the platform specific public Tcl interface. These functions are only # available on the designated platform. |
︙ | ︙ |
Changes to generic/tcl.h.
︙ | ︙ | |||
2110 2111 2112 2113 2114 2115 2116 | #define TCL_CONVERT_UNKNOWN (-3) #define TCL_CONVERT_NOSPACE (-4) /* * The maximum number of bytes that are necessary to represent a single * Unicode character in UTF-8. The valid values are 3 and 4 * (or perhaps 1 if we want to support a non-unicode enabled core). If 3, | | | | 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 | #define TCL_CONVERT_UNKNOWN (-3) #define TCL_CONVERT_NOSPACE (-4) /* * The maximum number of bytes that are necessary to represent a single * Unicode character in UTF-8. The valid values are 3 and 4 * (or perhaps 1 if we want to support a non-unicode enabled core). If 3, * then Tcl_UniChar must be 2-bytes in size (UTF-16) (the default). If > 3, * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UTF-16 mode * is the default and recommended mode. */ #ifndef TCL_UTF_MAX #define TCL_UTF_MAX 3 #endif |
︙ | ︙ |
Changes to generic/tclCmdIL.c.
︙ | ︙ | |||
4772 4773 4774 4775 4776 4777 4778 | /* * Convert both chars to lower for the comparison, because * dictionary sorts are case insensitve. Covert to lower, not * upper, so chars between Z and a will sort before A (where most * other interesting punctuations occur). */ | | | | 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 | /* * Convert both chars to lower for the comparison, because * dictionary sorts are case insensitve. Covert to lower, not * upper, so chars between Z and a will sort before A (where most * other interesting punctuations occur). */ uniLeftLower = Tcl_UniCharFold(uniLeft); uniRightLower = Tcl_UniCharFold(uniRight); } else { diff = UCHAR(*left) - UCHAR(*right); break; } diff = uniLeftLower - uniRightLower; if (diff) { |
︙ | ︙ |
Changes to generic/tclCmdMZ.c.
︙ | ︙ | |||
625 626 627 628 629 630 631 | Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); Tcl_AppendUnicodeToObj(resultPtr, wstring, 1); numMatches++; } wlen = 0; } } else { | | | | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); Tcl_AppendUnicodeToObj(resultPtr, wstring, 1); numMatches++; } wlen = 0; } } else { wsrclc = Tcl_UniCharFold(*wsrc); for (p = wfirstChar = wstring; wstring < wend; wstring++) { if ((*wstring == *wsrc || (nocase && Tcl_UniCharFold(*wstring)==wsrclc)) && (slen==1 || (strCmpFn(wstring, wsrc, (unsigned long) slen) == 0))) { if (numMatches == 0) { resultPtr = Tcl_NewUnicodeObj(wstring, 0); Tcl_IncrRefCount(resultPtr); } if (p != wstring) { |
︙ | ︙ | |||
2091 2092 2093 2094 2095 2096 2097 | /* * Match string is either longer than input or empty. */ ustring1 = end; } else { mapString = Tcl_GetUnicodeFromObj(mapElemv[1], &mapLen); | | | | 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 | /* * Match string is either longer than input or empty. */ ustring1 = end; } else { mapString = Tcl_GetUnicodeFromObj(mapElemv[1], &mapLen); u2lc = (nocase ? Tcl_UniCharFold(*ustring2) : 0); for (; ustring1 < end; ustring1++) { if (((*ustring1 == *ustring2) || (nocase&&Tcl_UniCharFold(*ustring1)==u2lc)) && (length2==1 || strCmpFn(ustring1, ustring2, (unsigned long) length2) == 0)) { if (p != ustring1) { Tcl_AppendUnicodeToObj(resultPtr, p, ustring1-p); p = ustring1 + length2; } else { p += length2; |
︙ | ︙ | |||
2129 2130 2131 2132 2133 2134 2135 | if (nocase) { u2lc = (int *)TclStackAlloc(interp, mapElemc * sizeof(int)); } for (index = 0; index < mapElemc; index++) { mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index], mapLens+index); if (nocase && ((index % 2) == 0)) { | | | | 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 | if (nocase) { u2lc = (int *)TclStackAlloc(interp, mapElemc * sizeof(int)); } for (index = 0; index < mapElemc; index++) { mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index], mapLens+index); if (nocase && ((index % 2) == 0)) { u2lc[index/2] = Tcl_UniCharFold(*mapStrings[index]); } } for (p = ustring1; ustring1 < end; ustring1++) { for (index = 0; index < mapElemc; index += 2) { /* * Get the key string to match on. */ ustring2 = mapStrings[index]; length2 = mapLens[index]; if ((length2 > 0) && ((*ustring1 == *ustring2) || (nocase && (Tcl_UniCharFold(*ustring1) == u2lc[index/2]))) && /* Restrict max compare length. */ (end-ustring1 >= length2) && ((length2 == 1) || !strCmpFn(ustring2, ustring1, length2))) { if (p != ustring1) { /* * Put the skipped chars onto the result first. */ |
︙ | ︙ |
Changes to generic/tclDecls.h.
︙ | ︙ | |||
1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 | Tcl_DString *dsPtr); /* 649 */ EXTERN int Tcl_UtfCharComplete(const char *src, int length); /* 650 */ EXTERN const char * Tcl_UtfNext(const char *src); /* 651 */ EXTERN const char * Tcl_UtfPrev(const char *src, const char *start); typedef struct { const struct TclPlatStubs *tclPlatStubs; const struct TclIntStubs *tclIntStubs; const struct TclIntPlatStubs *tclIntPlatStubs; } TclStubHooks; | > > | 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 | Tcl_DString *dsPtr); /* 649 */ EXTERN int Tcl_UtfCharComplete(const char *src, int length); /* 650 */ EXTERN const char * Tcl_UtfNext(const char *src); /* 651 */ EXTERN const char * Tcl_UtfPrev(const char *src, const char *start); /* 652 */ EXTERN int Tcl_UniCharFold(int ch); typedef struct { const struct TclPlatStubs *tclPlatStubs; const struct TclIntStubs *tclIntStubs; const struct TclIntPlatStubs *tclIntPlatStubs; } TclStubHooks; |
︙ | ︙ | |||
2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 | int (*tcl_GetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 645 */ int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */ char * (*tcl_UniCharToUtfDString) (const int *uniStr, int uniLength, Tcl_DString *dsPtr); /* 647 */ int * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 648 */ int (*tcl_UtfCharComplete) (const char *src, int length); /* 649 */ const char * (*tcl_UtfNext) (const char *src); /* 650 */ const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 651 */ } TclStubs; extern const TclStubs *tclStubsPtr; #ifdef __cplusplus } #endif | > | 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 | int (*tcl_GetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 645 */ int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */ char * (*tcl_UniCharToUtfDString) (const int *uniStr, int uniLength, Tcl_DString *dsPtr); /* 647 */ int * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 648 */ int (*tcl_UtfCharComplete) (const char *src, int length); /* 649 */ const char * (*tcl_UtfNext) (const char *src); /* 650 */ const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 651 */ int (*tcl_UniCharFold) (int ch); /* 652 */ } TclStubs; extern const TclStubs *tclStubsPtr; #ifdef __cplusplus } #endif |
︙ | ︙ | |||
3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 | (tclStubsPtr->tcl_UtfToUniCharDString) /* 648 */ #define Tcl_UtfCharComplete \ (tclStubsPtr->tcl_UtfCharComplete) /* 649 */ #define Tcl_UtfNext \ (tclStubsPtr->tcl_UtfNext) /* 650 */ #define Tcl_UtfPrev \ (tclStubsPtr->tcl_UtfPrev) /* 651 */ #endif /* defined(USE_TCL_STUBS) */ /* !END!: Do not edit above this line. */ #if defined(USE_TCL_STUBS) # undef Tcl_CreateInterp | > > | 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 | (tclStubsPtr->tcl_UtfToUniCharDString) /* 648 */ #define Tcl_UtfCharComplete \ (tclStubsPtr->tcl_UtfCharComplete) /* 649 */ #define Tcl_UtfNext \ (tclStubsPtr->tcl_UtfNext) /* 650 */ #define Tcl_UtfPrev \ (tclStubsPtr->tcl_UtfPrev) /* 651 */ #define Tcl_UniCharFold \ (tclStubsPtr->tcl_UniCharFold) /* 652 */ #endif /* defined(USE_TCL_STUBS) */ /* !END!: Do not edit above this line. */ #if defined(USE_TCL_STUBS) # undef Tcl_CreateInterp |
︙ | ︙ |
Changes to generic/tclStubInit.c.
︙ | ︙ | |||
1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 | Tcl_GetIntForIndex, /* 645 */ Tcl_UtfToUniChar, /* 646 */ Tcl_UniCharToUtfDString, /* 647 */ Tcl_UtfToUniCharDString, /* 648 */ Tcl_UtfCharComplete, /* 649 */ Tcl_UtfNext, /* 650 */ Tcl_UtfPrev, /* 651 */ }; /* !END!: Do not edit above this line. */ | > | 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 | Tcl_GetIntForIndex, /* 645 */ Tcl_UtfToUniChar, /* 646 */ Tcl_UniCharToUtfDString, /* 647 */ Tcl_UtfToUniCharDString, /* 648 */ Tcl_UtfCharComplete, /* 649 */ Tcl_UtfNext, /* 650 */ Tcl_UtfPrev, /* 651 */ Tcl_UniCharFold, /* 652 */ }; /* !END!: Do not edit above this line. */ |
Changes to generic/tclTest.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif #ifndef TCL_NO_DEPRECATED # define TCL_NO_DEPRECATED #endif #include "tclInt.h" | > > > | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif #ifndef TCL_NO_DEPRECATED # define TCL_NO_DEPRECATED #endif #include "tclInt.h" #ifdef TCL_WITH_EXTERNAL_TOMMATH # include "tommath.h" #else # include "tclTomMath.h" #endif #include "tclOO.h" #include <math.h> /* * Required for Testregexp*Cmd */ #include "tclRegexp.h" |
︙ | ︙ | |||
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | "-appinitprocerror", "-appinitprocdeleteinterp", "-appinitprocclosestderr", "-appinitprocsetrcfile", NULL }; if (Tcl_InitStubs(interp, "8.5-", 0) == NULL) { return TCL_ERROR; } if (Tcl_TomMath_InitStubs(interp, "8.5-") == NULL) { return TCL_ERROR; } if (Tcl_OOInitStubs(interp) == NULL) { return TCL_ERROR; } /* TIP #268: Full patchlevel instead of just major.minor */ if (Tcl_PkgProvideEx(interp, "Tcltest", TCL_PATCH_LEVEL, NULL) == TCL_ERROR) { return TCL_ERROR; | > > | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | "-appinitprocerror", "-appinitprocdeleteinterp", "-appinitprocclosestderr", "-appinitprocsetrcfile", NULL }; if (Tcl_InitStubs(interp, "8.5-", 0) == NULL) { return TCL_ERROR; } #ifndef TCL_WITH_EXTERNAL_TOMMATH if (Tcl_TomMath_InitStubs(interp, "8.5-") == NULL) { return TCL_ERROR; } #endif if (Tcl_OOInitStubs(interp) == NULL) { return TCL_ERROR; } /* TIP #268: Full patchlevel instead of just major.minor */ if (Tcl_PkgProvideEx(interp, "Tcltest", TCL_PATCH_LEVEL, NULL) == TCL_ERROR) { return TCL_ERROR; |
︙ | ︙ |
Changes to generic/tclTomMath.h.
1 2 3 4 | #ifndef BN_TCL_H_ #define BN_TCL_H_ #ifdef MP_NO_STDINT | | | | | > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #ifndef BN_TCL_H_ #define BN_TCL_H_ #ifdef MP_NO_STDINT # ifdef HAVE_STDINT_H # include <stdint.h> #else # include "../compat/stdint.h" # endif #endif #ifndef BN_H_ /* If BN_H_ already defined, don't try to include tommath.h again. */ # include "tommath.h" #endif #include "tclTomMathDecls.h" #endif |
Changes to generic/tclUtf.c.
︙ | ︙ | |||
51 52 53 54 55 56 57 | * Unicode characters less than this value are represented by themselves in * UTF-8 strings. */ #define UNICODE_SELF 0x80 /* | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | * Unicode characters less than this value are represented by themselves in * UTF-8 strings. */ #define UNICODE_SELF 0x80 /* * The following structures are used when mapping between Unicode and * UTF-8. */ static const unsigned char totalBytes[256] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
︙ | ︙ | |||
1553 1554 1555 1556 1557 1558 1559 | if ((ch2 & 0xFC00) != 0xD800) { return ch1; } } else if ((ch2 & 0xFC00) == 0xD800) { return -ch2; } #endif | | | | 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 | if ((ch2 & 0xFC00) != 0xD800) { return ch1; } } else if ((ch2 & 0xFC00) == 0xD800) { return -ch2; } #endif ch1 = Tcl_UniCharFold(ch1); ch2 = Tcl_UniCharFold(ch2); if (ch1 != ch2) { return (ch1 - ch2); } } } return 0; } |
︙ | ︙ | |||
1648 1649 1650 1651 1652 1653 1654 | if ((ch2 & 0xFC00) != 0xD800) { return ch1; } } else if ((ch2 & 0xFC00) == 0xD800) { return -ch2; } #endif | | | | 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 | if ((ch2 & 0xFC00) != 0xD800) { return ch1; } } else if ((ch2 & 0xFC00) == 0xD800) { return -ch2; } #endif ch1 = Tcl_UniCharFold(ch1); ch2 = Tcl_UniCharFold(ch2); if (ch1 != ch2) { return ch1 - ch2; } } } return UCHAR(*cs) - UCHAR(*ct); } |
︙ | ︙ | |||
1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 | *---------------------------------------------------------------------- */ int Tcl_UniCharToLower( int ch) /* Unicode character to convert. */ { if (!UNICODE_OUT_OF_RANGE(ch)) { int info = GetUniCharInfo(ch); int mode = GetCaseType(info); if ((mode & 0x02) && (mode != 0x7)) { ch += GetDelta(info); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 | *---------------------------------------------------------------------- */ int Tcl_UniCharToLower( int ch) /* Unicode character to convert. */ { if (!UNICODE_OUT_OF_RANGE(ch)) { int info = GetUniCharInfo(ch); int mode = GetCaseType(info); if ((mode & 0x02) && (mode != 0x7)) { ch += GetDelta(info); } } /* Clear away extension bits, if any */ return ch & 0x1FFFFF; } /* *---------------------------------------------------------------------- * * Tcl_UniCharFold -- * * Compute the lowercase equivalent of the given Unicode character. * * Results: * Returns the lowercase Unicode character. * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tcl_UniCharFold( int ch) /* Unicode character to convert. */ { if (!UNICODE_OUT_OF_RANGE(ch)) { int info = GetUniCharInfo(ch); int mode = GetCaseType(info); if ((mode & 0x02) && (mode != 0x7)) { ch += GetDelta(info); } |
︙ | ︙ | |||
1862 1863 1864 1865 1866 1867 1868 | Tcl_UniCharNcasecmp( 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) { | | | | 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 | Tcl_UniCharNcasecmp( 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) { Tcl_UniChar lcs = Tcl_UniCharFold(*ucs); Tcl_UniChar lct = Tcl_UniCharFold(*uct); if (lcs != lct) { return (lcs - lct); } } } return 0; |
︙ | ︙ | |||
2251 2252 2253 2254 2255 2256 2257 | /* empty body */ } p = *uniPattern; if (p == 0) { return 1; } if (nocase) { | | | 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 | /* empty body */ } p = *uniPattern; if (p == 0) { return 1; } if (nocase) { p = Tcl_UniCharFold(p); } while (1) { /* * Optimization for matching - cruise through the string * quickly if the next char in the pattern isn't a special * character */ |
︙ | ︙ | |||
2303 2304 2305 2306 2307 2308 2309 | * characters separated by "-"). */ if (p == '[') { Tcl_UniChar startChar, endChar; uniPattern++; | | | | | 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 | * characters separated by "-"). */ if (p == '[') { Tcl_UniChar startChar, endChar; uniPattern++; ch1 = (nocase ? Tcl_UniCharFold(*uniStr) : *uniStr); uniStr++; while (1) { if ((*uniPattern == ']') || (*uniPattern == 0)) { return 0; } startChar = (nocase ? Tcl_UniCharFold(*uniPattern) : *uniPattern); uniPattern++; if (*uniPattern == '-') { uniPattern++; if (*uniPattern == 0) { return 0; } endChar = (nocase ? Tcl_UniCharFold(*uniPattern) : *uniPattern); uniPattern++; if (((startChar <= ch1) && (ch1 <= endChar)) || ((endChar <= ch1) && (ch1 <= startChar))) { /* * Matches ranges of form [a-z] or [z-a]. */ |
︙ | ︙ | |||
2359 2360 2361 2362 2363 2364 2365 | /* * There's no special character. Just make sure that the next bytes of * each string match. */ if (nocase) { | | | | 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 | /* * There's no special character. Just make sure that the next bytes of * each string match. */ if (nocase) { if (Tcl_UniCharFold(*uniStr) != Tcl_UniCharFold(*uniPattern)) { return 0; } } else if (*uniStr != *uniPattern) { return 0; } uniStr++; uniPattern++; |
︙ | ︙ | |||
2443 2444 2445 2446 2447 2448 2449 | /* empty body */ } if (pattern == patternEnd) { return 1; } p = *pattern; if (nocase) { | | | | 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 | /* empty body */ } if (pattern == patternEnd) { return 1; } p = *pattern; if (nocase) { p = Tcl_UniCharFold(p); } while (1) { /* * Optimization for matching - cruise through the string * quickly if the next char in the pattern isn't a special * character. */ if ((p != '[') && (p != '?') && (p != '\\')) { if (nocase) { while ((string < stringEnd) && (p != *string) && (p != Tcl_UniCharFold(*string))) { string++; } } else { while ((string < stringEnd) && (p != *string)) { string++; } } |
︙ | ︙ | |||
2496 2497 2498 2499 2500 2501 2502 | * characters separated by "-"). */ if (p == '[') { Tcl_UniChar ch1, startChar, endChar; pattern++; | | | | | 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 | * characters separated by "-"). */ if (p == '[') { Tcl_UniChar ch1, startChar, endChar; pattern++; ch1 = (nocase ? Tcl_UniCharFold(*string) : *string); string++; while (1) { if ((*pattern == ']') || (pattern == patternEnd)) { return 0; } startChar = (nocase ? Tcl_UniCharFold(*pattern) : *pattern); pattern++; if (*pattern == '-') { pattern++; if (pattern == patternEnd) { return 0; } endChar = (nocase ? Tcl_UniCharFold(*pattern) : *pattern); pattern++; if (((startChar <= ch1) && (ch1 <= endChar)) || ((endChar <= ch1) && (ch1 <= startChar))) { /* * Matches ranges of form [a-z] or [z-a]. */ |
︙ | ︙ | |||
2551 2552 2553 2554 2555 2556 2557 | /* * There's no special character. Just make sure that the next bytes of * each string match. */ if (nocase) { | | | 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 | /* * There's no special character. Just make sure that the next bytes of * each string match. */ if (nocase) { if (Tcl_UniCharFold(*string) != Tcl_UniCharFold(*pattern)) { return 0; } } else if (*string != *pattern) { return 0; } string++; pattern++; |
︙ | ︙ |
Changes to generic/tclUtil.c.
︙ | ︙ | |||
2204 2205 2206 2207 2208 2209 2210 | if (UCHAR(*pattern) < 0x80) { ch2 = (int) (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); } else { TclUtfToUCS4(pattern, &ch2); if (nocase) { | | | | 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 | if (UCHAR(*pattern) < 0x80) { ch2 = (int) (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); } else { TclUtfToUCS4(pattern, &ch2); if (nocase) { ch2 = Tcl_UniCharFold(ch2); } } while (1) { /* * Optimization for matching - cruise through the string * quickly if the next char in the pattern isn't a special * character */ if ((p != '[') && (p != '?') && (p != '\\')) { if (nocase) { while (*str) { charLen = TclUtfToUCS4(str, &ch1); if (ch2==ch1 || ch2==Tcl_UniCharFold(ch1)) { break; } str += charLen; } } else { /* * There's no point in trying to make this code |
︙ | ︙ | |||
2278 2279 2280 2281 2282 2283 2284 | if (UCHAR(*str) < 0x80) { ch1 = (int) (nocase ? tolower(UCHAR(*str)) : UCHAR(*str)); str++; } else { str += TclUtfToUCS4(str, &ch1); if (nocase) { | | | | | 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 | if (UCHAR(*str) < 0x80) { ch1 = (int) (nocase ? tolower(UCHAR(*str)) : UCHAR(*str)); str++; } else { str += TclUtfToUCS4(str, &ch1); if (nocase) { ch1 = Tcl_UniCharFold(ch1); } } while (1) { if ((*pattern == ']') || (*pattern == '\0')) { return 0; } if (UCHAR(*pattern) < 0x80) { startChar = (int) (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); pattern++; } else { pattern += TclUtfToUCS4(pattern, &startChar); if (nocase) { startChar = Tcl_UniCharFold(startChar); } } if (*pattern == '-') { pattern++; if (*pattern == '\0') { return 0; } if (UCHAR(*pattern) < 0x80) { endChar = (int) (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); pattern++; } else { pattern += TclUtfToUCS4(pattern, &endChar); if (nocase) { endChar = Tcl_UniCharFold(endChar); } } if (((startChar <= ch1) && (ch1 <= endChar)) || ((endChar <= ch1) && (ch1 <= startChar))) { /* * Matches ranges of form [a-z] or [z-a]. */ |
︙ | ︙ | |||
2356 2357 2358 2359 2360 2361 2362 | * There's no special character. Just make sure that the next bytes of * each string match. */ str += TclUtfToUCS4(str, &ch1); pattern += TclUtfToUCS4(pattern, &ch2); if (nocase) { | | | 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 | * There's no special character. Just make sure that the next bytes of * each string match. */ str += TclUtfToUCS4(str, &ch1); pattern += TclUtfToUCS4(pattern, &ch2); if (nocase) { if (Tcl_UniCharFold(ch1) != Tcl_UniCharFold(ch2)) { return 0; } } else if (ch1 != ch2) { return 0; } } } |
︙ | ︙ |
Changes to win/tclWinTest.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif #include "tclInt.h" | > > > | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif #include "tclInt.h" #ifdef TCL_WITH_EXTERNAL_TOMMATH # include "tommath.h" #else # include "tclTomMath.h" #endif /* * For TestplatformChmod on Windows */ #ifdef _WIN32 #include <aclapi.h> #endif |
︙ | ︙ |