Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch dgp-fixme Excluding Merge-Ins
This is equivalent to a diff from 3153d51ddc to 36303870fc
|
2020-04-17
| ||
| 12:20 | Add test-case for Tcl_UtfNext/Tcl_UtfPrev. About 15 of them give the wrong answer, but - at least - ... check-in: 4302a5d8b4 user: jan.nijtmans tags: core-8-branch | |
| 05:49 | Merging forward the Utf changes. Needs some repair yet. Leaf check-in: 36303870fc user: dgp tags: dgp-fixme | |
| 05:16 | Clean test suite for both TCL_UTF_MAX=3 and TCL_UTF_MAX=4 builds. check-in: c18f3f5870 user: dgp tags: core-8-6-branch | |
|
2020-04-16
| ||
| 14:54 | Merge 8.7 check-in: 2603483e3a user: jan.nijtmans tags: trunk | |
| 11:14 | Merge 8.7 check-in: 3153d51ddc user: jan.nijtmans tags: core-8-branch | |
| 10:32 | Upgrade Xcode from 11.3 to 11.4. Let Travis test whether "make install" works when the destination d... check-in: 89b6529252 user: jan.nijtmans tags: core-8-6-branch | |
|
2020-04-15
| ||
| 20:12 | Use TclGetBytesFromObj() in testcases in stead of Tcl_GetByteArrayFromObj(), since we only want to h... check-in: b280eb5b78 user: jan.nijtmans tags: core-8-branch | |
Changes to doc/Utf.3.
| ︙ | |||
249 250 251 252 253 254 255 | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | + - - + + + - - - + + + + + + + + + + | considered part of the UTF-8 string. .PP \fBTcl_UtfFindLast\fR corresponds to \fBstrrchr\fR for UTF-8 strings. It returns a pointer to the last occurrence of the Unicode character \fIch\fR in the null-terminated UTF-8 string \fIsrc\fR. The null terminator is considered part of the UTF-8 string. .PP \fBTcl_UtfNext\fR is used to step forward through a UTF-8 string. |
| ︙ |
Changes to generic/tclCmdMZ.c.
| ︙ | |||
2525 2526 2527 2528 2529 2530 2531 | 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 | - + |
int delta = 0;
const char *next;
if (!Tcl_UniCharIsWordChar(ch)) {
break;
}
|
| ︙ |
Changes to generic/tclCompExpr.c.
| ︙ | |||
1889 1890 1891 1892 1893 1894 1895 | 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 | - |
unsigned char *lexemePtr, /* Write code of parsed lexeme to this
* storage. */
Tcl_Obj **literalPtr) /* Write corresponding literal value to this
storage, if non-NULL. */
{
const char *end;
int scanned;
|
| ︙ | |||
2097 2098 2099 2100 2101 2102 2103 | 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 | - + - + |
* We reject leading underscores in bareword. No sensible reason why.
* Might be inspired by reserved identifier rules in C, which of course
* have no direct relevance here.
*/
if (!TclIsBareword(*start) || *start == '_') {
if (Tcl_UtfCharComplete(start, numBytes)) {
|
| ︙ |
Changes to generic/tclInt.h.
| ︙ | |||
4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 | 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 | + + + + + + + + |
_count = (numBytes) - _i; \
if (_i) { \
_count += Tcl_NumUtfChars((bytes) + _count, _i); \
} \
(numChars) = _count; \
} while (0);
#define TclUtfPrev(src, start) \
(((src) < (start)+2) ? (start) : \
((unsigned char) *(src - 1)) < 0x80 ? (src)-1 : \
Tcl_UtfPrev(src, start))
#define TclUtfNext(src) \
((((unsigned char) *(src)) < 0xC0) ? src + 1 : Tcl_UtfNext(src))
/*
*----------------------------------------------------------------
* Macro that encapsulates the logic that determines when it is safe to
* interpret a string as a byte array directly. In summary, the object must be
* a byte array and must not have a string representation (as the operations
* that it is used in are defined on strings, not byte arrays). Theoretically
* it is possible to also be efficient in the case where the object's bytes
|
| ︙ |
Changes to generic/tclStringObj.c.
| ︙ | |||
1167 1168 1169 1170 1171 1172 1173 | 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | - + - + |
toCopy = length;
} else {
if (ellipsis == NULL) {
ellipsis = "...";
}
eLen = strlen(ellipsis);
while (eLen > limit) {
|
| ︙ | |||
2610 2611 2612 2613 2614 2615 2616 | 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 | - + | /* * Within that buffer, we trim both ends if needed so that we * copy only whole characters, and avoid copying any partial * multi-byte characters. */ |
| ︙ |
Changes to generic/tclUtf.c.
| ︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | - + - + + |
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,
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,
|
| ︙ | |||
110 111 112 113 114 115 116 | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
return 2;
}
if (((unsigned)(ch - 0x10000) <= 0xFFFFF)) {
return 4;
}
return 3;
}
|
| ︙ | |||
731 732 733 734 735 736 737 | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | - + - - - + + + + - - - + + + - - + + + |
int
Tcl_NumUtfChars(
const char *src, /* The UTF-8 string to measure. */
int length) /* The length of the string in bytes, or -1
* for strlen(string). */
{
|
| ︙ | |||
848 849 850 851 852 853 854 | 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | + - - - + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + + - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - + - - + + - - + + - - - - - - + + + + + + + - - + + + + + + - - - + + - - - + + - - - + + + + + + + + + + - + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - - + + + + + + + + | } /* *--------------------------------------------------------------------------- * * Tcl_UtfNext -- * * The aim of this routine is to provide a way to iterate forward |
| ︙ | |||
979 980 981 982 983 984 985 | 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 | - - - - + - - - - - - + - - - - - - - - - - - + |
*/
int
Tcl_UniCharAtIndex(
const char *src, /* The UTF-8 string to dereference. */
int index) /* The position of the desired character. */
{
|
| ︙ | |||
1027 1028 1029 1030 1031 1032 1033 | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | - - - - + - - + - - - - + + + + + + + + - |
*/
const char *
Tcl_UtfAtIndex(
const char *src, /* The UTF-8 string. */
int index) /* The position of the desired character. */
{
|
| ︙ |
Changes to generic/tclUtil.c.
| ︙ | |||
1703 1704 1705 1706 1707 1708 1709 | 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 | - + |
* Outer loop: iterate over string to be trimmed.
*/
do {
const char *q = trim;
int pInc = 0, bytesLeft = numTrim;
|
| ︙ | |||
1854 1855 1856 1857 1858 1859 1860 | 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 | - + |
trimLeft = TclTrimLeft(bytes, numBytes, trim, numTrim);
numBytes -= trimLeft;
/* If we did not trim the whole string, it starts with a character
* that we will not trim. Skip over it. */
if (numBytes > 0) {
const char *first = bytes + trimLeft;
|
| ︙ |
Changes to generic/tclZlib.c.
| ︙ | |||
3072 3073 3074 3075 3076 3077 3078 | 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 | - + + + | * Length (cd->decompressed) == 0, toRead > 0 here. * * The zlib transform allows us to read at most one character from the * underlying channel to properly identify Z_STREAM_END without * reading over the border. */ |
| ︙ |
Changes to tests/utf.test.
| ︙ | |||
91 92 93 94 95 96 97 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | - + |
string length [testbytestring "\xF4\x8F\xBF\xBF"]
} -result {2}
test utf-2.10 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, underflow} testbytestring {
string length [testbytestring "\xF0\x8F\xBF\xBF"]
} {4}
test utf-2.11 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, overflow} testbytestring {
string length [testbytestring "\xF4\x90\x80\x80"]
|
| ︙ | |||
148 149 150 151 152 153 154 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
test utf-5.1 {Tcl_UtfFindFirst} {testfindfirst testbytestring} {
testfindfirst [testbytestring "abcbc"] 98
} {bcbc}
test utf-5.2 {Tcl_UtfFindLast} {testfindlast testbytestring} {
testfindlast [testbytestring "abcbc"] 98
} {bc}
testConstraint testutfnext [llength [info commands testutfnext]]
|
| ︙ | |||
312 313 314 315 316 317 318 319 320 321 322 323 324 325 | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
} 4
test utf-7.22 {Tcl_UtfPrev} testutfprev {
testutfprev A\xD0\xA0\xA0\xA0
} 4
test utf-7.23 {Tcl_UtfPrev} testutfprev {
testutfprev A\xA0\xA0\xA0\xA0
} 4
test utf-7.24 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xC0\x81
} 2
test utf-7.25 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xC0\x81 2
} 1
test utf-7.26 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xE0\x80\x80
} 3
test utf-7.27 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xE0\x80\x80 3
} 2
test utf-7.28 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xE0\x80\x80 2
} 1
test utf-7.29 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xF0\x80\x80\x80
} 4
test utf-7.30 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xF0\x80\x80\x80 4
} 3
test utf-7.31 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xF0\x80\x80\x80 3
} 2
test utf-7.32 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xF0\x80\x80\x80 2
} 1
test utf-7.33 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xC0\x80
} 1
test utf-7.34 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xC1\x80
} 2
test utf-7.35 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xC2\x80
} 1
test utf-7.36 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xE0\xA0\x80
} 1
test utf-7.37 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xE0\xA0\x80 3
} 1
test utf-7.38 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xE0\xA0\x80 2
} 1
test utf-7.39 {Tcl_UtfPrev -- overlong sequence} {testutfprev} {
testutfprev A\xF0\x90\x80\x80
} 1
test utf-7.40 {Tcl_UtfPrev -- overlong sequence} {testutfprev} {
testutfprev A\xF0\x90\x80\x80 4
} 1
test utf-7.41 {Tcl_UtfPrev -- overlong sequence} {testutfprev} {
testutfprev A\xF0\x90\x80\x80 3
} 1
test utf-7.42 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xF0\x90\x80\x80 2
} 1
test utf-7.43 {Tcl_UtfPrev -- no lead byte at start} testutfprev {
testutfprev \xA0
} 0
test utf-7.44 {Tcl_UtfPrev -- no lead byte at start} testutfprev {
testutfprev \xA0\xA0
} 1
test utf-7.45 {Tcl_UtfPrev -- no lead byte at start} testutfprev {
testutfprev \xA0\xA0\xA0
} 2
test utf-7.46 {Tcl_UtfPrev -- no lead byte at start} testutfprev {
testutfprev \xA0\xA0\xA0\xA0
} 3
test utf-8.1 {Tcl_UniCharAtIndex: index = 0} {
string index abcd 0
} {a}
test utf-8.2 {Tcl_UniCharAtIndex: index = 0} {
string index \u4E4E\u25A 0
} "\u4E4E"
|
| ︙ |