Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch wtf-8-experiment Excluding Merge-Ins
This is equivalent to a diff from f358a5f413 to 6aeb87c775
2024-04-30
| ||
16:51 | merge with trunk Leaf check-in: 6aeb87c775 user: chw tags: wtf-8-experiment | |
16:50 | add selected tk upstream changes Leaf check-in: f358a5f413 user: chw tags: trunk | |
16:39 | add selected tcl upstream changes check-in: 103bb0978a user: chw tags: trunk | |
2024-04-22
| ||
18:15 | merge with trunk check-in: 46b8eecdce user: chw tags: wtf-8-experiment | |
Changes to jni/rl_json/generic/parser.c.
︙ | |||
145 146 147 148 149 150 151 | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | - - - - - | (*p)--; // Have to check for this here - other unescaped control chars are handled by the < 0x1F // test, but 0x00 is transformed to 0xC0 0x80 by Tcl (MUTF-8 rather than UTF-8) return CHAR_ADVANCE_UNESCAPED_NULL; } if (first < 0xe0 /* 0b11100000 */) { eat = 1; |
︙ | |||
316 317 318 319 320 321 322 | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | - + | case 'r': mapped='\r'; goto append_mapped; case 't': mapped='\t'; append_mapped: Tcl_AppendToObj(out, &mapped, 1); // Weird, but arranged this way the compiler optimizes it to a jump table break; case 'u': { |
︙ | |||
350 351 352 353 354 355 356 | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | - - + | goto err; } } acc <<= 4; acc += digit; } |
︙ | |||
392 393 394 395 396 397 398 399 400 401 402 403 404 405 | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | + + + + + + + + | } if ((acc2 & 0xFFFFFC00) == 0xDC00) { acc = ((acc & 0x3FF) << 10) + 0x10000 + (acc2 & 0x3FF); p = pp; } } #if TCL_UTF_MAX == 3 if (acc > 0xFFFF) { acc -= 0x10000; Tcl_UniChar uch = ((acc >> 10) & 0x3FF) | 0xD800; acc = (acc & 0x3FF) | 0xDC00; const int len0 = Tcl_UniCharToUtf(uch, utfbuf); Tcl_AppendToObj(out, utfbuf, len0); } #endif //const unsigned char* utfend = output_utf8(acc, utfbuf); const int len = Tcl_UniCharToUtf(acc, utfbuf); Tcl_AppendToObj(out, utfbuf, len); } break; |
︙ |
Changes to jni/sdl2tk/generic/tkCanvText.c.
︙ | |||
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | 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 | + + + + + + + + + + + + + + + + + + | index = textPtr->numChars; } byteIndex = Tcl_UtfAtIndex(text, index) - text; byteCount = strlen(string); if (byteCount == 0) { return; } #if TCL_UTF_MAX < 4 /* * Don't insert within surrogate pairs. */ if (byteIndex) { Tcl_UniChar ch; const char *prevPtr; Tcl_UtfToUniChar(string + byteIndex, &ch); if ((ch & 0xfc00) == 0xdc00) { prevPtr = Tcl_UtfPrev(string + byteIndex, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xfc00) == 0xd800) { byteIndex = prevPtr - string; index -= 1; } } } #endif newStr = (char *) ckalloc(textPtr->numBytes + byteCount + 1); memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, string); strcpy(newStr + byteIndex + byteCount, text + byteIndex); ckfree(text); textPtr->text = newStr; |
︙ | |||
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } if (first > last) { return; } charsRemoved = last + 1 - first; byteIndex = Tcl_UtfAtIndex(text, first) - text; #if TCL_UTF_MAX < 4 /* * Delete complete surrogate pairs. */ if (byteIndex >= 0) { Tcl_UniChar ch; const char *prevPtr, *nextPtr; Tcl_UtfToUniChar(text + byteIndex, &ch); if ((ch & 0xfc00) == 0xdc00) { prevPtr = Tcl_UtfPrev(text + byteIndex, text); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xfc00) == 0xd800) { byteIndex = prevPtr - text; first--; } } else if (charsRemoved == 1 && (ch & 0xfc00) == 0xd800) { nextPtr = Tcl_UtfNext(text + byteIndex); Tcl_UtfToUniChar(nextPtr, &ch); if ((ch & 0xfc00) == 0xdc00) { last++; } } if (last >= textPtr->numChars) { last = textPtr->numChars - 1; } charsRemoved = last + 1 - first; } #endif byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); #if TCL_UTF_MAX < 4 if (byteCount) { int len; Tcl_UniChar ch; const char *prevPtr; len = Tcl_UtfToUniChar(text + byteIndex + byteCount, &ch); if ((ch & 0xfc00) == 0xdc00) { prevPtr = Tcl_UtfPrev(text + byteIndex + byteCount, text); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xfc00) == 0xd800) { byteCount += len; charsRemoved++; } } } #endif newStr = (char *) ckalloc(textPtr->numBytes + 1 - byteCount); memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, text + byteIndex + byteCount); ckfree(text); textPtr->text = newStr; |
︙ | |||
1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 | 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 | + + + + | * index. */ { TextItem *textPtr = (TextItem *) itemPtr; int length; int c; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; const char *string = Tcl_GetStringFromObj(obj, &length); #if TCL_UTF_MAX < 4 int roundUp = 0; int oldInsertPos = textPtr->insertPos; #endif c = string[0]; if ((c == 'e') && (strncmp(string, "end", length) == 0)) { *indexPtr = textPtr->numChars; } else if ((c == 'i') && (strncmp(string, "insert", length) == 0)) { |
︙ | |||
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | (int) (x*cs - y*s), (int) (y*cs + x*s)); } else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) { if (*indexPtr < 0) { *indexPtr = 0; } else if (*indexPtr > textPtr->numChars) { *indexPtr = textPtr->numChars; } #if TCL_UTF_MAX < 4 roundUp = (*indexPtr == (oldInsertPos + 1)); #endif } else { /* * Some of the paths here leave messages in the interp's result, so we * have to clear it out before storing our own message. */ badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "TEXT", NULL); return TCL_ERROR; } #if TCL_UTF_MAX < 4 /* * Enforce index on start or end of surrogate pair. */ if (*indexPtr) { int byteIndex; Tcl_UniChar ch; const char *prevPtr, *nextPtr; string = textPtr->text; byteIndex = Tcl_UtfAtIndex(string, *indexPtr) - string; Tcl_UtfToUniChar(string + byteIndex, &ch); if ((ch & 0xfc00) == 0xdc00) { if (roundUp) { *indexPtr += 1; } else { prevPtr = Tcl_UtfPrev(string + byteIndex, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xfc00) == 0xd800) { *indexPtr -= 1; } } } else if (roundUp && (ch & 0xfc00) == 0xd800) { nextPtr = Tcl_UtfNext(string + byteIndex); Tcl_UtfToUniChar(nextPtr, &ch); if ((ch & 0xfc00) == 0xdc00) { *indexPtr += 2; } } } #endif return TCL_OK; } /* *-------------------------------------------------------------- * * SetTextCursor -- |
︙ |
Changes to jni/sdl2tk/generic/tkEntry.c.
︙ | |||
1982 1983 1984 1985 1986 1987 1988 | 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 | - - + + - - + + | /* * If we're displaying a special character instead of the value of the * entry, recompute the displayString. */ if (entryPtr->showChar != NULL) { |
︙ | |||
2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 | 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 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 2234 2235 2236 2237 2238 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | * string). */ { ptrdiff_t byteIndex; size_t byteCount, newByteCount; int oldChars, charsAdded; const char *string; char *newStr; #if TCL_UTF_MAX < 4 Tcl_UniChar ch; #endif string = entryPtr->string; byteIndex = Tcl_UtfAtIndex(string, index) - string; byteCount = strlen(value); if (byteCount == 0) { return TCL_OK; } #if TCL_UTF_MAX < 4 /* * Don't insert within surrogate pairs. */ if (byteIndex) { Tcl_UniChar ch; const char *prevPtr; Tcl_UtfToUniChar(string + byteIndex, &ch); if ((ch & 0xFC00) == 0xDC00) { prevPtr = Tcl_UtfPrev(string + byteIndex, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xFC00) == 0xD800) { byteIndex = prevPtr - string; index -= 1; } } } #endif newByteCount = entryPtr->numBytes + byteCount + 1; newStr = (char *) ckalloc(newByteCount); memcpy(newStr, string, byteIndex); strcpy(newStr + byteIndex, value); strcpy(newStr + byteIndex + byteCount, string + byteIndex); if ((entryPtr->validate == VALIDATE_KEY || entryPtr->validate == VALIDATE_ALL) && EntryValidateChange(entryPtr, value, newStr, index, VALIDATE_INSERT) != TCL_OK) { ckfree(newStr); return TCL_OK; } #if TCL_UTF_MAX < 4 /* * Account for high surrogate at end of inserted string. */ if (byteCount > 1) { const char *lastPtr = Tcl_UtfPrev(newStr+byteIndex+byteCount, newStr); Tcl_UtfToUniChar(lastPtr, &ch); if ((ch & 0xFC00) == 0xD800) { /* * A high surrogate. If followed by low surrogate, * adjust index after it. */ lastPtr = Tcl_UtfNext(lastPtr); Tcl_UtfToUniChar(lastPtr, &ch); if ((ch & 0xFC00) == 0xDC00) { index++; } } } #endif ckfree((char *)string); entryPtr->string = newStr; /* * The following construction is used because inserting improperly formed * UTF-8 sequences between other improperly formed UTF-8 sequences could |
︙ | |||
2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 | 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 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 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } if (count <= 0) { return TCL_OK; } string = entryPtr->string; byteIndex = Tcl_UtfAtIndex(string, index) - string; #if TCL_UTF_MAX < 4 /* * Delete complete surrogate pairs. */ if (byteIndex >= 0) { Tcl_UniChar ch; const char *prevPtr, *nextPtr; Tcl_UtfToUniChar(string + byteIndex, &ch); if ((ch & 0xFC00) == 0xDC00) { prevPtr = Tcl_UtfPrev(string + byteIndex, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xFC00) == 0xD800) { byteIndex = prevPtr - string; count++; index--; } } else if ((count == 1) && ((ch & 0xFC00) == 0xD800)) { nextPtr = Tcl_UtfNext(string + byteIndex); Tcl_UtfToUniChar(nextPtr, &ch); if ((ch & 0xFC00) == 0xDC00) { count++; } } if ((index + count) > entryPtr->numChars) { count = entryPtr->numChars - index; } } #endif byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex); #if TCL_UTF_MAX < 4 if (byteCount) { int len; Tcl_UniChar ch; const char *prevPtr; len = Tcl_UtfToUniChar(string + byteIndex + byteCount, &ch); if ((ch & 0xFC00) == 0xDC00) { prevPtr = Tcl_UtfPrev(string + byteIndex + byteCount, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xFC00) == 0xD800) { byteCount += len; count++; } } } #endif newByteCount = entryPtr->numBytes + 1 - byteCount; newStr = (char *) ckalloc(newByteCount); memcpy(newStr, string, (size_t) byteIndex); strcpy(newStr + byteIndex, string + byteIndex + byteCount); toDelete = (char *) ckalloc(byteCount + 1); |
︙ | |||
2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 | 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 | + + + + | Entry *entryPtr, /* Entry for which the index is being * specified. */ Tcl_Obj *indexObj, /* Specifies character in entryPtr. */ int *indexPtr) /* Where to store converted character index */ { const char *string = Tcl_GetString(indexObj); size_t length = indexObj->length; int roundUp = 0; #if TCL_UTF_MAX < 4 int oldInsertPos = entryPtr->insertPos; #endif switch (string[0]) { case 'a': if (strncmp(string, "anchor", length) != 0) { goto badIndex; } *indexPtr = entryPtr->selectAnchor; |
︙ | |||
2716 2717 2718 2719 2720 2721 2722 | 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 | - + - | } else if (strncmp(string, "sel.last", length) == 0) { *indexPtr = entryPtr->selectLast; } else { goto badIndex; } break; case '@': { |
︙ | |||
2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 | 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | goto badIndex; } if (*indexPtr < 0){ *indexPtr = 0; } else if (*indexPtr > entryPtr->numChars) { *indexPtr = entryPtr->numChars; } #if TCL_UTF_MAX < 4 roundUp = (indexPtr == &entryPtr->insertPos) && (*indexPtr == (oldInsertPos + 1)); #endif } #if TCL_UTF_MAX < 4 /* * Enforce index on start or end of surrogate pair. */ if (*indexPtr) { int byteIndex; Tcl_UniChar ch; const char *prevPtr; string = entryPtr->string; byteIndex = Tcl_UtfAtIndex(string, *indexPtr) - string; Tcl_UtfToUniChar(string + byteIndex, &ch); if ((ch & 0xFC00) == 0xDC00) { if (roundUp) { *indexPtr += 1; } else { prevPtr = Tcl_UtfPrev(string + byteIndex, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xFC00) == 0xD800) { *indexPtr -= 1; } } } } #endif return TCL_OK; badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad %s index \"%s\"", (entryPtr->type == TK_ENTRY) ? "entry" : "spinbox", string)); Tcl_SetErrorCode(interp, "TK", (entryPtr->type == TK_ENTRY) ? "ENTRY" : "SPINBOX", |
︙ | |||
2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 | 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 | + + + + + + + + + + + + + + + + + + + + + | * Pick new starting and ending points for the selection. */ if (entryPtr->selectAnchor > entryPtr->numChars) { entryPtr->selectAnchor = entryPtr->numChars; } if (entryPtr->selectAnchor <= index) { #if TCL_UTF_MAX < 4 /* * Correct ending point for surrogate pair. */ Tcl_UniChar ch; const char *string; string = Tcl_UtfAtIndex(entryPtr->string, index); string += Tcl_UtfToUniChar(string, &ch); if (((ch & 0xFC00) == 0xDC00) && (index + 1 < entryPtr->numChars)) { index += 1; } else if (((ch & 0xFC00) == 0xD800) && (index + 1 < entryPtr->numChars) && (index == entryPtr->insertPos)) { Tcl_UtfToUniChar(string, &ch); if ((ch & 0xFC00) == 0xDC00) { index += 2; } } #endif newFirst = entryPtr->selectAnchor; newLast = index; } else { newFirst = index; newLast = entryPtr->selectAnchor; if (newLast < 0) { newFirst = newLast = -1; |
︙ | |||
3546 3547 3548 3549 3550 3551 3552 | 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 | - + | Tcl_DString *dsPtr) /* Dynamic string in which to append new * command. */ { int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl * list element. */ int number, length; const char *string; |
︙ | |||
3579 3580 3581 3582 3583 3584 3585 | 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 | - + - + | /* * There's a percent sequence here. Process it. */ before++; /* skip over % */ if (*before != '\0') { |
︙ | |||
3659 3660 3661 3662 3663 3664 3665 | 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 | - + | break; } break; case 'W': /* widget name */ string = Tk_PathName(entryPtr->tkwin); break; default: |
︙ | |||
4159 4160 4161 4162 4163 4164 4165 | 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 | - + | goto error; } if (GetEntryIndex(interp, entryPtr, objv[3], &index) != TCL_OK) { goto error; } if (GetEntryIndex(interp, entryPtr, |
︙ |
Changes to jni/sdl2tk/generic/tkFont.c.
︙ | |||
560 561 562 563 564 565 566 | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | - + | switch ((enum options) index) { case FONT_ACTUAL: { int skip, result, n; const char *s; Tk_Font tkfont; Tcl_Obj *optPtr, *charPtr, *resultPtr; |
︙ | |||
625 626 627 628 629 630 631 | 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 | + + - + + - + - | } /* * The 'charPtr' arg must be a single Unicode. */ if (charPtr != NULL) { const char *string = Tcl_GetString(charPtr); int len = TkUtfToUniChar(string, &uniChar); |
︙ | |||
1803 1804 1805 1806 1807 1808 1809 | 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 | - + - + - + | } else if (strcasecmp(family, "AvantGarde") == 0) { family = "AvantGarde"; } else if (strcasecmp(family, "ZapfChancery") == 0) { family = "ZapfChancery"; } else if (strcasecmp(family, "ZapfDingbats") == 0) { family = "ZapfDingbats"; } else { |
︙ | |||
2862 2863 2864 2865 2866 2867 2868 | 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 | - + | end = Tcl_UtfAtIndex(chunkPtr->start, index); if (xPtr != NULL) { Tk_MeasureChars(tkfont, chunkPtr->start, end - chunkPtr->start, -1, 0, &x); x += chunkPtr->x; } if (widthPtr != NULL) { |
︙ | |||
3385 3386 3387 3388 3389 3390 3391 | 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 | - + | TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr = layoutPtr->chunks; int baseline = chunkPtr->y; Tcl_Obj *psObj = Tcl_NewObj(); int i, j, len; const char *p, *glyphname; char uindex[5], c, *ps; |
︙ | |||
3408 3409 3410 3411 3412 3413 3414 | 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 | - + | /* * INTL: We only handle symbols that have an encoding as a glyph * from the standard set defined by Adobe. The rest get punted. * Eventually this should be revised to handle more sophsticiated * international postscript fonts. */ |
︙ |
Changes to jni/sdl2tk/generic/tkInt.h.
︙ | |||
1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | + + + + + + + + + + + + + | #if !defined(__cplusplus) && !defined(c_plusplus) # define c_class class #endif #ifdef TK_USE_POLL MODULE_SCOPE TkDisplay * TkGetDisplayListExt(struct pollfd **pollTablePtr); #endif #if TCL_UTF_MAX > 3 # define TkUtfToUniChar(src, chPtr) \ Tcl_UtfToUniChar((src), (Tcl_UniChar *)(chPtr)) # define TkUniCharToUtf Tcl_UniCharToUtf # define TkUtfPrev Tcl_UtfPrev # define TkUtfNext Tcl_UtfNext #else MODULE_SCOPE int TkUtfToUniChar(const char *, int *); MODULE_SCOPE int TkUniCharToUtf(int, char *); MODULE_SCOPE const char *TkUtfPrev(const char *, const char *); MODULE_SCOPE const char *TkUtfNext(const char *); #endif /* * Unsupported commands. */ MODULE_SCOPE int TkUnsupported1ObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, |
︙ |
Changes to jni/sdl2tk/generic/tkSelect.c.
︙ | |||
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 | 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 | + + + + + + + + + + + + + + + + + | SelGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ Tcl_Interp *interp, /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { #if TCL_UTF_MAX < 4 /* * Ensure WTF-8 without 4-byte UTF-8 sequences. */ Tcl_Encoding encoding; Tcl_DString tmp; encoding = Tcl_GetEncoding(NULL, "utf-8"); Tcl_ExternalToUtfDString(encoding, portion, -1, &tmp); Tcl_DStringAppend((Tcl_DString *) clientData, Tcl_DStringValue(&tmp), Tcl_DStringLength(&tmp)); Tcl_DStringFree(&tmp); if (encoding) { Tcl_FreeEncoding(encoding); } #else Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1); #endif return TCL_OK; } /* *---------------------------------------------------------------------- * * HandleTclCommand -- |
︙ | |||
1396 1397 1398 1399 1400 1401 1402 | 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 | - + | */ if (cmdInfoPtr->interp != NULL) { if (length <= maxBytes) { cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, -1); cmdInfoPtr->buffer[0] = '\0'; } else { |
︙ |
Changes to jni/sdl2tk/generic/tkText.c.
︙ | |||
4447 4448 4449 4450 4451 4452 4453 | 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 | - + | Tcl_Obj *stringPtr) /* Description of the tab stops. See the text * manual entry for details. */ { int objc, i, count; Tcl_Obj **objv; TkTextTabArray *tabArrayPtr; TkTextTab *tabPtr; |
︙ | |||
4555 4556 4557 4558 4559 4560 4561 | 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 | - + | continue; } /* * There may be a more efficient way of getting this. */ |
︙ | |||
5870 5871 5872 5873 5874 5875 5876 | 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 | - + | if (searchSpecPtr->exact) { int maxExtraLines = 0; const char *startOfLine = Tcl_GetString(theLine); CLANG_ASSERT(pattern); do { |
︙ | |||
6104 6105 6106 6107 6108 6109 6110 | 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 | - + | if (searchSpecPtr->backwards) { alreadySearchOffset = p - startOfLine - 1; if (alreadySearchOffset < 0) { break; } } else { firstOffset = p - startOfLine + |
︙ |
Changes to jni/sdl2tk/generic/tkTextDisp.c.
︙ | |||
7705 7706 7707 7708 7709 7710 7711 | 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 | - - + + | #else /* !TK_LAYOUT_WITH_BASE_CHUNKS */ bytesThatFit = CharChunkMeasureChars(chunkPtr, p, maxBytes, 0, -1, chunkPtr->x, maxX, TK_ISOLATE_END, &nextX); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ if (bytesThatFit < maxBytes) { if ((bytesThatFit == 0) && noCharsYet) { |
︙ |
Changes to jni/sdl2tk/generic/tkTextIndex.c.
︙ | |||
383 384 385 386 387 388 389 | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | - + | * of text). */ int byteIndex, /* Byte index of desired character. */ TkTextIndex *indexPtr) /* Structure to fill in. */ { TkTextSegment *segPtr; int index; const char *p, *start; |
︙ | |||
476 477 478 479 480 481 482 | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | - + | * of text). */ int charIndex, /* Index of desired character. */ TkTextIndex *indexPtr) /* Structure to fill in. */ { TkTextSegment *segPtr; char *p, *start, *end; int index, offset; |
︙ | |||
1548 1549 1550 1551 1552 1553 1554 | 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 | - + | TkTextCountType type) /* The type of item to count */ { TkTextLine *linePtr; TkTextSegment *segPtr; TkTextElideInfo *infoPtr = NULL; int byteOffset; char *start, *end, *p; |
︙ | |||
1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 | 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 | + + + + + + + + + + + + + | } if (!elide) { if (segPtr->typePtr == &tkTextCharType) { start = segPtr->body.chars + byteOffset; end = segPtr->body.chars + segPtr->size; for (p = start; p < end; p += Tcl_UtfToUniChar(p, &ch)) { #if TCL_UTF_MAX < 4 if (((ch & 0xFC00) == 0xD800) && (p < end)) { char *pp = p; pp += Tcl_UtfToUniChar(pp, &ch); if ((ch & 0xFC00) == 0xDC00) { p = pp; if (charCount > 0) { charCount--; } } } #endif if (charCount == 0) { dstPtr->byteIndex += (p - start); goto forwardCharDone; } charCount--; } } else if (type & COUNT_INDICES) { |
︙ | |||
2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 | 2197 2198 2199 2200 2201 2202 2203 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 | + + + + + + + + + + + + + + + + + + | } if (!elide) { if (segPtr->typePtr == &tkTextCharType) { start = segPtr->body.chars; end = segPtr->body.chars + segSize; for (p = end; ; p = Tcl_UtfPrev(p, start)) { #if TCL_UTF_MAX < 4 Tcl_UniChar ch; Tcl_UtfToUniChar(p, &ch); if (((ch & 0xFC00) == 0xDC00) && (p > start)) { const char *pp = Tcl_UtfPrev(p, start); if (pp != NULL) { Tcl_UtfToUniChar(pp, &ch); if ((ch & 0xFC00) == 0xD800) { p = pp; if (charCount > 0) { charCount--; } } } } #endif if (charCount == 0) { dstPtr->byteIndex -= (end - p); goto backwardCharDone; } if (p == start) { break; } |
︙ | |||
2371 2372 2373 2374 2375 2376 2377 | 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 | - + - + | COUNT_DISPLAY_INDICES); } segPtr = TkTextIndexToSeg(indexPtr, &offset); while (1) { int chSize = 1; if (segPtr->typePtr == &tkTextCharType) { |
︙ | |||
2416 2417 2418 2419 2420 2421 2422 | 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 | - + - + - + | */ segPtr = TkTextIndexToSeg(indexPtr, &offset); while (1) { int chSize = 1; if (segPtr->typePtr == &tkTextCharType) { |
︙ |
Changes to jni/sdl2tk/generic/tkUtil.c.
︙ | |||
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 | 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | if (detail != NULL) { /* Event code will call Tcl_DecrRefCount(). */ Tcl_IncrRefCount(detail); } Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } #if TCL_UTF_MAX < 4 /* *--------------------------------------------------------------------------- * * TkUtfToUniChar -- * * Almost the same as Tcl_UtfToUniChar but using int instead of Tcl_UniChar. * This function is capable of collapsing a upper/lower surrogate pair to a * single unicode character. So, up to 6 bytes might be consumed. * * Results: * *chPtr is filled with the Tcl_UniChar, and the return value is the * number of bytes from the UTF-8 string that were consumed. * * Side effects: * None. * *--------------------------------------------------------------------------- */ int TkUtfToUniChar( const char *src, /* The UTF-8 string. */ int *chPtr) /* Filled with the Tcl_UniChar represented by * the UTF-8 string. */ { Tcl_UniChar uniChar = 0; int len = Tcl_UtfToUniChar(src, &uniChar); if ((uniChar & 0xfc00) == 0xd800) { int high = uniChar; int len2 = Tcl_UtfToUniChar(src+len, &uniChar); if ((uniChar & 0xfc00) == 0xdc00) { *chPtr = (((high & 0x3ff) << 10) | (uniChar & 0x3ff)) + 0x10000; len += len2; } else { *chPtr = high; } } else { *chPtr = uniChar; } return len; } /* *--------------------------------------------------------------------------- * * TkUniCharToUtf -- * * Almost the same as Tcl_UniCharToUtf but producing surrogates if * TCL_UTF_MAX==3. So, up to 6 bytes might be produced. * * Results: * *buf is filled with the UTF-8 string, and the return value is the * number of bytes produced. * * Side effects: * None. * *--------------------------------------------------------------------------- */ int TkUniCharToUtf( int ch, char *buf) { int size; if ((ch > 0xffff) && (ch <= 0x10ffff)) { ch -= 0x10000; size = Tcl_UniCharToUtf(((ch >> 10) | 0xd800), buf); size += Tcl_UniCharToUtf(((ch & 0x3ff) | 0xdc00), buf+size); } else { size = Tcl_UniCharToUtf(ch, buf); } return size; } /* *--------------------------------------------------------------------------- * * TkUtfPrev -- * * Almost the same as Tcl_UtfPrev but check for surrogates if * TCL_UTF_MAX==3. So, the pointer might move up to 6 bytes. * * Results: * Return a pointer to the previous unicode character. * * Side effects: * None. * *--------------------------------------------------------------------------- */ const char * TkUtfPrev( const char *start, const char *source) { const char *p = Tcl_UtfPrev(start, source); if ((p == source-3) && ((p[0]&0xFF) == 0xED) && ((p[1]&0xF0) == 0xB0) && ((p[2]&0xC0) == 0x80)) { /* We are pointing to a low surrogate. If the previous * codepoint is a high surrogate, we want that in stead. */ const char *q = p - 3; if ((q >= start) && ((q[0]&0xFF) == 0xED) && ((q[1]&0xF0) == 0xA0) && ((q[2]&0xC0) == 0x80)) { p = q; } } return p; } /* *--------------------------------------------------------------------------- * * TkUtfNext -- * * Almost the same as Tcl_UtfNext but check for surrogates if * TCL_UTF_MAX==3. So, the pointer might move up to 6 bytes. * * Results: * Return a pointer to the next unicode character. * * Side effects: * None. * *--------------------------------------------------------------------------- */ const char * TkUtfNext( const char *source) { const char *p = Tcl_UtfNext(source); if ((p == source+3) && ((source[0]&0xFF) == 0xED) && ((source[1]&0xF0) == 0xA0) && ((source[2]&0xC0) == 0x80)) { /* We were pointing to a high surrogate. If the next * codepoint is a low surrogate, we want to advance one more. */ if (((p[0]&0xFF) == 0xED) && ((p[1]&0xF0) == 0xB0) && ((p[2]&0xC0) == 0x80)) { p += 3; } } return p; } #endif /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to jni/sdl2tk/generic/ttk/ttkEntry.c.
︙ | |||
289 290 291 292 293 294 295 | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | - - + + - - + + | * of (the first character in the string) 'showChar'. * Used to compute the displayString if -show is non-NULL. */ static char *EntryDisplayString(const char *showChar, int numChars) { char *displayString, *p; int size; |
︙ | |||
426 427 428 429 430 431 432 | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | - + | VREASON reason, /* Reason for change */ Tcl_DString *dsPtr) /* Result of %-substitutions */ { int spaceNeeded, cvtFlags; int number, length; const char *string; int stringLength; |
︙ | |||
450 451 452 453 454 455 456 | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | - + | templ = string; } /* There's a percent sequence here. Process it. */ ++templ; /* skip over % */ if (*templ != '\0') { |
︙ | |||
500 501 502 503 504 505 506 | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | - + | case 'V': /* type of validation in effect */ string = validateReasonStrings[reason]; break; case 'W': /* widget name */ string = Tk_PathName(entryPtr->core.tkwin); break; default: |
︙ | |||
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | char *string = entryPtr->entry.string; size_t byteIndex = Tcl_UtfAtIndex(string, index) - string; size_t byteCount = strlen(value); int charsAdded = Tcl_NumUtfChars(value, byteCount); size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1; char *newBytes; int code; #if TCL_UTF_MAX < 4 Tcl_UniChar ch; #endif if (byteCount == 0) { return TCL_OK; } #if TCL_UTF_MAX < 4 /* * Don't insert within surrogate pairs. */ if (byteIndex) { const char *prevPtr; Tcl_UtfToUniChar(string + byteIndex, &ch); if ((ch & 0xFC00) == 0xDC00) { prevPtr = Tcl_UtfPrev(string + byteIndex, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xFC00) == 0xD800) { byteIndex = prevPtr - string; index -= 1; } } } #endif newBytes = (char *) ckalloc(newByteCount); memcpy(newBytes, string, byteIndex); strcpy(newBytes + byteIndex, value); strcpy(newBytes + byteIndex + byteCount, string + byteIndex); code = EntryValidateChange( entryPtr, newBytes, index, charsAdded, VALIDATE_INSERT); #if TCL_UTF_MAX < 4 /* * Account for high surrogate at end of inserted string. */ if (byteCount > 1) { const char *lastPtr = Tcl_UtfPrev(newBytes+byteIndex+byteCount, newBytes); Tcl_UtfToUniChar(lastPtr, &ch); if ((ch & 0xFC00) == 0xD800) { /* * A high surrogate. If followed by low surrogate, * adjust index after it. */ lastPtr = Tcl_UtfNext(lastPtr); Tcl_UtfToUniChar(lastPtr, &ch); if ((ch & 0xFC00) == 0xDC00) { index++; charsAdded++; } } } #endif if (code == TCL_OK) { AdjustIndices(entryPtr, index, charsAdded); code = EntrySetValue(entryPtr, newBytes); } else if (code == TCL_BREAK) { code = TCL_OK; } |
︙ | |||
877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | int index, /* Index of first character to delete. */ int count) /* How many characters to delete. */ { char *string = entryPtr->entry.string; size_t byteIndex, byteCount, newByteCount; char *newBytes; int code; #if TCL_UTF_MAX < 4 Tcl_UniChar ch; int len; const char *prevPtr, *nextPtr; #endif if (index < 0) { index = 0; } if (count + index > entryPtr->entry.numChars) { count = entryPtr->entry.numChars - index; } if (count <= 0) { return TCL_OK; } byteIndex = Tcl_UtfAtIndex(string, index) - string; #if TCL_UTF_MAX < 4 /* * Delete complete surrogate pairs. */ Tcl_UtfToUniChar(string + byteIndex, &ch); if ((ch & 0xFC00) == 0xDC00) { prevPtr = Tcl_UtfPrev(string + byteIndex, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xFC00) == 0xD800) { byteIndex = prevPtr - string; count++; index--; } } else if ((count == 1) && ((ch & 0xFC00) == 0xD800)) { nextPtr = Tcl_UtfNext(string + byteIndex); Tcl_UtfToUniChar(nextPtr, &ch); if ((ch & 0xFC00) == 0xDC00) { count++; } } if (count > entryPtr->entry.numChars - index) { count = entryPtr->entry.numChars - index; } #endif byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex); #if TCL_UTF_MAX < 4 if (byteCount) { len = Tcl_UtfToUniChar(string + byteIndex + byteCount, &ch); if ((ch & 0xFC00) == 0xDC00) { prevPtr = Tcl_UtfPrev(string + byteIndex + byteCount, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xFC00) == 0xD800) { byteCount += len; count++; } } } #endif newByteCount = entryPtr->entry.numBytes + 1 - byteCount; newBytes = (char *) ckalloc(newByteCount); memcpy(newBytes, string, byteIndex); strcpy(newBytes + byteIndex, string + byteIndex + byteCount); code = EntryValidateChange( |
︙ | |||
1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 | + + + + | Entry *entryPtr, /* Entry widget to query */ Tcl_Obj *indexObj, /* Symbolic index name */ int *indexPtr) /* Return value */ { # define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */ const char *string = Tcl_GetString(indexObj); size_t length = indexObj->length; int roundUp = 0; #if TCL_UTF_MAX < 4 int oldPos = entryPtr->entry.insertPos; #endif if (strncmp(string, "end", length) == 0) { *indexPtr = entryPtr->entry.numChars; } else if (strncmp(string, "insert", length) == 0) { *indexPtr = entryPtr->entry.insertPos; } else if (strncmp(string, "left", length) == 0) { /* for debugging */ *indexPtr = entryPtr->entry.xscroll.first; |
︙ | |||
1414 1415 1416 1417 1418 1419 1420 | 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 | - | *indexPtr = entryPtr->entry.selectFirst; } else if (strncmp(string, "sel.last", length) == 0) { *indexPtr = entryPtr->entry.selectLast; } else { goto badIndex; } } else if (string[0] == '@') { |
︙ | |||
1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 | 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | goto badIndex; } if (*indexPtr < 0) { *indexPtr = 0; } else if (*indexPtr > entryPtr->entry.numChars) { *indexPtr = entryPtr->entry.numChars; } #if TCL_UTF_MAX < 4 roundUp = (indexPtr == &entryPtr->entry.insertPos) && (*indexPtr == (oldPos + 1)); #endif } #if TCL_UTF_MAX < 4 /* * Enforce index on start or end of surrogate pair. */ if (*indexPtr) { int byteIndex; Tcl_UniChar ch; const char *prevPtr; string = entryPtr->entry.string; byteIndex = Tcl_UtfAtIndex(string, *indexPtr) - string; Tcl_UtfToUniChar(string + byteIndex, &ch); if ((ch & 0xFC00) == 0xDC00) { if (roundUp) { *indexPtr += 1; } else { prevPtr = Tcl_UtfPrev(string + byteIndex, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xFC00) == 0xD800) { *indexPtr -= 1; } } } } #endif return TCL_OK; badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad entry index \"%s\"", string)); Tcl_SetErrorCode(interp, "TTK", "ENTRY", "INDEX", NULL); return TCL_ERROR; |
︙ |
Changes to jni/sdl2tk/library/entry.tcl.
︙ | |||
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - | bind Entry <B1-Motion> { set tk::Priv(x) %x tk::EntryMouseSelect %W %x } bind Entry <Double-1> { set tk::Priv(selectMode) word tk::EntryMouseSelect %W %x |
︙ | |||
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | + + + + + + + + + + + | } } } word { if {$cur < $anchor} { set before [tcl_wordBreakBefore [$w get] $cur] set after [tcl_wordBreakAfter [$w get] $anchor-1] set icur before } elseif {$cur > $anchor} { set before [tcl_wordBreakBefore [$w get] $anchor] set after [tcl_wordBreakAfter [$w get] $cur-1] set icur after } else { if {[$w index @$Priv(pressX)] < $anchor} { incr anchor -1 } set before [tcl_wordBreakBefore [$w get] $anchor] set after [tcl_wordBreakAfter [$w get] $anchor] set icur after } if {$before < 0} { set before 0 } if {$after < 0} { set after end } $w selection range $before $after if {$icur eq "after"} { $w icursor end $w icursor $after } else { $w icursor 0 $w icursor $before } set Priv(mouseMoved) 0 } line { $w selection range 0 end } } if {$Priv(mouseMoved)} { $w icursor $cur |
︙ |
Changes to jni/sdl2tk/library/spinbox.tcl.
︙ | |||
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | + + + + + + + + + + + | } } } word { if {$cur < [$w index anchor]} { set before [tcl_wordBreakBefore [$w get] $cur] set after [tcl_wordBreakAfter [$w get] $anchor-1] set icur before } else { set before [tcl_wordBreakBefore [$w get] $anchor] set after [tcl_wordBreakAfter [$w get] $cur-1] set icur after } if {$before < 0} { set before 0 } if {$after < 0} { set after end } $w selection range $before $after if {$icur eq "after"} { $w icursor end $w icursor $after } else { $w icursor 0 $w icursor $before } set Priv(mouseMoved) 0 set cursor ignore } line { $w selection range 0 end } } if {$cursor ne {} && $cursor ne "ignore"} { catch {$w icursor $cursor} |
︙ |
Changes to jni/sdl2tk/library/ttk/entry.tcl.
︙ | |||
310 311 312 313 314 315 316 317 318 319 320 321 322 323 | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | + + + + + + + + | } return $pos } ## RelIndex -- Compute character/word/line-relative index. # proc ttk::entry::RelIndex {w where {index insert}} { if {$index eq "insert" && $where eq "nextchar"} { # Needed for surrogate pairs: set icur [$w index insert] $w icursor [expr {$icur + 1}] set ret [expr {[$w index insert]}] $w icursor $icur return $ret } switch -- $where { prevchar { expr {[$w index $index] - 1} } nextchar { expr {[$w index $index] + 1} } prevword { PrevWord $w $index } nextword { NextWord $w $index } home { return 0 } end { $w index end } |
︙ |
Changes to jni/sdl2tk/macosx/tkMacOSXBitmap.c.
︙ | |||
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | 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 | + + + + + - + + + - + + + - + + - + + - + + + - + + + | int *height) { Tcl_HashEntry *hPtr; Pixmap pixmap = None; NSString *string; NSImage *image = nil; NSSize size = { .width = builtInIconSize, .height = builtInIconSize }; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_DStringInit(&ds); if (iconBitmapTable.buckets && (hPtr = Tcl_FindHashEntry(&iconBitmapTable, name))) { OSType type; IconBitmap *iconBitmap = (IconBitmap *) Tcl_GetHashValue(hPtr); name = NULL; size = NSMakeSize(iconBitmap->width, iconBitmap->height); switch (iconBitmap->kind) { case ICON_FILE: name = Tcl_UtfToExternalDString(utf8, iconBitmap->value, -1, &ds); |
︙ | |||
315 316 317 318 319 320 321 322 323 324 325 326 327 328 | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | + + | NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFileType: iconUTI]; pixmap = PixmapFromImage(display, iconImage, NSSizeToCGSize(size)); } } *width = (int) size.width; *height = (int) size.height; Tcl_DStringFree(&ds); Tcl_FreeEncoding(utf8); return pixmap; } /* *---------------------------------------------------------------------- * * TkMacOSXIconBitmapObjCmd -- |
︙ |
Changes to jni/sdl2tk/macosx/tkMacOSXCursor.c.
︙ | |||
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | + + + + | const char *name) { NSString *path = nil; NSImage *image = nil; NSPoint hotSpot = NSZeroPoint; int haveHotSpot = 0, result = TCL_ERROR; NSCursor *macCursor = nil; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); name = Tcl_UtfToExternalDString(utf8, name, -1, &ds); if (name[0] == '@') { /* * System cursor of type @filename */ macCursorPtr->type = IMAGEPATH; path = [NSString stringWithUTF8String:&name[1]]; |
︙ | |||
350 351 352 353 354 355 356 357 358 359 360 361 362 363 | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | + + | hotSpot.y = size.height * 0.5; } hotSpot.y = -hotSpot.y; macCursor = [[NSCursor alloc] initWithImage:image hotSpot:hotSpot]; [image release]; } macCursorPtr->macCursor = macCursor; Tcl_DStringFree(&ds); Tcl_FreeEncoding(utf8); } /* *---------------------------------------------------------------------- * * TkGetCursorByName -- * |
︙ |
Changes to jni/sdl2tk/macosx/tkMacOSXDialog.c.
︙ | |||
217 218 219 220 221 222 223 224 225 226 227 228 | 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 | + + + + + - + + + + + - + + + + | returnCode: (NSModalResponse) returnCode contextInfo: (void *) contextInfo { FilePanelCallbackInfo *callbackInfo = (FilePanelCallbackInfo *) contextInfo; if (returnCode == modalOK) { Tcl_Obj *resultObj; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); if (callbackInfo->multiple) { resultObj = Tcl_NewListObj(0, NULL); for (NSURL *url in [(NSOpenPanel*)panel URLs]) { Tcl_ExternalToUtfDString(utf8, [[url path] UTF8String], -1, &ds); Tcl_ListObjAppendElement(callbackInfo->interp, resultObj, |
︙ | |||
454 455 456 457 458 459 460 | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | + + + + + - + + + | colorPanel = [NSColorPanel sharedColorPanel]; [colorPanel orderOut:NSApp]; [colorPanel setContinuous:NO]; [colorPanel setBecomesKeyOnlyIfNeeded:NO]; [colorPanel setShowsAlpha: NO]; [colorPanel _setUseModalAppearance:YES]; if (title) { NSString *s; Tcl_Encoding utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_DString ds; title = Tcl_ExternalToUtfDString(utf8, title, -1, &ds); |
︙ | |||
498 499 500 501 502 503 504 505 506 507 508 509 510 | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | + - + + + + + + - + + + + + + + - - + + - - + + + + - + + | static int parseFileFilters( Tcl_Interp *interp, Tcl_Obj *fileTypesPtr, Tcl_Obj *typeVariablePtr) { FileFilterList fl; if (!fileTypesPtr) { filterInfo.doFileTypes = false; return TCL_OK; } |
︙ | |||
594 595 596 597 598 599 600 | 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 | - - + + + + + - - + - - + + + | typeVariablePtr, NULL, TCL_GLOBAL_ONLY); /* * Check that the typevariable exists. */ if (selectedFileTypeObj != NULL) { |
︙ | |||
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | + + + + + + + + + + - - + + + + - - + + | Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; NSString *directory = nil, *filename = nil; NSString *message = nil, *title = nil; NSWindow *parent; openpanel = [NSOpenPanel openPanel]; NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_DStringInit(&ds); for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], openOptionStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { goto end; } if (i + 1 == objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL); goto end; } switch (index) { case OPEN_DEFAULT: break; case OPEN_FILETYPES: fileTypesPtr = objv[i + 1]; break; case OPEN_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { str = Tcl_UtfToExternalDString(utf8, str, -1, &ds); directory = [[[NSString alloc] initWithUTF8String:str] autorelease]; Tcl_DStringFree(&ds); } break; case OPEN_INITFILE: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { str = Tcl_UtfToExternalDString(utf8, str, -1, &ds); filename = [[[NSString alloc] initWithUTF8String:str] autorelease]; Tcl_DStringFree(&ds); } break; case OPEN_MESSAGE: str = Tcl_UtfToExternalDString(utf8, Tcl_GetString(objv[i + 1]), -1, &ds); |
︙ | |||
899 900 901 902 903 904 905 906 | 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | + + - - + + + + | if (j == selectedFilterIndex) { selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; } } } Tcl_DStringFree(&ds); Tcl_ExternalToUtfDString(utf8, [selectedFilter UTF8String], -1, &ds); Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, |
︙ | |||
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | 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 | + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; NSString *directory = nil, *filename = nil, *defaultType = nil; NSString *message = nil, *title = nil; NSWindow *parent; savepanel = [NSSavePanel savePanel]; NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_DStringInit(&ds); for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], saveOptionStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { goto end; } if (i + 1 == objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL); goto end; } switch (index) { |
︙ | |||
1139 1140 1141 1142 1143 1144 1145 1146 | 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 | + + - + - - - + + + + | if (typeVariablePtr && (modalReturnCode == NSOKButton) && filterInfo.doFileTypes) { /* * The -typevariable must be set to the selected file type, if the * dialog was not cancelled. */ NSString *selectedFilter = [filterInfo.fileTypeNames objectAtIndex:filterInfo.fileTypeIndex]; Tcl_DStringFree(&ds); |
︙ | |||
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 | 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | + + + + + + - - + + + + - - + + + + | Tcl_Obj *cmdObj = NULL; NSString *directory = nil; NSString *message, *title; NSWindow *parent; NSOpenPanel *panel = [NSOpenPanel openPanel]; NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_DStringInit(&ds); for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], chooseOptionStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { goto end; } if (i + 1 == objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "DIRDIALOG", "VALUE", NULL); goto end; } switch (index) { case CHOOSE_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { str = Tcl_UtfToExternalDString(utf8, str, -1, &ds); directory = [[[NSString alloc] initWithUTF8String:str] autorelease]; Tcl_DStringFree(&ds); } break; case CHOOSE_MESSAGE: |
︙ | |||
1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | + + | Tcl_DecrRefCount(cmdObj); } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } end: Tcl_DStringFree(&ds); Tcl_FreeEncoding(utf8); return result; } /* *---------------------------------------------------------------------- * * TkAboutDlg -- |
︙ | |||
1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 | 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 | + + + + | AlertCallbackInfo callbackInfo; NSString *message, *title; NSWindow *parent; NSArray *buttons; NSAlert *alert = [NSAlert new]; NSInteger modalReturnCode = 1; BOOL parentIsKey = NO; Tcl_Encoding utf8; Tcl_DString ds; iconIndex = ICON_INFO; typeIndex = TYPE_OK; utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_DStringInit(&ds); for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], alertOptionStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { goto end; } if (i + 1 == objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | |||
1453 1454 1455 1456 1457 1458 1459 | 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 | - - + + + + - - + + + + - - + + + + | * know the '-type' as well. */ indexDefaultOption = i; break; case ALERT_DETAIL: |
︙ |
Changes to jni/sdl2tk/macosx/tkMacOSXFont.c.
︙ | |||
117 118 119 120 121 122 123 | 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 | - + - - - + + + + + + + - + + + - - - - - - - - - - - - | * None. * *--------------------------------------------------------------------------- */ #if TCL_UTF_MAX == 3 |
︙ | |||
217 218 219 220 221 222 223 | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | - + | while (src < end && index > 0) { --index; if (Tcl_UtfCharComplete(src, end - src)) { src += Tcl_UtfToUniChar(src, &ch); } else { ch = *src++ & 0x00FF; } |
︙ | |||
255 256 257 258 259 260 261 | 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 | - + - - - + - - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + | const char *src, /* Input UTF-8 string to be converted. * Need not be '\0' terminated. */ int numBytes, /* Maximum number of bytes to consider from * source string in all. */ Tcl_DString *dsPtr, /* Tcl_DString receiving the result. */ int *lengthPtr) /* Number of UTF16Chars in result buffer. */ { |
︙ | |||
325 326 327 328 329 330 331 332 | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | + + + + - + + + | static void GetTkFontAttributesForNSFont( NSFont *nsFont, TkFontAttributes *faPtr) { NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_ExternalToUtfDString(utf8, [[nsFont familyName] UTF8String], -1, &ds); |
︙ | |||
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | + + + + + + + | { NSFontManager *fm = [NSFontManager sharedFontManager]; NSFont *nsFont, *dflt = nil; #define defaultFont (dflt ? dflt : (dflt = [NSFont systemFontOfSize:0])) NSString *family; if (familyName) { Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); familyName = Tcl_UtfToExternalDString(utf8, familyName, -1, &ds); family = [[[NSString alloc] initWithUTF8String:familyName] autorelease]; Tcl_DStringFree(&ds); Tcl_FreeEncoding(utf8); } else { family = [defaultFont familyName]; } if (size == 0.0) { size = [defaultFont pointSize]; } nsFont = [fm fontWithFamily:family traits:traits weight:weight size:size]; |
︙ | |||
822 823 824 825 826 827 828 829 830 831 | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | + + + + - + + + + | void TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ Tk_Window tkwin) /* For display to query. */ { Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies]; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); for (NSString *family in list) { Tcl_ExternalToUtfDString(utf8, [family UTF8String], -1, &ds); Tcl_ListObjAppendElement(NULL, resultPtr, |
︙ | |||
859 860 861 862 863 864 865 866 867 868 869 870 871 | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | + + + + - + + + + | { MacFont *fontPtr = (MacFont *) tkfont; Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); if (fontPtr->nsFont) { NSArray *list = [[fontPtr->nsFont fontDescriptor] objectForKey:NSFontCascadeListAttribute]; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); for (NSFontDescriptor *subFontDesc in list) { NSString *family = [subFontDesc objectForKey:NSFontFamilyAttribute]; if (family) { Tcl_ExternalToUtfDString(utf8, [family UTF8String], -1, &ds); Tcl_ListObjAppendElement(NULL, resultPtr, |
︙ | |||
1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 | 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 | + + + + + + | if (nsFont && familyName) { NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; id underline = [nsAttributes objectForKey: NSUnderlineStyleAttributeName]; id strikethrough = [nsAttributes objectForKey: NSStrikethroughStyleAttributeName]; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); familyName = Tcl_ExternalToUtfDString(utf8, familyName, -1, &ds); objv[i++] = Tcl_NewStringObj(familyName, -1); Tcl_DStringFree(&ds); Tcl_FreeEncoding(utf8); objv[i++] = Tcl_NewWideIntObj((Tcl_WideInt) floor([nsFont pointSize] + 0.5)); #define S(s) Tcl_NewStringObj(STRINGIFY(s),(int)(sizeof(STRINGIFY(s))-1)) objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal); objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman); if ([underline respondsToSelector:@selector(intValue)] && ([underline intValue] & (NSUnderlineStyleSingle | NSUnderlineStyleThick | NSUnderlineStyleDouble))) { |
︙ |
Changes to jni/sdl2tk/macosx/tkMacOSXInit.c.
︙ | |||
219 220 221 222 223 224 225 226 | 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 | + + + + + + - - + + + + - + - + + + | } } - (NSString *) tkFrameworkImagePath: (NSString *) image { NSString *path = nil; NSAutoreleasePool *pool = [NSAutoreleasePool new]; Tcl_Encoding utf8; Tcl_DString ds; char *str; utf8 = Tcl_GetEncoding(NULL, "utf-8"); if (tkLibPath[0] != '\0') { str = Tcl_UtfToExternalDString(utf8, tkLibPath, -1, &ds); |
︙ | |||
790 791 792 793 794 795 796 797 798 | 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 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | + + + + - + + - - + + - - - + + + + + + + + + + + + | MODULE_SCOPE Tcl_Obj* TkMacOSXGetStringObjFromCFString( CFStringRef str) { Tcl_Obj *obj = NULL; const char *c = CFStringGetCStringPtr(str, kCFStringEncodingUTF8); Tcl_Encoding utf8; Tcl_DString ds, buffer; utf8 = Tcl_GetEncoding(NULL, "utf-8"); if (c) { c = Tcl_ExternalToUtfDString(utf8, c, -1, &ds); |
Changes to jni/sdl2tk/macosx/tkMacOSXKeyEvent.c.
︙ | |||
329 330 331 332 333 334 335 | 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 | - + - - - - - - - + + - - - - - - | Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr; TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL); } /* * NSString represents a non-BMP character as a string of length 2 where * the first character is the high surrogate and the second character is |
︙ |
Changes to jni/sdl2tk/macosx/tkMacOSXMenu.c.
︙ | |||
147 148 149 150 151 152 153 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | - - + + + + + + + + + | [self setDelegate:self]; } return self; } - (id) initWithTkMenu: (TkMenu *) tkMenu { |
︙ | |||
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 661 | + + + + + + - - + + + + | /* Use a semantic foreground color by default. */ [image setTemplate:YES]; } } [menuItem setImage:image]; if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr && mePtr->labelLength) { Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_UtfToExternalDString(utf8, Tcl_GetString(mePtr->labelPtr), mePtr->labelLength, &ds); |
︙ | |||
1178 1179 1180 1181 1182 1183 1184 | 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | + + + + + + - - + + + + + | } i++; } } if (ch) { return [[[NSString alloc] initWithCharacters:&ch length:1] autorelease]; } else { NSString *result; Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); accel = Tcl_UtfToExternalDString(utf8, accel, -1, &ds); |
︙ |
Changes to jni/sdl2tk/macosx/tkMacOSXSysTray.c.
︙ | |||
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | + + + + - + + + | */ int width, height; Tk_Window tkwin = Tk_MainWindow(interp); TkWindow *winPtr = (TkWindow *)tkwin; Display *d = winPtr->display; NSImage *icon; Tcl_Encoding utf8; Tcl_DString ds; tk_image = Tk_GetImage(interp, tkwin, Tcl_GetString(objv[2]), NULL, NULL); if (tk_image == NULL) { return TCL_ERROR; } Tk_SizeOfImage(tk_image, &width, &height); if (width != 0 && height != 0) { icon = TkMacOSXGetNSImageWithTkImage(d, tk_image, width, height); [statusItem setImagewithImage: icon]; Tk_FreeImage(tk_image); } /* * Set the text for the tooltip. */ utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_UtfToExternalDString(utf8, Tcl_GetString(objv[3]), -1, &ds); |
︙ | |||
638 639 640 641 642 643 644 | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | + + + + + - + + + | } /* * Modify the text for the tooltip. */ case TRAY_TEXT: { Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_UtfToExternalDString(utf8, Tcl_GetString(objv[3]), -1, &ds); |
︙ | |||
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | + + + + + - - + + + + + + | static int SysNotifyObjCmd( ClientData clientData, Tcl_Interp * interp, int objc, Tcl_Obj *const *objv) { Tcl_Encoding utf8; Tcl_DString ds; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "title message"); return TCL_ERROR; } if ([NSApp macOSVersion] < 101000) { Tcl_AppendResult(interp, "Notifications not supported on macOS versions lower than 10.10", NULL); return TCL_OK; } utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_UtfToExternalDString(utf8, Tcl_GetString(objv[1]), -1, &ds); |
︙ |
Changes to jni/sdl2tk/macosx/tkMacOSXWm.c.
︙ | |||
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 | 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 | + + + + + + + | } break; case WMATT_TITLEPATH: { const char *path = (const char *) Tcl_FSGetNativePath(value); NSString *filename = @""; if (path && *path) { Tcl_Encoding utf8; Tcl_DString ds; utf8 = Tcl_GetEncoding(NULL, "utf-8"); path = Tcl_UtfToExternalDString(utf8, path, -1, &ds); filename = [NSString stringWithUTF8String:path]; Tcl_DStringFree(&ds); Tcl_FreeEncoding(utf8); } [macWindow setRepresentedFilename:filename]; break; } case WMATT_TOPMOST: if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) { return TCL_ERROR; |
︙ | |||
1506 1507 1508 1509 1510 1511 1512 | 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 | - - - + + + + + + + + + + + + | break; case WMATT_MODIFIED: result = Tcl_NewBooleanObj([macWindow isDocumentEdited]); break; case WMATT_NOTIFY: result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal); break; |
︙ | |||
5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 | 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 | + + + + + + - + + + | */ void TkSetWMName( TkWindow *winPtr, Tk_Uid titleUid) { Tcl_Encoding utf8; Tcl_DString ds; char *tStr; if (Tk_IsEmbedded(winPtr)) { return; } utf8 = Tcl_GetEncoding(NULL, "utf-8"); tStr = Tcl_UtfToExternalDString(utf8, (const char *) titleUid, -1, &ds); |
︙ |
Changes to jni/sdl2tk/sdl/SdlTkInt.c.
︙ | |||
828 829 830 831 832 833 834 | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | - + + + + + + + + + + + + + + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + | return 0; } static int ProcessTextInput(XEvent *event, int no_rel, int sdl_mod, const char *text, int len) { |
︙ |
Changes to jni/sdl2tk/sdl/SdlTkInt.h.
︙ | |||
203 204 205 206 207 208 209 | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | - | int nearby_pixels; TkWindow *capture_window; _Window *mouse_window; _Window *keyboard_window; int mouse_x, mouse_y; int raw_mouse_x, raw_mouse_y; int sdlfocus; |
︙ |
Changes to jni/sdl2tk/sdl/SdlTkUtils.c.
︙ | |||
653 654 655 656 657 658 659 660 661 662 663 664 665 | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | + - + + + + + + + + + + + + + + | wSrcStart = (unsigned int *) src; wSrcEnd = (unsigned int *) (src + srcLen); dstStart = dst; dstEnd = dst + dstLen - TCL_UTF_MAX; for (numChars = 0; wSrc < wSrcEnd; numChars++) { int uch; Tcl_UniChar ch; if (dst > dstEnd) { result = TCL_CONVERT_NOSPACE; break; } |
︙ | |||
730 731 732 733 734 735 736 | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | + - + - + + + + + + + + + + + - - - - + + + + - + | wDst = (unsigned int *) dst; wDstStart = (unsigned int *) dst; wDstEnd = (unsigned int *) (dst + dstLen - sizeof (unsigned int)); result = TCL_OK; for (numChars = 0; src < srcEnd; numChars++) { int ch, len; |
︙ |
Changes to jni/sdl2tk/sdl/tkSDLFont.c.
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - - - - - | * character existence metrics, used to determine if a screen font can display * a given Unicode character. * * Under Unix, there are three attributes that uniquely identify a "font * family": the foundry, face name, and charset. */ |
︙ | |||
88 89 90 91 92 93 94 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | - - - - | } SubFont; /* * The following structure represents Unix's implementation of a font object. */ #define SUBFONT_SPACE 3 |
︙ | |||
365 366 367 368 369 370 371 | 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 | - - + - - - - - + - | int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { const char *srcStart, *srcEnd; char *dstStart, *dstEnd; unsigned int *wDst; |
︙ | |||
430 431 432 433 434 435 436 | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | - - - - - - - - - | wDst[4] = hexChars[(ch >> 20) & 0xf]; wDst[5] = hexChars[(ch >> 16) & 0xf]; wDst[6] = hexChars[(ch >> 12) & 0xf]; wDst[7] = hexChars[(ch >> 8) & 0xf]; wDst[8] = hexChars[(ch >> 4) & 0xf]; wDst[9] = hexChars[ch & 0xf]; wDst += 10; |
︙ | |||
880 881 882 883 884 885 886 | 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | - + - + | lastSubFontPtr = &fontPtr->subFontArray[0]; if (numBytes == 0) { curX = 0; curByte = 0; } else if (maxLength < 0) { const char *p, *end, *next; |
︙ | |||
936 937 938 939 940 941 942 | 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 | - + - - + | if (lastSubFontPtr == &fontPtr->controlSubFont) { SdlTkFontRestore(lastSubFontPtr->fontStructPtr, fontSize); } Tcl_DStringFree(&runString); curByte = numBytes; } else { const char *p, *end, *next, *term; |
︙ | |||
993 994 995 996 997 998 999 | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | - + | p = next; if (p >= end) { term = end; termX = curX; break; } |
︙ | |||
1018 1019 1020 1021 1022 1023 1024 | 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | - + - + | /* * Include the first character that didn't quite fit in the * desired span. The width returned will include the width of that * extra character. */ curX = newX; |
︙ | |||
1136 1137 1138 1139 1140 1141 1142 | 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | - + - | int x, int y) /* Coordinates at which to place origin of * string when drawing. */ { UnixFont *fontPtr = (UnixFont *) tkfont; SubFont *thisSubFontPtr, *lastSubFontPtr; Tcl_DString runString; const char *p, *end, *next; |
︙ | |||
1160 1161 1162 1163 1164 1165 1166 | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | - + | } else { window_width = width; } end = source + numBytes; for (p = source; p <= end; ) { if (p < end) { |
︙ | |||
2136 2137 2138 2139 2140 2141 2142 | 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 | - + | } end = (row + 1) << FONTMAP_SHIFT; for (i = row << FONTMAP_SHIFT; i < end; i++) { if ((i >= 0xD800) && (i <= 0xDFFF)) { continue; } |
︙ | |||
2895 2896 2897 2898 2899 2900 2901 | 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 | - + - - + | if (angle == 0.0) { Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y); } else { UnixFont *fontPtr = (UnixFont *) tkfont; SubFont *thisSubFontPtr, *lastSubFontPtr; Tcl_DString runString; const char *p, *end, *next; |
︙ |
Changes to jni/sdl2tk/sdl/tkSDLMenu.c.
︙ | |||
855 856 857 858 859 860 861 | 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | - - + | { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; len = Tcl_GetCharLength(mePtr->labelPtr); if (mePtr->underline < len) { int activeBorderWidth, leftEdge; |
︙ |
Changes to jni/sdl2tk/unix/tkUnixFont.c.
︙ | |||
31 32 33 34 35 36 37 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - - - - - | * character existence metrics, used to determine if a screen font can display * a given Unicode character. * * Under Unix, there are three attributes that uniquely identify a "font * family": the foundry, face name, and charset. */ |
︙ | |||
406 407 408 409 410 411 412 | 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 430 431 432 433 434 435 | - - + - + | * the conversion. */ int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { const char *srcStart, *srcEnd; char *dstStart, *dstEnd; |
︙ | |||
590 591 592 593 594 595 596 | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | - + | * the conversion. */ int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd; int result, numChars; |
︙ | |||
1017 1018 1019 1020 1021 1022 1023 | 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 | - + - - + | * means return at least one character even if * no characters fit. */ int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { UnixFont *fontPtr; SubFont *lastSubFontPtr; |
︙ | |||
1089 1090 1091 1092 1093 1094 1095 | 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | - - + | Tcl_DStringLength(&runString)); } Tcl_DStringFree(&runString); curByte = numBytes; } else { const char *p, *end, *next, *term; int newX, termX, sawNonSpace, dstWrote; |
︙ | |||
1134 1135 1136 1137 1138 1139 1140 | 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | - + | p = next; if (p >= end) { term = end; termX = curX; break; } |
︙ | |||
1159 1160 1161 1162 1163 1164 1165 | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 | - + - + | /* * Include the first character that didn't quite fit in the * desired span. The width returned will include the width of that * extra character. */ curX = newX; |
︙ | |||
1276 1277 1278 1279 1280 1281 1282 | 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | - + - | int x, int y) /* Coordinates at which to place origin of * string when drawing. */ { UnixFont *fontPtr = (UnixFont *) tkfont; SubFont *thisSubFontPtr, *lastSubFontPtr; Tcl_DString runString; const char *p, *end, *next; |
︙ | |||
1312 1313 1314 1315 1316 1317 1318 | 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | - + | window_width = 32768; #endif end = source + numBytes; needWidth = fontPtr->font.fa.underline + fontPtr->font.fa.overstrike; for (p = source; p <= end; ) { if (p < end) { |
︙ | |||
2248 2249 2250 2251 2252 2253 2254 | 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 | - + | static void FontMapLoadPage( SubFont *subFontPtr, /* Contains font mapping cache to be * updated. */ int row) /* Index of the page to be loaded into the * cache. */ { |
︙ | |||
2286 2287 2288 2289 2290 2291 2292 | 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 | - + | } } end = (row + 1) << FONTMAP_SHIFT; for (i = row << FONTMAP_SHIFT; i < end; i++) { int hi, lo; |
︙ | |||
2452 2453 2454 2455 2456 2457 2458 | 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 | - + | { int i, nameIdx, numNames, srcLen, numEncodings, bestIdx[2]; Tk_Uid hateFoundry; const char *charset, *hateCharset; unsigned bestScore[2]; char **nameList; char **nameListOrig; |
︙ | |||
2482 2483 2484 2485 2486 2487 2488 | 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 | - + | display = fontPtr->display; nameList = ListFonts(display, faceName, &numNames); if (numNames == 0) { return NULL; } nameListOrig = nameList; |
︙ |
Changes to jni/sdl2tk/unix/tkUnixKey.c.
︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | 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 179 180 181 182 183 184 185 186 187 188 189 190 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | #ifdef TK_USE_INPUT_METHODS if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM) && (winPtr->dispPtr->inputContext != NULL) && (eventPtr->type == KeyPress)) { Status status; #if X_HAVE_UTF8_STRING #if TCL_UTF_MAX < 4 /* * We want WTF-8 here. */ Tcl_DStringInit(&buf); Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1); len = Xutf8LookupString(winPtr->dispPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf), &kePtr->keysym, &status); if (status == XBufferOverflow) { /* * Expand buffer and try again. */ Tcl_DStringSetLength(&buf, len); len = Xutf8LookupString(winPtr->dispPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf), &kePtr->keysym, &status); } Tcl_DStringSetLength(&buf, len); if ((status != XLookupChars) && (status != XLookupBoth)) { len = 0; } else { Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "utf-8"); Tcl_ExternalToUtfDString(encoding, Tcl_DStringValue(&buf), len, dsPtr); len = Tcl_DStringLength(dsPtr); if (encoding) { Tcl_FreeEncoding(encoding); } } Tcl_DStringFree(&buf); #else Tcl_DStringSetLength(dsPtr, TCL_DSTRING_STATIC_SIZE-1); len = Xutf8LookupString(winPtr->dispPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr), &kePtr->keysym, &status); if (status == XBufferOverflow) { |
︙ | |||
161 162 163 164 165 166 167 168 169 170 171 172 173 174 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | + | Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr), &kePtr->keysym, &status); } if ((status != XLookupChars) && (status != XLookupBoth)) { len = 0; } Tcl_DStringSetLength(dsPtr, len); #endif #else /* !X_HAVE_UTF8_STRING */ /* * Overallocate the dstring to the maximum stack amount. */ Tcl_DStringInit(&buf); Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1); |
︙ |
Changes to jni/sdl2tk/unix/tkUnixMenu.c.
︙ | |||
855 856 857 858 859 860 861 | 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | - - + | { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; len = Tcl_GetCharLength(mePtr->labelPtr); if (mePtr->underline < len) { int activeBorderWidth, leftEdge; |
︙ |
Changes to jni/sdl2tk/unix/tkUnixRFont.c.
︙ | |||
159 160 161 162 163 164 165 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | - + - + | Tcl_RegisterConfig(mainPtr->interp, "tk", cfg, "utf-8"); #endif } static XftFont * GetFont( UnixFtFont *fontPtr, |
︙ | |||
756 757 758 759 760 761 762 | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | - - - + | Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ { UnixFtFont *fontPtr = (UnixFtFont *) tkfont; /* Structure describing the logical font */ |
︙ | |||
807 808 809 810 811 812 813 | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | - + - + - - - - - - - - + - - - - - + - - - - + | handler = Tk_CreateErrorHandler(fontPtr->display, -1, -1, -1, InitFontErrorProc, &errorFlag); curX = 0; curByte = 0; sawNonSpace = 0; while (numBytes > 0) { |
︙ | |||
1043 1044 1045 1046 1047 1048 1049 | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | - + - - + + - - - - + - | xftcolor = LookUpColor(display, fontPtr, values.foreground); if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; while (numBytes > 0) { XftFont *ftFont; |
︙ | |||
1092 1093 1094 1095 1096 1097 1098 | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | - | } if (nspec) { LOCK; XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); UNLOCK; } |
︙ | |||
1188 1189 1190 1191 1192 1193 1194 | 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | - + - - + + - - - - + - | nglyph = 0; currentFtFont = NULL; originX = originY = 0; while (numBytes > 0) { XftFont *ftFont; |
︙ | |||
1286 1287 1288 1289 1290 1291 1292 | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | - + - - + + - - - - + - | xftcolor = LookUpColor(display, fontPtr, values.foreground); if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; while (numBytes > 0) { XftFont *ftFont, *ft0Font; |
︙ | |||
1337 1338 1339 1340 1341 1342 1343 | 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 | - | if (nspec) { LOCK; XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); UNLOCK; } #endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */ |
︙ |
Changes to jni/sdl2tk/unix/tkUnixSelect.c.
︙ | |||
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 661 662 663 664 | 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 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | + + + + + + + + + + + + + + + + + + | /* * The X selection data is in UTF-8 format already. We can't * guarantee that propInfo is NULL-terminated, so we might have to * copy the string. */ char *propData = propInfo; #if TCL_UTF_MAX < 4 Tcl_Encoding encoding; #endif if (format != 8) { Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf( "bad format for string selection: wanted \"8\", got \"%d\"", format)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT", NULL); retrPtr->result = TCL_ERROR; return; } if (propInfo[numItems] != '\0') { propData = (char *) ckalloc(numItems + 1); strcpy(propData, propInfo); propData[numItems] = '\0'; } interp = retrPtr->interp; Tcl_Preserve(interp); #if TCL_UTF_MAX < 4 encoding = Tcl_GetEncoding(NULL, "utf-8"); Tcl_ExternalToUtfDString(encoding, propInfo, (int)numItems, &ds); if (encoding) { Tcl_FreeEncoding(encoding); } retrPtr->result = retrPtr->proc(retrPtr->clientData, retrPtr->interp, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); #else retrPtr->result = retrPtr->proc(retrPtr->clientData, retrPtr->interp, propData); #endif Tcl_Release(interp); if (propData != propInfo) { ckfree(propData); } } else if (type == dispPtr->incrAtom) { /* * It's a !?#@!?!! INCR-style reception. Arrange to receive the |
︙ | |||
967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | 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 | + + + + + + + + + + + + + + + + + + + | propPtr = (char *) buffer; format = 32; incr.converts[i].offset = 0; XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, format, PropModeReplace, (unsigned char *) propPtr, numItems); } else if (type == winPtr->dispPtr->utf8Atom) { #if TCL_UTF_MAX > 3 /* * This matches selection requests of type UTF8_STRING, which * allows us to pass our utf-8 information untouched. */ XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, 8, PropModeReplace, (unsigned char *) buffer, numItems); #else /* * Must ensure not to export WTF-8 here. */ Tcl_DString ds; Tcl_Encoding encoding; encoding = Tcl_GetEncoding(NULL, "utf-8"); Tcl_UtfToExternalDString(encoding, (char *) buffer, -1, &ds); XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, 8, PropModeReplace, (unsigned char *) Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); if (encoding) { Tcl_FreeEncoding(encoding); } Tcl_DStringFree(&ds); #endif } else if ((type == XA_STRING) || (type == winPtr->dispPtr->compoundTextAtom)) { Tcl_DString ds; Tcl_Encoding encoding; /* * STRING is Latin-1, COMPOUND_TEXT is an iso2022 variant. We need |
︙ |
Changes to jni/sdl2tk/unix/tkUnixWm.c.
︙ | |||
5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 | 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 | + + + + - + + - + + + + + + + | UpdateTitle( TkWindow *winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; Atom XA_UTF8_STRING = Tk_InternAtom((Tk_Window) winPtr, "UTF8_STRING"); const char *string; Tcl_DString ds; Tcl_Encoding encoding; /* * Set window title: */ string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid; Tcl_UtfToExternalDString(NULL, string, -1, &ds); XStoreName(winPtr->display, wmPtr->wrapperPtr->window, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); encoding = Tcl_GetEncoding(NULL, "utf-8"); Tcl_UtfToExternalDString(encoding, string, -1, &ds); SetWindowProperty(wmPtr->wrapperPtr, "_NET_WM_NAME", XA_UTF8_STRING, 8, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); |
︙ |
Changes to jni/sdl2tk/win/tkWinFont.c.
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - - - - - | * instance of this structure. The most important shared property is the * character existence metrics, used to determine if a screen font can display * a given Unicode character. * * Under Windows, a "font family" is uniquely identified by its face name. */ |
︙ | |||
819 820 821 822 823 824 825 | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | - + | int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { HDC hdc; HFONT oldFont; WinFont *fontPtr; int curX, moretomeasure; |
︙ | |||
850 851 852 853 854 855 856 | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | - + | */ moretomeasure = 0; curX = 0; start = source; end = start + numBytes; for (p = start; p < end; ) { |
︙ | |||
912 913 914 915 916 917 918 | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 | - + | char buf[16]; int dstWrote; int lastSize = 0; familyPtr = lastSubFontPtr->familyPtr; Tcl_DStringInit(&runString); for (p = start; p < end; ) { |
︙ | |||
961 962 963 964 965 966 967 | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | - + - + | if ((flags & TK_WHOLE_WORDS) && (p < end)) { /* * Scan the string for the last word break and than repeat the whole * procedure without the maxLength limit or any flags. */ const char *lastWordBreak = NULL; |
︙ | |||
1468 1469 1470 1471 1472 1473 1474 | 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | - + - + | * following string. */ const char *source, /* Potentially multilingual UTF-8 string. */ int numBytes, /* Length of string in bytes. */ double x, double y, /* Coordinates at which to place origin of * string when drawing. */ double angle) { |
︙ | |||
2223 2224 2225 2226 2227 2228 2229 | 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 | - + | SubFont *subFontPtr, /* Contains font mapping cache to be * updated. */ int row) /* Index of the page to be loaded into the * cache. */ { FontFamily *familyPtr; Tcl_Encoding encoding; |
︙ | |||
2276 2277 2278 2279 2280 2281 2282 | 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 | - + | * we don't know the proper Unicode -> symbol font mapping, we can * install the symbol font as the base font and access its glyphs. */ end = (row + 1) << FONTMAP_SHIFT; for (i = row << FONTMAP_SHIFT; i < end; i++) { if (Tcl_UtfToExternal(NULL, encoding, src, |
︙ |
Changes to jni/sdl2tk/win/tkWinMenu.c.
︙ | |||
507 508 509 510 511 512 513 | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | - - + - - + | int i; const char *label = (mePtr->labelPtr == NULL) ? "" : Tcl_GetString(mePtr->labelPtr); const char *accel = ((menuPtr->menuType == MENUBAR) || (mePtr->accelPtr == NULL)) ? "" : Tcl_GetString(mePtr->accelPtr); const char *p, *next; Tcl_DString itemString; |
︙ | |||
2100 2101 2102 2103 2104 2105 2106 | 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 | - - + | { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; len = Tcl_GetCharLength(mePtr->labelPtr); if (mePtr->underline < len) { const char *label, *start, *end; |
︙ |
Changes to jni/sdl2tk/win/tkWinTest.c.
︙ | |||
176 177 178 179 180 181 182 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | + - + + | msg = msgBuf; } else { Tcl_Encoding encoding; char *msgPtr; encoding = Tcl_GetEncoding(NULL, "unicode"); Tcl_ExternalToUtfDString(encoding, (char *) wMsgPtr, -1, &ds); if (encoding) { |
︙ |
Changes to jni/tcl/generic/regcustom.h.
︙ | |||
85 86 87 88 89 90 91 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - + | typedef Tcl_UniChar chr; /* The type itself. */ typedef int pchr; /* What it promotes to. */ typedef unsigned uchr; /* Unsigned type that will hold a chr. */ typedef int celt; /* Type to hold chr, or NOCELT */ #define NOCELT (-1) /* Celt value which is not valid chr */ #define CHR(c) (UCHAR(c)) /* Turn char literal into chr literal */ #define DIGITVAL(c) ((c)-'0') /* Turn chr digit into its value */ |
︙ |
Changes to jni/tcl/generic/tcl.h.
︙ | |||
2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 | 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 | + + + - + | * is the default and recommended mode. UCS-4 is experimental and not * recommended. It works for the core, but most extensions expect UCS-2. */ #ifndef TCL_UTF_MAX #define TCL_UTF_MAX 3 #endif #if (TCL_UTF_MAX != 3) && (TCL_UTF_MAX != 4) #error TCL_UTF_MAX must be 3 or 4 #endif /* * This represents a Unicode character. Any changes to this should also be * reflected in regcustom.h. */ |
︙ |
Changes to jni/tcl/generic/tclBinary.c.
︙ | |||
447 448 449 450 451 452 453 454 455 456 457 458 459 460 | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | + + + + + + + + + + + + + + | src = TclGetStringFromObj(objPtr, &length); srcEnd = src + length; byteArrayPtr = (ByteArray *) ckalloc(BYTEARRAY_SIZE(length)); byteArrayPtr->bytes = (unsigned char *) (byteArrayPtr + 1); for (dst = byteArrayPtr->bytes; src < srcEnd; ) { src += TclUtfToUniChar(src, &ch); #if TCL_UTF_MAX == 3 if ((ch & 0xFC00) == 0xD800) { if (Tcl_UtfCharComplete(src, srcEnd - src)) { int uch = ch; int len2 = TclUtfToUniChar(src, &ch); if ((ch & 0xFC00) == 0xDC00) { src += len2; uch = (((uch&0x3ff)<<10) | (ch&0x3ff)) + 0x10000; } ch = UCHAR(uch); } } #endif *dst++ = UCHAR(ch); } byteArrayPtr->used = dst - byteArrayPtr->bytes; byteArrayPtr->allocated = length; TclFreeIntRep(objPtr); |
︙ | |||
1211 1212 1213 1214 1215 1216 1217 | 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 | - + | badIndex: errorString = "not enough arguments for all format specifiers"; goto error; badField: { Tcl_UniChar ch = 0; |
︙ | |||
1590 1591 1592 1593 1594 1595 1596 | 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 | - + | badIndex: errorString = "not enough arguments for all format specifiers"; goto error; badField: { Tcl_UniChar ch = 0; |
︙ |
Changes to jni/tcl/generic/tclCmdIL.c.
︙ | |||
4415 4416 4417 4418 4419 4420 4421 | 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 | - - + + + + - - - - - + + + + + + + + - - - - - + + + + - - + - - - + + + - - - + + | * Convert character to Unicode for comparison purposes. If either * string is at the terminating null, do a byte-wise comparison and * bail out immediately. */ if ((*left != '\0') && (*right != '\0')) { Tcl_UniChar lch = 0, rch = 0; |
︙ |
Changes to jni/tcl/generic/tclCmdMZ.c.
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | - + | static Tcl_NRPostProc SwitchPostProc; static Tcl_NRPostProc TryPostBody; static Tcl_NRPostProc TryPostFinal; static Tcl_NRPostProc TryPostHandler; static int UniCharIsAscii(int character); static int UniCharIsHexDigit(int character); |
︙ | |||
76 77 78 79 80 81 82 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | - + - + | "\xE2\x80\xAF" /* narrow no-break space (U+202f) */ "\xE2\x81\x9F" /* medium mathematical space (U+205f) */ "\xE2\x81\xA0" /* word joiner (U+2060) */ "\xE3\x80\x80" /* ideographic space (U+3000) */ "\xEF\xBB\xBF" /* zero width no-break space (U+feff) */ ; |
︙ | |||
118 119 120 121 122 123 124 | 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 | - + + - - + + - - - - - + + + + + + + + + - - - + + + - - - - + + + + + + + + + + - + | static int NumCodePointsUtf( const char *src, /* The UTF-8 string to measure. */ int length, /* The length of the string in bytes. */ int *flagPtr) /* Location to receive end flag. */ { Tcl_UniChar ch = 0; |
︙ | |||
174 175 176 177 178 179 180 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + | static int UtfNcmp( const char *cs, /* UTF string to compare to ct. */ const char *ct, /* UTF string cs is compared to. */ size_t numCp, /* Number of code points to compare. */ int flags) /* Flags describing string ends. */ { Tcl_UniChar ch1 = 0, ch2 = 0; int uch1, uch2; while (numCp-- > 0) { cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); uch1 = ch1; uch2 = ch2; if ((ch1 & 0xFC00) == 0xD800) { if ((flags & 1) && (numCp == 0)) { /* String ends with high surrogate. */ } else { int len = TclUtfToUniChar(cs, &ch1); if ((ch1 & 0xFC00) == 0xDC00) { uch1 = (((uch1&0x3FF)<<10) | (ch1&0x3FF)) + 0x10000; cs += len; } } } if ((ch2 & 0xFC00) == 0xD800) { if ((flags & 2) && (numCp == 0)) { /* String ends with high surrogate. */ } else { int len = TclUtfToUniChar(ct, &ch2); if ((ch2 & 0xFC00) == 0xDC00) { uch2 = (((uch2&0x3FF)<<10) | (ch2&0x3FF)) + 0x10000; ct += len; } } } if (uch1 != uch2) { return (uch1 - uch2); } } |
︙ | |||
203 204 205 206 207 208 209 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + | static int UtfNcasecmp( const char *cs, /* UTF string to compare to ct. */ const char *ct, /* UTF string cs is compared to. */ size_t numCp, /* Number of code points to compare. */ int flags) /* Flags describing string ends. */ { Tcl_UniChar ch1 = 0, ch2 = 0; int uch1, uch2; while (numCp-- > 0) { cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); uch1 = ch1; uch2 = ch2; if ((ch1 & 0xFC00) == 0xD800) { if ((flags & 1) && (numCp == 0)) { /* String ends with high surrogate. */ } else { int len = TclUtfToUniChar(cs, &ch1); if ((ch1 & 0xFC00) == 0xDC00) { uch1 = (((uch1&0x3FF)<<10) | (ch1&0x3FF)) + 0x10000; cs += len; } } } if ((ch2 & 0xFC00) == 0xD800) { if ((flags & 2) && (numCp == 0)) { /* String ends with high surrogate. */ } else { int len = TclUtfToUniChar(ct, &ch2); if ((ch2 & 0xFC00) == 0xDC00) { uch2 = (((uch2&0x3FF)<<10) | (ch2&0x3FF)) + 0x10000; ct += len; } } } if (uch1 != uch2) { uch1 = TclUCS4ToLower(uch1); uch2 = TclUCS4ToLower(uch2); if (uch1 != uch2) { return (uch1 - uch2); } } } |
︙ | |||
247 248 249 250 251 252 253 | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | - + | } } } return n; } #endif |
︙ | |||
301 302 303 304 305 306 307 | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | - + | return (lcs - lct); } } return 0; } #endif |
︙ | |||
893 894 895 896 897 898 899 | 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | - + | * This is a simple one pair string map situation. We make use of a * slightly modified version of the one pair STR_MAP code. */ int slen, nocase; int (*strCmpFn)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long); Tcl_UniChar *p; |
︙ | |||
924 925 926 927 928 929 930 | 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | - + - + | Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); Tcl_AppendUnicodeToObj(resultPtr, wstring, 1); numMatches++; } wlen = 0; } } else { |
︙ | |||
1392 1393 1394 1395 1396 1397 1398 | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 | - - - - - + + + + + + + + + + | Tcl_InitHashTable(&charReuseTable, TCL_ONE_WORD_KEYS); for ( ; stringPtr < end; stringPtr += len) { int fullchar; len = TclUtfToUniChar(stringPtr, &ch); fullchar = ch; |
︙ | |||
1451 1452 1453 1454 1455 1456 1457 | 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 | - - - - + + + + + + + + + + - - - - + + + + + + + + + + | */ Tcl_DStringInit(&ds); p = splitChars; while (p < splitChars + splitCharLen) { len = TclUtfToUniChar(p, &ch); uch = ch; |
︙ | |||
1764 1765 1766 1767 1768 1769 1770 | 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 | - + - - - - - - | */ if (TclIsPureByteArray(objv[1])) { unsigned char uch = UCHAR(ch); Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(&uch, 1)); } else { |
︙ | |||
2140 2141 2142 2143 2144 2145 2146 | 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 | - - - - + + + + + + + + + | } end = string1 + length1; for (; string1 < end; string1 += length2, failat++) { int fullchar; length2 = TclUtfToUniChar(string1, &ch); fullchar = ch; |
︙ | |||
2337 2338 2339 2340 2341 2342 2343 | 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 | - + - + - + | * extra calls to get Unicode data. The algorithm is otherwise * identical to the multi-pair case. This will be >30% faster on * larger strings. */ int mapLen; Tcl_UniChar *mapString; |
︙ | |||
2379 2380 2381 2382 2383 2384 2385 | 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 | - + - + - + - + | Tcl_AppendUnicodeToObj(resultPtr, mapString, mapLen); } } } } else { Tcl_UniChar **mapStrings; |
︙ | |||
2457 2458 2459 2460 2461 2462 2463 | 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 | - + | Tcl_AppendUnicodeToObj(resultPtr, mapStrings[index+1], mapLens[index+1]); break; } } } |
︙ | |||
2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 | 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 | + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + - + - - - - + - - + | } string = TclGetStringFromObj(objv[1], &length); if (index >= numChars) { index = numChars - 1; } cur = 0; if (index > 0) { #if TCL_UTF_MAX == 3 int len; #endif p = Tcl_UtfAtIndex(string, index); |
︙ | |||
2965 2966 2967 2968 2969 2970 2971 | 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 | - - + - - - - - - - - - + + + + + + + + + + + + + - - - - + | if (index < 0) { index = 0; } if (index < numChars) { p = Tcl_UtfAtIndex(string, index); end = string+length; for (cur = index; p < end; cur++) { |
︙ | |||
3144 3145 3146 3147 3148 3149 3150 | 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 | - + | int checkEq, /* comparison is only for equality */ int nocase, /* comparison is not case sensitive */ int reqlength) /* requested length; -1 to compare whole * strings */ { const char *s1, *s2; int empty, length, match, s1len, s2len; |
︙ | |||
3170 3171 3172 3173 3174 3175 3176 | 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 | - + - + - + - + - + - + | * type conversions and it is much faster. Only do this if we're * case-sensitive (which is all that really makes sense with byte * arrays anyway, and we have no memcasecmp() for some reason... :^) */ s1 = (char *) Tcl_GetByteArrayFromObj(value1Ptr, &s1len); s2 = (char *) Tcl_GetByteArrayFromObj(value2Ptr, &s2len); |
︙ | |||
3280 3281 3282 3283 3284 3285 3286 | 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 | - + - + - + + | if (!nocase && checkEq) { /* * When we have equal-length we can check only for (in)equality. * We can use memcmp() in all (n)eq cases because we don't need to * worry about lexical LE/BE variance. */ |
︙ | |||
3328 3329 3330 3331 3332 3333 3334 | 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 | - + | if (checkEq && (s1len != s2len)) { match = 1; /* This will be reversed below. */ } else { /* * The comparison function should compare up to the minimum byte * length only. */ |
︙ |
Changes to jni/tcl/generic/tclCompCmdsSZ.c.
︙ | |||
1489 1490 1491 1492 1493 1494 1495 | 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 | - + | PUSH(""); count++; } for (endTokenPtr = tokenPtr + parse.numTokens; tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) { int length, literal, catchRange, breakJump; |
︙ |
Changes to jni/tcl/generic/tclCompile.c.
︙ | |||
1719 1720 1721 1722 1723 1724 1725 | 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 | - + | if (tempPtr != NULL) { Tcl_AppendToObj(tempPtr, tokenPtr->start, tokenPtr->size); } break; case TCL_TOKEN_BS: if (tempPtr != NULL) { |
︙ | |||
2386 2387 2388 2389 2390 2391 2392 | 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 | - + | * compile. */ int count, /* Number of tokens to consider at tokenPtr. * Must be at least 1. */ CompileEnv *envPtr) /* Holds the resulting instructions. */ { Tcl_DString textBuffer; /* Holds concatenated chars from adjacent * TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */ |
︙ |
Changes to jni/tcl/generic/tclDisassemble.c.
︙ | |||
890 891 892 893 894 895 896 | 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | - + - - - - - - - - - - - | i += 2; continue; case '\v': Tcl_AppendToObj(appendObj, "\\v", -1); i += 2; continue; default: |
︙ |
Changes to jni/tcl/generic/tclEncoding.c.
︙ | |||
220 221 222 223 224 225 226 | 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 | - + + + | int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); static int TableToUtfProc(ClientData clientData, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); static size_t unilen(const char *src); |
︙ | |||
268 269 270 271 272 273 274 | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | - + | int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); static int UtfToMcesu8Proc(ClientData clientData, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); |
︙ | |||
588 589 590 591 592 593 594 | 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 | - + - + - + | type.toUtfProc = UtfExtToUtfIntProc; type.fromUtfProc = UtfIntToUtfExtProc; type.freeProc = NULL; type.nullSize = 1; type.clientData = NULL; Tcl_CreateEncoding(&type); |
︙ | |||
1105 1106 1107 1108 1109 1110 1111 | 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 | - + | encodingPtr->toUtfProc = typePtr->toUtfProc; encodingPtr->fromUtfProc = typePtr->fromUtfProc; encodingPtr->freeProc = typePtr->freeProc; encodingPtr->nullSize = typePtr->nullSize; encodingPtr->clientData = typePtr->clientData; if (typePtr->nullSize == 1) { encodingPtr->lengthProc = (LengthProc *) strlen; |
︙ | |||
2275 2276 2277 2278 2279 2280 2281 | 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 | - - + + | } /* *------------------------------------------------------------------------- * * UtfIntToUtfExtProc -- * |
︙ | |||
2315 2316 2317 2318 2319 2320 2321 2322 2323 | 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 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 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 | + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | int *dstWrotePtr, /* Filled with the number of bytes that were * stored in the output buffer as a result of * the conversion. */ int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { #if TCL_UTF_MAX > 3 /* UTF-8 to UTF-8 */ return UtfToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr, 1); #else /* WTF-8 to UTF-8 */ |
︙ | |||
2364 2365 2366 2367 2368 2369 2370 2371 2372 | 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 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 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 | + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | int *dstWrotePtr, /* Filled with the number of bytes that were * stored in the output buffer as a result of * the conversion. */ int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { #if TCL_UTF_MAX > 3 /* UTF-8 to UTF-8 */ return UtfToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr, 0); #else /* UTF-8 to WTF-8 */ |
︙ | |||
2419 2420 2421 2422 2423 2424 2425 | 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 | - + - - - | int pureNullMode) /* Convert embedded nulls from internal * representation to real null-bytes or vice * versa. */ { const char *srcStart, *srcEnd, *srcClose; const char *dstStart, *dstEnd; int result, numChars, charLimit = INT_MAX; |
︙ | |||
2475 2476 2477 2478 2479 2480 2481 | 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 | - + - + - + - - - - - - - + + + + + + + + + + + + + + + + + + | } else if (!Tcl_UtfCharComplete(src, srcEnd - src)) { /* * Always check before using TclUtfToUniChar. Not doing can so * cause it run beyond the end of the buffer! If we happen such an * incomplete char its bytes are made to represent themselves. */ |
︙ | |||
2543 2544 2545 2546 2547 2548 2549 | 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 | - + - - - | int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { const char *srcStart, *srcEnd; const char *dstEnd, *dstStart; int result, numChars, charLimit = INT_MAX; |
︙ | |||
2575 2576 2577 2578 2579 2580 2581 | 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 | - - - + + + - + | } /* * Special case for 1-byte utf chars for speed. Make sure we work with * Tcl_UniChar-size data. */ |
︙ | |||
2636 2637 2638 2639 2640 2641 2642 | 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 | - + - - - | * the conversion. */ int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd; int result, numChars; |
︙ | |||
2666 2667 2668 2669 2670 2671 2672 | 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 | - + - - - - - + + + + + - - + + - - - - - + + + + + - - + + | result = TCL_CONVERT_MULTIBYTE; break; } if (dst > dstEnd) { result = TCL_CONVERT_NOSPACE; break; } |
︙ | |||
2902 2903 2904 2905 2906 2907 2908 | 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 | - + - - - - | */ result = TCL_CONVERT_MULTIBYTE; break; } len = TclUtfToUniChar(src, &ch); |
︙ | |||
3112 3113 3114 3115 3116 3117 3118 | 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 | - + - - - - - - - | } len = TclUtfToUniChar(src, &ch); /* * Check for illegal characters. */ |
︙ | |||
3146 3147 3148 3149 3150 3151 3152 | 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 | - + | *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } |
︙ | |||
3240 3241 3242 3243 3244 3245 3246 | 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 | - + | *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } #endif |
︙ | |||
3453 3454 3455 3456 3457 3458 3459 | 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 | - + - - - - - - - - - - - - - | *chPtr = (unsigned char) *src; src += 1; dst += Tcl_UniCharToUtf(*chPtr, dst); } else { int len = TclUtfToUniChar(src, chPtr); src += len; |
︙ | |||
3588 3589 3590 3591 3592 3593 3594 | 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 | - + | *chPtr = (unsigned char) *src; src += 1; dst += Tcl_UniCharToUtf(*chPtr, dst); } else { int len = TclUtfToUniChar(src, chPtr); src += len; |
︙ | |||
4201 4202 4203 4204 4205 4206 4207 | 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 | - + | p = (unsigned short *) src; while (*p != 0x0000) { p++; } return (char *) p - src; } |
︙ |
Changes to jni/tcl/generic/tclExecute.c.
︙ | |||
5585 5586 5587 5588 5589 5590 5591 | 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 | - + - - - - - - | } else if (TclIsPureByteArray(valuePtr)) { objResultPtr = Tcl_NewByteArrayObj( Tcl_GetByteArrayFromObj(valuePtr, NULL)+index, 1); } else if (valuePtr->bytes && length == valuePtr->length) { objResultPtr = Tcl_NewStringObj((const char *) valuePtr->bytes+index, 1); } else { |
︙ | |||
5947 5948 5949 5950 5951 5952 5953 | 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 | - + | ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &length); match = 1; if (length > 0) { end = ustring1 + length; for (p=ustring1 ; p<end ; p++) { int ch = *p; |
︙ |
Changes to jni/tcl/generic/tclInt.h.
︙ | |||
3249 3250 3251 3252 3253 3254 3255 | 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 | + + + - + - + + + - - - - | MODULE_SCOPE void * TclpThreadGetGlobalTSD(void *tsdKeyPtr); MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp, const char *msg, int length); #if TCL_UTF_MAX > 3 MODULE_SCOPE int TclCollapseSurrogatePair(Tcl_Token *tokenPtr, int *numReadPtr, char *buffer); #define TclUCS4ToUpper(ch) Tcl_UniCharToUpper((ch)) #define TclUCS4ToLower(ch) Tcl_UniCharToLower((ch)) #define TclUCS4ToTitle(ch) Tcl_UniCharToTitle((ch)) |
︙ |
Changes to jni/tcl/generic/tclMain.c.
︙ | |||
65 66 67 68 69 70 71 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - + - + | /* * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise * NewNativeObj is needed (which provides proper conversion from native * encoding to UTF-8). */ |
︙ |
Changes to jni/tcl/generic/tclParse.c.
︙ | |||
815 816 817 818 819 820 821 | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 | - + - + - + | * Scans up to numBytes bytes starting at src, consuming a backslash * sequence as defined by Tcl's parsing rules. * * Results: * Records at readPtr the number of bytes making up the backslash * sequence. Records at dst the UTF-8 encoded equivalent of that * backslash sequence. Returns the number of bytes written to dst, at |
︙ | |||
929 930 931 932 933 934 935 | 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | - - - - - - | * No hexdigits -> This is just "U". */ result = 'U'; } else { /* * Check Unicode range. */ |
︙ | |||
1000 1001 1002 1003 1004 1005 1006 | 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 | - - - - - + + + + + + + | break; } done: if (readPtr != NULL) { *readPtr = count; } |
︙ | |||
2222 2223 2224 2225 2226 2227 2228 | 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 | - + | adjust = 0; result = NULL; for (; count>0 && code==TCL_OK ; count--, tokenPtr++) { Tcl_Obj *appendObj = NULL; const char *append = NULL; int appendByteLength = 0; |
︙ | |||
2587 2588 2589 2590 2591 2592 2593 | 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 | - + - + - + - + | TclCollapseSurrogatePair( Tcl_Token *tokenPtr, /* Pointer to token to be checked. */ int *numReadPtr, /* Pointer to number of consumed input chars. */ char *buffer) /* Buffer holding UTF data of previous token. */ { int count, numRead; Tcl_UniChar ch = 0, ch2 = 0; |
Changes to jni/tcl/generic/tclScan.c.
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 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 93 94 95 96 97 98 99 100 | - + - - - - + - - - + + + + - + + + | /* *---------------------------------------------------------------------- * * UtfToUniChar -- * * Wrapper to Tcl_UtfToUniChar() capable of dealing with |
︙ |
Changes to jni/tcl/generic/tclStringObj.c.
︙ | |||
755 756 757 758 759 760 761 | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | - + | if (last < 0 || last >= stringPtr->numChars) { last = stringPtr->numChars - 1; } if (last < first) { TclNewObj(newObjPtr); return newObjPtr; } |
︙ | |||
2093 2094 2095 2096 2097 2098 2099 | 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 | - + - - - - - + + + + + + + | numChars = precision; Tcl_IncrRefCount(segment); allocSegment = 1; } } break; case 'c': { |
︙ | |||
2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 | 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 | + + + - - - - + - + - + - + | Tcl_Obj * TclStringReverse( Tcl_Obj *objPtr) { String *stringPtr; Tcl_UniChar ch = 0; #if TCL_UTF_MAX == 3 int needFlip = 0; #endif if (TclIsPureByteArray(objPtr)) { int numBytes; unsigned char *from = Tcl_GetByteArrayFromObj(objPtr, &numBytes); if (Tcl_IsShared(objPtr)) { objPtr = Tcl_NewByteArrayObj(NULL, numBytes); } ReverseBytes(Tcl_GetByteArrayFromObj(objPtr, NULL), from, numBytes); return objPtr; } SetStringFromAny(NULL, objPtr); stringPtr = GET_STRING(objPtr); if (stringPtr->hasUnicode) { Tcl_UniChar *from = Tcl_GetUnicode(objPtr); Tcl_UniChar *src = from + stringPtr->numChars; Tcl_UniChar *to; |
︙ | |||
3003 3004 3005 3006 3007 3008 3009 | 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 | - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + | * NOTE: We know that the from buffer is NUL-terminated. It's * part of the contract for objPtr->bytes values. Thus, we can * skip calling Tcl_UtfCharComplete() here. */ int bytesInChar = TclUtfToUniChar(from, &ch); |
︙ | |||
3063 3064 3065 3066 3067 3068 3069 | 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 | - + | Tcl_Obj *objPtr, const char *bytes, int numBytes, int numAppendChars) { String *stringPtr = GET_STRING(objPtr); int needed, numOrigChars = 0; |
︙ | |||
3086 3087 3088 3089 3090 3091 3092 | 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 | - + - | stringPtr->hasUnicode = 1; if (bytes) { stringPtr->numChars = needed; } else { numAppendChars = 0; } for (dst=stringPtr->unicode + numOrigChars; numAppendChars-- > 0; dst++) { |
︙ | |||
3308 3309 3310 3311 3312 3313 3314 | 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 | - + - - - | int numChars) { /* * Precondition: this is the "string" Tcl_ObjType. */ int i, origLength, size = 0; |
︙ | |||
3336 3337 3338 3339 3340 3341 3342 | 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 | - - - - - - - - - - - - - - - - - - - - - - - - | */ if (numChars <= (INT_MAX - size)/TCL_UTF_MAX && stringPtr->allocated >= size + numChars * TCL_UTF_MAX) { goto copyBytes; } |
︙ |
Changes to jni/tcl/generic/tclUniData.c.
︙ | |||
190 191 192 193 194 195 196 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - + - - + | 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 9888, 1344, 1344, 9920, 3296, 9952, 9984, 10016, 1344, 1344, 10048, 10080, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 10112, 10144, 1344, 10176, 1344, 10208, 10240, 10272, 10304, 10336, 10368, 1344, 1344, 1344, 10400, 10432, 64, 10464, 10496, |
︙ | |||
565 566 567 568 569 570 571 | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | - | 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 15488 |
︙ | |||
1175 1176 1177 1178 1179 1180 1181 | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | - + - - + | 13, 13, 13, 13, 13, 13, 13, 13, 13, 5, 7, 6, 7, 5, 6, 3, 5, 6, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 15, 0, 0, 0, 4, 4, 7, 11, 14, 4, 4, 0, 14, 7, 7, 7, 7, 14, 14, 0, 0, 0, |
︙ | |||
1648 1649 1650 1651 1652 1653 1654 | 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 | - | 14, 14, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 |
︙ | |||
1696 1697 1698 1699 1700 1701 1702 | 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 | - - + - - - | -2750143, -976319, -2746047, 2763650, 2762882, -2759615, -2751679, -2760383, -2760127, -2768575, 1859714, -9044927, -10823615, -12158, -10830783, -10833599, -10832575, -10830015, -10817983, -10824127, -10818751, 237633, -12223, -10830527, -9058239, 237698, 9949314, 18, 17, 10305, 10370, 10049, 10114, 8769, 8834 }; |
︙ | |||
1755 1756 1757 1758 1759 1760 1761 | 1747 1748 1749 1750 1751 1752 1753 1754 | - - + - - - | #define GetDelta(info) ((info) >> 8) /* * This macro extracts the information about a character from the * Unicode character tables. */ |
Changes to jni/tcl/generic/tclUtf.c.
︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | + + + + + + + + + + + + + + + + + | 4,4,4,4,4, #else 1,1,1,1,1, #endif 1,1,1,1,1,1,1,1,1,1,1 }; #if TCL_UTF_MAX == 3 static const unsigned char totalBytesExt[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, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4, 1,1,1,1,1,1,1,1,1,1,1 }; #endif /* * Functions used only in this module. */ static int UtfCount(int ch); static int Invalid(unsigned char *src); |
︙ | |||
205 206 207 208 209 210 211 | 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 | - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + | if (ch >= 0) { if (ch <= 0x7FF) { buf[1] = (char) ((ch | 0x80) & 0xBF); buf[0] = (char) ((ch >> 6) | 0xC0); return 2; } if (ch <= 0xFFFF) { |
︙ | |||
328 329 330 331 332 333 334 | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - - - - - - - - - | * The caller must ensure that the source buffer is long enough that this * routine does not run off the end and dereference non-existent memory * looking for trail bytes. If the source buffer is known to be '\0' * terminated, this cannot happen. Otherwise, the caller should call * Tcl_UtfCharComplete() before calling this routine to ensure that * enough bytes remain in the string. * |
︙ | |||
409 410 411 412 413 414 415 | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | - - - - - - - - - - - - - - + - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } #if TCL_UTF_MAX > 3 else if (byte < 0xF8) { if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80) && ((src[3] & 0xC0) == 0x80)) { /* * Four-byte-character lead byte followed by three trail bytes. */ |
︙ | |||
542 543 544 545 546 547 548 549 550 551 552 553 554 555 | 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 | + + + + + + + + + + + + + + + + | Tcl_UtfCharComplete( const char *src, /* String to check if first few bytes contain * a complete UTF-8 character. */ int length) /* Length of above string in bytes. */ { return length >= totalBytes[UCHAR(*src)]; } #if TCL_UTF_MAX == 3 int TclUtfCharCompleteExt( const char *src, /* String to check if first few bytes contain * a complete UTF-8 character. */ int length) /* Length of above string in bytes. */ { int ch; ch = *((unsigned char *) src); return length >= totalBytesExt[ch]; } #endif /* *--------------------------------------------------------------------------- * * Tcl_NumUtfChars -- * * Returns the number of characters (not bytes) in the UTF-8 string, not |
︙ | |||
569 570 571 572 573 574 575 | 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 661 662 663 664 665 666 | - - - - - - - - - - - - - - - - - - - - - - - - - - - | 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). */ { Tcl_UniChar ch = 0; int i = 0; |
︙ | |||
653 654 655 656 657 658 659 | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | - - + + - - - - - - - - + | */ const char * Tcl_UtfFindFirst( const char *src, /* The UTF-8 string to be searched. */ int ch) /* The Unicode character to search for. */ { |
︙ | |||
699 700 701 702 703 704 705 | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | - - + + - - - - - - - - + | */ const char * Tcl_UtfFindLast( const char *src, /* The UTF-8 string to be searched. */ int ch) /* The Unicode character to search for. */ { |
︙ | |||
943 944 945 946 947 948 949 950 951 952 953 954 955 956 | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | + | const char *src, /* The UTF-8 string. */ int index) /* The position of the desired character. */ { Tcl_UniChar ch = 0; while (index-- > 0) { int len = TclUtfToUniChar(src, &ch); src += len; } return src; } /* *--------------------------------------------------------------------------- |
︙ | |||
986 987 988 989 990 991 992 993 | 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 | + - + - + + + + + | * src, unless NULL. */ char *dst) /* Filled with the bytes represented by the * backslash sequence. */ { #define LINE_LENGTH 128 int numRead; int result; char buffer[TCL_UTF_MAX*2]; |
︙ | |||
1023 1024 1025 1026 1027 1028 1029 | 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 | - + - - - - + + + - - - + + + + + - - - + + + - - + + + + - - - - - | *---------------------------------------------------------------------- */ int Tcl_UtfToUpper( char *str) /* String to convert in place. */ { |
︙ | |||
1097 1098 1099 1100 1101 1102 1103 | 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | - + - - - - + + + - - - + + + + + - - - + + + - - + + + + - - - - - | *---------------------------------------------------------------------- */ int Tcl_UtfToLower( char *str) /* String to convert in place. */ { |
︙ | |||
1173 1174 1175 1176 1177 1178 1179 | 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 | - + - - - - + + + - - - + + + + + - - - + + + - - + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - + + + - - + + + + - - - - - | *---------------------------------------------------------------------- */ int Tcl_UtfToTitle( char *str) /* String to convert in place. */ { |
︙ | |||
1329 1330 1331 1332 1333 1334 1335 | 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 | - - + + + + + + + + + - + + + - + + + + + - - - + + + - - - - - + + + + + + - - + + - - - + + - - + + + + + - | int Tcl_UtfNcmp( const char *cs, /* UTF string to compare to ct. */ const char *ct, /* UTF string cs is compared to. */ unsigned long numChars) /* Number of UTF chars to compare. */ { |
︙ | |||
1398 1399 1400 1401 1402 1403 1404 | 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 | - - + + + + + + + + + - + + + + - - - + + + + + - + + - - - + + + - - - - - + + + + + + - - + + - - - + + - - + + + + + - | int Tcl_UtfNcasecmp( const char *cs, /* UTF string to compare to ct. */ const char *ct, /* UTF string cs is compared to. */ unsigned long numChars) /* Number of UTF chars to compare. */ { |
︙ | |||
1469 1470 1471 1472 1473 1474 1475 | 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | - - + + + - + + + + + - - - + + + - - - - - + + + + + - - + + - - - + + - - + + + + - + + + + + - + | */ int TclUtfCasecmp( const char *cs, /* UTF string to compare to ct. */ const char *ct) /* UTF string cs is compared to. */ { |
︙ | |||
1521 1522 1523 1524 1525 1526 1527 | 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 | - + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
︙ | |||
1568 1569 1570 1571 1572 1573 1574 | 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | - + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
︙ | |||
1617 1618 1619 1620 1621 1622 1623 | 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 | - + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
︙ | |||
1719 1720 1721 1722 1723 1724 1725 | 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 | - + | int Tcl_UniCharNcmp( 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. */ { |
︙ | |||
1764 1765 1766 1767 1768 1769 1770 | 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 | - + | for ( ; numChars != 0; ucs++, uct++, numChars--) { if (*ucs != *uct) { return (*ucs - *uct); } } return 0; #endif /* WORDS_BIGENDIAN */ |
︙ | |||
1791 1792 1793 1794 1795 1796 1797 | 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | - + | int 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. */ { |
︙ | |||
1854 1855 1856 1857 1858 1859 1860 | 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsAlnum( int ch) /* Unicode character to test. */ { |
︙ | |||
1882 1883 1884 1885 1886 1887 1888 | 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsAlpha( int ch) /* Unicode character to test. */ { |
︙ | |||
1910 1911 1912 1913 1914 1915 1916 | 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsControl( int ch) /* Unicode character to test. */ { |
︙ | |||
1946 1947 1948 1949 1950 1951 1952 | 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsDigit( int ch) /* Unicode character to test. */ { |
︙ | |||
1974 1975 1976 1977 1978 1979 1980 | 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsGraph( int ch) /* Unicode character to test. */ { |
︙ | |||
2002 2003 2004 2005 2006 2007 2008 | 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsLower( int ch) /* Unicode character to test. */ { |
︙ | |||
2030 2031 2032 2033 2034 2035 2036 | 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsPrint( int ch) /* Unicode character to test. */ { |
︙ | |||
2058 2059 2060 2061 2062 2063 2064 | 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsPunct( int ch) /* Unicode character to test. */ { |
︙ | |||
2086 2087 2088 2089 2090 2091 2092 | 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 | - - - - - - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsSpace( int ch) /* Unicode character to test. */ { |
︙ | |||
2133 2134 2135 2136 2137 2138 2139 | 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsUpper( int ch) /* Unicode character to test. */ { |
︙ | |||
2161 2162 2163 2164 2165 2166 2167 | 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 | - - | *---------------------------------------------------------------------- */ int Tcl_UniCharIsWordChar( int ch) /* Unicode character to test. */ { |
︙ | |||
2200 2201 2202 2203 2204 2205 2206 | 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 | - + | Tcl_UniCharCaseMatch( 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 */ { |
︙ | |||
2403 2404 2405 2406 2407 2408 2409 | 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 | - + - + | const Tcl_UniChar *pattern, /* Pattern, which may contain special * characters. */ int ptnLen, /* Length of Pattern */ int nocase) /* 0 for case sensitive, 1 for insensitive */ { const Tcl_UniChar *stringEnd, *patternEnd; int p; |
︙ | |||
2454 2455 2456 2457 2458 2459 2460 | 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 | - + | while (*(++pattern) == '*') { /* empty body */ } if (pattern == patternEnd) { return 1; } p = *pattern; |
︙ | |||
2476 2477 2478 2479 2480 2481 2482 | 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 | - + | /* * Optimization for matching - cruise through the string * quickly if the next char in the pattern isn't a special * character. */ if ((p != '[') && (p != '?') && (p != '\\')) { |
︙ | |||
2515 2516 2517 2518 2519 2520 2521 | 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 | - + - + | if (TclUniCharMatch(string, stringEnd - string, pattern, patternEnd - pattern, nocase)) { return 1; } if (string == stringEnd) { return 0; } |
︙ | |||
2556 2557 2558 2559 2560 2561 2562 | 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 | - + - + | * characters separated by "-"). */ if (p == '[') { int ch1, startChar, endChar; pattern++; |
︙ | |||
2598 2599 2600 2601 2602 2603 2604 | 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 | - + | #endif pattern++; if (*pattern == '-') { pattern++; if (pattern == patternEnd) { return 0; } |
︙ | |||
2634 2635 2636 2637 2638 2639 2640 | 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 | - + | while (*pattern != ']') { if (pattern == patternEnd) { pattern--; break; } pattern++; } |
︙ | |||
2661 2662 2663 2664 2665 2666 2667 | 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 | - + | } } /* * There's no special character. Just make sure that the next bytes of * each string match. */ |
︙ |
Changes to jni/tcl/generic/tclUtil.c.
︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | + + | static Tcl_ThreadDataKey precisionKey; /* * Prototypes for functions defined later in this file. */ #undef UtfToUniChar static int UtfToUniChar(const char *string, int *chPtr); static void ClearHash(Tcl_HashTable *tablePtr); static void FreeProcessGlobalValue(ClientData clientData); static void FreeThreadHash(ClientData clientData); static int GetEndOffsetFromObj(Tcl_Obj *objPtr, int endValue, int *indexPtr); static Tcl_HashTable * GetThreadHash(Tcl_ThreadDataKey *keyPtr); static int SetEndOffsetFromAny(Tcl_Interp *interp, |
︙ | |||
366 367 368 369 370 371 372 | 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 | - + - - - - + - - - - + + + + + + + + | /* *---------------------------------------------------------------------- * * UtfToUniChar -- * * Wrapper to Tcl_UtfToUniChar() capable of dealing with |
︙ | |||
1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 | 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 | + | * rely on (bytes[numBytes] == '\0'). */ const char *trim, /* String of trim characters... */ int numTrim) /* ...and its length in bytes */ /* Calls to UtfToUniChar() in this routine * rely on (trim[numTrim] == '\0'). */ { const char *pp, *p = bytes + numBytes, *q; Tcl_UniChar ch1 = 0; int i; Tcl_DString ds; /* Empty strings -> nothing to do */ if ((numBytes == 0) || (numTrim == 0)) { return 0; } |
︙ | |||
1814 1815 1816 1817 1818 1819 1820 | 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 | - + + + + + + + + + + + + + + + + + + | do { int uch, pInc = 0; pp = TclUtfPrev(p, bytes); do { pp += pInc; |
︙ |
Changes to jni/tcl/generic/zipfs.c.
︙ | |||
1109 1110 1111 1112 1113 1114 1115 | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 | - + - - + - + - + + + + + + - - - + + + + + + + - - + - - - - + + + + + + + + + + + + + + + - + + | 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0 }; char *q, buffer[TCL_UTF_MAX * 2]; int i, n; if (utf) { const char *p = path, *end = p + length; |
︙ | |||
1204 1205 1206 1207 1208 1209 1210 | 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | + - + - - - - + + + - - - - + + + + + + + + - + - | *------------------------------------------------------------------------- */ static char * EncodePathname(const char *path, int length, Tcl_DString *dsPtr) { const char *p, *end; Tcl_UniChar ch; |
︙ |
Changes to jni/tcl/pkgs/sqlite3.45.3/generic/tclsqlite3.c.
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | int nVMStep; /* Another statistic for most recent operation */ int nTransaction; /* Number of nested [transaction] methods */ int openFlags; /* Flags used to open. (SQLITE_OPEN_URI) */ int nRef; /* Delete object when this reaches 0 */ #ifdef SQLITE_TEST int bLegacyPrepare; /* True to use sqlite3_prepare() */ #endif Tcl_DString dsErr; /* Used for error messages (utf8Encoding) */ }; struct IncrblobChannel { sqlite3_blob *pBlob; /* sqlite3 blob handle */ SqliteDb *pDb; /* Associated database connection */ Tcl_WideInt iSeek; /* Current seek offset */ Tcl_Channel channel; /* Channel identifier */ IncrblobChannel *pNext; /* Linked list of all open incrblob channels */ IncrblobChannel *pPrev; /* Linked list of all open incrblob channels */ }; /* ** Tcl UTF-8 encoding; loaded and tested on module init. Depending ** on unicode support detected, it is reset to NULL or kept until ** module gets unloaded. */ static Tcl_Encoding utf8Encoding = NULL; static int utf8EncInit = 0; TCL_DECLARE_MUTEX(utf8EncMutex); /* ** Compute a string length that is limited to what can be stored in ** lower 30 bits of a 32-bit signed integer. */ static int strlen30(const char *z){ const char *z2 = z; while( *z2 ){ z2++; } return 0x3fffffff & (int)(z2 - z); } #ifdef USE_TCL_STUBS # define tclStubsPtr staticTclStubsPtr static const TclStubs *tclStubsPtr = 0; #endif /* ** Error message converter. */ static const char *SQLITEDB_ERRMSG(SqliteDb *pDb){ if( pDb!=NULL ){ if( pDb->db!=NULL ){ if( utf8Encoding!=NULL ){ Tcl_DStringFree(&pDb->dsErr); Tcl_ExternalToUtfDString(utf8Encoding, sqlite3_errmsg(pDb->db), -1, &pDb->dsErr); return Tcl_DStringValue(&pDb->dsErr); } return sqlite3_errmsg(pDb->db); } return "not a valid database"; } return "unknown error"; } #ifndef SQLITE_OMIT_INCRBLOB /* ** Close all incrblob channels opened using database connection pDb. ** This is called when shutting down the database connection. */ static void closeIncrblobChannels(SqliteDb *pDb){ |
︙ | |||
288 289 290 291 292 293 294 | 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 | - + - + | */ static int SQLITE_TCLAPI incrblobClose( ClientData instanceData, Tcl_Interp *interp ){ IncrblobChannel *p = (IncrblobChannel *)instanceData; int rc = sqlite3_blob_close(p->pBlob); |
︙ | |||
501 502 503 504 505 506 507 | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | - + | /* This variable is used to name the channels: "incrblob_[incr count]" */ static int count = 0; char zChannel[64]; rc = sqlite3_blob_open(db, zDb, zTable, zColumn, iRow, !isReadonly, &pBlob); if( rc!=SQLITE_OK ){ |
︙ | |||
677 678 679 680 681 682 683 684 685 686 687 688 689 690 | 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | + | } if( pDb->pWalHook ){ Tcl_DecrRefCount(pDb->pWalHook); } if( pDb->pCollateNeeded ){ Tcl_DecrRefCount(pDb->pCollateNeeded); } Tcl_DStringFree(&pDb->dsErr); Tcl_Free((char*)pDb); } } /* ** TCL calls this procedure when an sqlite3 database command is ** deleted. |
︙ | |||
746 747 748 749 750 751 752 | 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | + + + + + + - + + | void *xd /* Extra event data, depends on event type. */ ){ SqliteDb *pDb = (SqliteDb*)cd; Tcl_DString str; Tcl_DStringInit(&str); Tcl_DStringAppend(&str, pDb->zTrace, -1); if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, (char *)xd, -1, &ds); Tcl_DStringAppendElement(&str, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); }else{ |
︙ | |||
779 780 781 782 783 784 785 | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | + + + - - + + + + + + + + | sqlite3_stmt *pStmt = (sqlite3_stmt *)pd; char *zSql = (char *)xd; pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1); Tcl_IncrRefCount(pCmd); Tcl_ListObjAppendElement(pDb->interp, pCmd, Tcl_NewWideIntObj((Tcl_WideInt)(uptr)pStmt)); if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, zSql, -1, &ds); |
︙ | |||
849 850 851 852 853 854 855 | 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | + + + + + + - + + | Tcl_DString str; char zTm[100]; sqlite3_stmt *pStmt = (sqlite3_stmt *)pd; sqlite3_snprintf(sizeof(zTm)-1, zTm, "%lld", (Tcl_WideInt)(uptr)xd); Tcl_DStringInit(&str); Tcl_DStringAppend(&str, pDb->zProfile, -1); if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, sqlite3_sql(pStmt), -1, &ds); Tcl_DStringAppendElement(&str, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); }else{ |
︙ | |||
902 903 904 905 906 907 908 | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 | + + + + + + + - + + | SqliteDb *pDb = (SqliteDb*)clientData; Tcl_Interp *interp = pDb->interp; assert(pDb->pWalHook); assert( db==pDb->db ); p = Tcl_DuplicateObj(pDb->pWalHook); Tcl_IncrRefCount(p); if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, zDb, -1, &ds); Tcl_ListObjAppendElement(interp, p, Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); Tcl_DStringFree(&ds); }else{ |
︙ | |||
968 969 970 971 972 973 974 | 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 | + + + + + + + + + + + - - + + + | assert( pDb->pPreUpdateHook ); assert( db==pDb->db ); assert( op==SQLITE_INSERT || op==SQLITE_UPDATE || op==SQLITE_DELETE ); pCmd = Tcl_DuplicateObj(pDb->pPreUpdateHook); Tcl_IncrRefCount(pCmd); Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(azStr[(op-1)/9], -1)); if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, zDb, -1, &ds); Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); Tcl_DStringFree(&ds); Tcl_ExternalToUtfDString(utf8Encoding, zTbl, -1, &ds); Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); Tcl_DStringFree(&ds); }else{ |
︙ | |||
998 999 1000 1001 1002 1003 1004 | 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 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | + + + + + + + + + + + - - + + + + + + + + + + - + + + + + + + + + + + + + - - + + + | assert( pDb->pUpdateHook ); assert( op==SQLITE_INSERT || op==SQLITE_UPDATE || op==SQLITE_DELETE ); pCmd = Tcl_DuplicateObj(pDb->pUpdateHook); Tcl_IncrRefCount(pCmd); Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(azStr[(op-1)/9], -1)); if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, zDb, -1, &ds); Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); Tcl_DStringFree(&ds); Tcl_ExternalToUtfDString(utf8Encoding, zTbl, -1, &ds); Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); Tcl_DStringFree(&ds); }else{ |
︙ | |||
1074 1075 1076 1077 1078 1079 1080 | 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 | + + + + + + + + + - + + | ** That way, when Tcl_EvalObjv() is run and shimmers the first element ** of the list to tclCmdNameType, that alternate representation will ** be preserved and reused on the next invocation. */ Tcl_Obj **aArg; int nArg; if( Tcl_ListObjGetElements(p->interp, p->pScript, &nArg, &aArg) ){ resultError: if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_UtfToExternalDString(utf8Encoding, Tcl_GetStringResult(p->interp), -1, &ds); sqlite3_result_error(context, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); }else{ |
︙ | |||
1106 1107 1108 1109 1110 1111 1112 | 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | + + + + + + + + - + + - - + - + | } case SQLITE_NULL: { pVal = Tcl_NewStringObj(p->pDb->zNull, -1); break; } default: { int bytes = sqlite3_value_bytes(pIn); if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, (char *)sqlite3_value_text(pIn), bytes, &ds); pVal = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); }else{ |
︙ | |||
1261 1262 1263 1264 1265 1266 1267 | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 | + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + | case SQLITE_SAVEPOINT : zCode="SQLITE_SAVEPOINT"; break; case SQLITE_RECURSIVE : zCode="SQLITE_RECURSIVE"; break; default : zCode="????"; break; } Tcl_DStringInit(&str); Tcl_DStringAppend(&str, pDb->zAuth, -1); Tcl_DStringAppendElement(&str, zCode); if( zArg1==NULL ){ |
︙ | |||
1371 1372 1373 1374 1375 1376 1377 | 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | - + | ** and try to rollback the transaction. ** ** But it could also be that the user executed one or more BEGIN, ** COMMIT, SAVEPOINT, RELEASE or ROLLBACK commands that are confusing ** this method's logic. Not clear how this would be best handled. */ if( rc!=TCL_ERROR ){ |
︙ | |||
1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 | + | int nVar = 0; /* Number of variables in statement */ int iParm = 0; /* Next free entry in apParm */ char c; int i; int needResultReset = 0; /* Need to invoke Tcl_ResetResult() */ int rc = SQLITE_OK; /* Value to return */ Tcl_Interp *interp = pDb->interp; Tcl_DString ds; *ppPreStmt = 0; /* Trim spaces from the start of zSql and calculate the remaining length. */ while( (c = zSql[0])==' ' || c=='\t' || c=='\r' || c=='\n' ){ zSql++; } nSql = strlen30(zSql); |
︙ | |||
1483 1484 1485 1486 1487 1488 1489 | 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 | - + - + | /* If no prepared statement was found. Compile the SQL text. Also allocate ** a new SqlPreparedStmt structure. */ if( pPreStmt==0 ){ int nByte; if( SQLITE_OK!=dbPrepare(pDb, zSql, &pStmt, pzOut) ){ |
︙ | |||
1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 | 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 | + + + + + + | #endif } assert( pPreStmt ); assert( strlen30(pPreStmt->zSql)==pPreStmt->nSql ); assert( 0==memcmp(pPreStmt->zSql, zSql, pPreStmt->nSql) ); /* Bind values to parameters that begin with $ or : */ Tcl_DStringInit(&ds); for(i=1; i<=nVar; i++){ const char *zVar = sqlite3_bind_parameter_name(pStmt, i); if( utf8Encoding!= NULL ){ Tcl_DStringFree(&ds); Tcl_ExternalToUtfDString(utf8Encoding, zVar, -1, &ds); zVar = Tcl_DStringValue(&ds); } if( zVar!=0 && (zVar[0]=='$' || zVar[0]==':' || zVar[0]=='@') ){ Tcl_Obj *pVar = Tcl_GetVar2Ex(interp, &zVar[1], 0, 0); if( pVar==0 && pDb->zBindFallback!=0 ){ Tcl_Obj *pCmd; int rx; pCmd = Tcl_NewStringObj(pDb->zBindFallback, -1); Tcl_IncrRefCount(pCmd); |
︙ | |||
1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 | 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 | + + + + + + + + + + + | Tcl_GetDoubleFromObj(interp, pVar, &r); sqlite3_bind_double(pStmt, i, r); }else if( (c=='w' && strcmp(zType,"wideInt")==0) || (c=='i' && strcmp(zType,"int")==0) ){ Tcl_WideInt v; Tcl_GetWideIntFromObj(interp, pVar, &v); sqlite3_bind_int64(pStmt, i, v); }else if( utf8Encoding!=NULL ){ const char *pStr; int len; Tcl_DStringFree(&ds); pStr = Tcl_GetStringFromObj(pVar, &len); Tcl_UtfToExternalDString(utf8Encoding, pStr, len, &ds); sqlite3_bind_text(pStmt, i, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), SQLITE_TRANSIENT); Tcl_IncrRefCount(pVar); pPreStmt->apParm[iParm++] = pVar; }else{ data = (unsigned char *)Tcl_GetString(pVar); sqlite3_bind_text(pStmt, i, (char *)data, pVar->length, SQLITE_STATIC); Tcl_IncrRefCount(pVar); pPreStmt->apParm[iParm++] = pVar; } }else{ sqlite3_bind_null(pStmt, i); } if( needResultReset ) Tcl_ResetResult(pDb->interp); } } Tcl_DStringFree(&ds); pPreStmt->nParm = iParm; *ppPreStmt = pPreStmt; if( needResultReset && rc==TCL_OK ) Tcl_ResetResult(pDb->interp); return rc; } |
︙ | |||
1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 | 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 | + | ** dbEvalRowInfo() ** dbEvalColumnValue() */ typedef struct DbEvalContext DbEvalContext; struct DbEvalContext { SqliteDb *pDb; /* Database handle */ Tcl_Obj *pSql; /* Object holding string zSql */ Tcl_DString dsSql; /* Encoded SQL text */ const char *zSql; /* Remaining SQL to execute */ SqlPreparedStmt *pPreStmt; /* Current statement */ int nCol; /* Number of columns returned by pStmt */ int evalFlags; /* Flags used */ Tcl_Obj *pArray; /* Name of array variable */ Tcl_Obj **apColName; /* Array of column names */ }; |
︙ | |||
1706 1707 1708 1709 1710 1711 1712 | 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 | + + + + + + + - + + | SqliteDb *pDb, /* Database handle */ Tcl_Obj *pSql, /* Object containing SQL script */ Tcl_Obj *pArray, /* Name of Tcl array to set (*) element of */ int evalFlags /* Flags controlling evaluation */ ){ memset(p, 0, sizeof(DbEvalContext)); p->pDb = pDb; if( utf8Encoding!=NULL ){ const char *pStr; int len; pStr = Tcl_GetStringFromObj(pSql, &len); p->zSql = Tcl_UtfToExternalDString(utf8Encoding, pStr, len, &p->dsSql); }else{ Tcl_DStringInit(&p->dsSql); |
︙ | |||
1737 1738 1739 1740 1741 1742 1743 | 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 | + + + + + + + + - + + | int nCol; /* Number of columns returned by pStmt */ Tcl_Obj **apColName = 0; /* Array of column names */ p->nCol = nCol = sqlite3_column_count(pStmt); if( nCol>0 && (papColName || p->pArray) ){ apColName = (Tcl_Obj**)Tcl_Alloc( sizeof(Tcl_Obj*)*nCol ); for(i=0; i<nCol; i++){ if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, sqlite3_column_name(pStmt,i), -1, &ds); apColName[i] = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); }else{ |
︙ | |||
1848 1849 1850 1851 1852 1853 1854 | 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 | - + | ** This only happens once. If there is a second SQLITE_SCHEMA ** error, the error will be returned to the caller. */ p->zSql = zPrevSql; continue; } #endif Tcl_SetObjResult(pDb->interp, |
︙ | |||
1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 | 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 | + | dbReleaseStmt(p->pDb, p->pPreStmt, 0); p->pPreStmt = 0; } if( p->pArray ){ Tcl_DecrRefCount(p->pArray); p->pArray = 0; } Tcl_DStringFree(&p->dsSql); Tcl_DecrRefCount(p->pSql); dbReleaseColumnNames(p); delDatabaseRef(p->pDb); } /* ** Return a pointer to a Tcl_Obj structure with ref-count 0 that contains |
︙ | |||
1905 1906 1907 1908 1909 1910 1911 | 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 | + + + + + + + + - + | case SQLITE_FLOAT: { return Tcl_NewDoubleObj(sqlite3_column_double(pStmt, iCol)); } case SQLITE_NULL: { return Tcl_NewStringObj(p->pDb->zNull, -1); } } if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_Obj *obj; Tcl_ExternalToUtfDString(utf8Encoding, (char*)sqlite3_column_text(pStmt, iCol), -1, &ds); obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); return obj; |
︙ | |||
2122 2123 2124 2125 2126 2127 2128 | 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 | - + | "interrupt", "last_insert_rowid", "nullvalue", "onecolumn", "preupdate", "profile", "progress", "rekey", "restore", "rollback_hook", "serialize", "status", "timeout", "total_changes", "trace", "trace_v2", "transaction", "unlock_notify", "update_hook", "version", "wal_hook", |
︙ | |||
2232 2233 2234 2235 2236 2237 2238 | 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 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 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 | + + + + + + + - + + + + + - - + + + + + + + + + + + + + + - + + + + + - - + + + + + + + + + + - - + + + + + + + | }else if( objc==4 ){ zSrcDb = Tcl_GetString(objv[2]); zDestFile = Tcl_GetString(objv[3]); }else{ Tcl_WrongNumArgs(interp, 2, objv, "?DATABASE? FILENAME"); return TCL_ERROR; } if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_UtfToExternalDString(utf8Encoding, zDestFile, -1, &ds); rc = sqlite3_open_v2(Tcl_DStringValue(&ds), &pDest, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE| pDb->openFlags, 0); Tcl_DStringFree(&ds); }else{ |
︙ | |||
2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 | 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 | + + + + + + + + - + + | ** that function is called, invoke SCRIPT to evaluate the function. */ case DB_COLLATE: { SqlCollate *pCollate; char *zName; char *zScript; int nScript; Tcl_DString ds; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 2, objv, "NAME SCRIPT"); return TCL_ERROR; } zName = Tcl_GetString(objv[2]); if( utf8Encoding!=NULL ){ Tcl_UtfToExternalDString(utf8Encoding, zName, -1, &ds); zName = Tcl_DStringValue(&ds); }else{ Tcl_DStringInit(&ds); } zScript = Tcl_GetStringFromObj(objv[3], &nScript); pCollate = (SqlCollate*)Tcl_Alloc( sizeof(*pCollate) + nScript + 1 ); if( pCollate==0 ) return TCL_ERROR; pCollate->interp = interp; pCollate->pNext = pDb->pCollate; pCollate->zScript = (char*)&pCollate[1]; pDb->pCollate = pCollate; memcpy(pCollate->zScript, zScript, nScript+1); if( sqlite3_create_collation_v2(pDb->db, zName, SQLITE_UTF8, pCollate, tclSqlCollate, 0) ){ Tcl_DStringFree(&ds); |
︙ | |||
2519 2520 2521 2522 2523 2524 2525 | 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 | + + + + + + + + + - + + | #ifndef SQLITE_OMIT_COMPLETE Tcl_Obj *pResult; int isComplete; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "SQL"); return TCL_ERROR; } if( utf8Encoding!=NULL ){ const char *pStr; int len; Tcl_DString ds; pStr = Tcl_GetStringFromObj(objv[2], &len); Tcl_UtfToExternalDString(utf8Encoding, pStr, len, &ds); isComplete = sqlite3_complete( Tcl_DStringValue(&ds) ); Tcl_DStringFree(&ds); }else{ |
︙ | |||
2670 2671 2672 2673 2674 2675 2676 | 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 | + + + + + + - + + - + + + + + - - + + + + + + + - + + | strcmp(zConflict, "ignore" ) != 0 && strcmp(zConflict, "replace" ) != 0 ) { Tcl_AppendResult(interp, "Error: \"", zConflict, "\", conflict-algorithm must be one of: rollback, " "abort, fail, ignore, or replace", (char*)0); return TCL_ERROR; } if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_UtfToExternalDString(utf8Encoding, zTable, -1, &ds); zSql = sqlite3_mprintf("SELECT * FROM '%q'", Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); }else{ |
︙ | |||
2757 2758 2759 2760 2761 2762 2763 2764 | 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 | + + + + + + - + + - + + | break; } for(i=0; i<nCol; i++){ /* check for null data, if so, bind as null */ if( (azCol[i][0]==0) || (nNull>0 && strcmp(azCol[i], zNull)==0) ){ sqlite3_bind_null(pStmt, i+1); }else if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_UtfToExternalDString(utf8Encoding, azCol[i], -1, &ds); sqlite3_bind_text(pStmt, i+1, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), SQLITE_TRANSIENT); Tcl_DStringFree(&ds); }else{ |
︙ | |||
2853 2854 2855 2856 2857 2858 2859 | 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 | + + + + + + + - + + | int flags; if( len>0 ) memcpy(pData, pBA, len); if( isReadonly ){ flags = SQLITE_DESERIALIZE_FREEONCLOSE | SQLITE_DESERIALIZE_READONLY; }else{ flags = SQLITE_DESERIALIZE_FREEONCLOSE | SQLITE_DESERIALIZE_RESIZEABLE; } if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, (char*)zSchema, -1, &ds); xrc = sqlite3_deserialize(pDb->db, Tcl_DStringValue(&ds), pData, len, len, flags); Tcl_DStringFree(&ds); } else { |
︙ | |||
3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 | 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 | + | int flags = SQLITE_UTF8; SqlFunc *pFunc; Tcl_Obj *pScript; char *zName; int nArg = -1; int i; int eType = SQLITE_NULL; Tcl_DString ds; if( objc<4 ){ Tcl_WrongNumArgs(interp, 2, objv, "NAME ?SWITCHES? SCRIPT"); return TCL_ERROR; } for(i=3; i<(objc-1); i++){ const char *z = Tcl_GetString(objv[i]); int n = strlen30(z); |
︙ | |||
3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 | 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 | + + + + + + + - + | ); return TCL_ERROR; } } pScript = objv[objc-1]; zName = Tcl_GetString(objv[2]); if( utf8Encoding!=NULL ){ Tcl_UtfToExternalDString(utf8Encoding, zName, -1, &ds); zName = Tcl_DStringValue(&ds); }else{ Tcl_DStringInit(&ds); } pFunc = findSqlFunc(pDb, zName); if( pFunc==0 ) return TCL_ERROR; if( pFunc->pScript ){ Tcl_DecrRefCount(pFunc->pScript); } pFunc->pScript = pScript; Tcl_IncrRefCount(pScript); pFunc->useEvalObjv = safeToUseEvalObjv(interp, pScript); pFunc->eType = eType; rc = sqlite3_create_function_v2(pDb->db, zName, nArg, flags, pFunc, tclSqlFunc, 0, 0, 0); Tcl_DStringFree(&ds); if( rc!=SQLITE_OK ){ rc = TCL_ERROR; |
︙ | |||
3147 3148 3149 3150 3151 3152 3153 | 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 | + + + + + - - - + + + + + + + + + + + + | zDb = Tcl_GetString(objv[2+isReadonly]); } zTable = Tcl_GetString(objv[objc-3]); zColumn = Tcl_GetString(objv[objc-2]); rc = Tcl_GetWideIntFromObj(interp, objv[objc-1], &iRow); if( rc==TCL_OK ){ if( utf8Encoding!=NULL ){ Tcl_DString ds1, ds2, ds3; Tcl_UtfToExternalDString(utf8Encoding, zDb, -1, &ds1); Tcl_UtfToExternalDString(utf8Encoding, zTable, -1, &ds2); Tcl_UtfToExternalDString(utf8Encoding, zColumn, -1, &ds3); |
︙ | |||
3338 3339 3340 3341 3342 3343 3344 | 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 | + + + + + + + - - + + + + + + - - + + + + + + + + + + + + + + - + + - + - + | }else if( objc==4 ){ zDestDb = Tcl_GetString(objv[2]); zSrcFile = Tcl_GetString(objv[3]); }else{ Tcl_WrongNumArgs(interp, 2, objv, "?DATABASE? FILENAME"); return TCL_ERROR; } if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_UtfToExternalDString(utf8Encoding, zSrcFile, -1, &ds); rc = sqlite3_open_v2(Tcl_DStringValue(&ds), &pSrc, SQLITE_OPEN_READONLY | pDb->openFlags, 0); Tcl_DStringFree(&ds); }else{ |
︙ | |||
3395 3396 3397 3398 3399 3400 3401 | 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 | + + + + + + + - + + + | sqlite3_int64 sz = 0; unsigned char *pData; if( objc!=2 && objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "?DATABASE?"); rc = TCL_ERROR; }else{ int needFree; if( utf8Encoding!=NULL ){ Tcl_DString ds; Tcl_ExternalToUtfDString(utf8Encoding, (char*)zSchema, -1, &ds); pData = sqlite3_serialize(pDb->db, Tcl_DStringValue(&ds), &sz, SQLITE_SERIALIZE_NOCOPY); Tcl_DStringFree(&ds); } else { |
︙ | |||
3639 3640 3641 3642 3643 3644 3645 | 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 | - + | pScript = objv[objc-1]; /* Run the SQLite BEGIN command to open a transaction or savepoint. */ pDb->disableAuth++; rc = sqlite3_exec(pDb->db, zBegin, 0, 0, 0); pDb->disableAuth--; if( rc!=SQLITE_OK ){ |
︙ | |||
3688 3689 3690 3691 3692 3693 3694 | 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 | - + | xNotify = DbUnlockNotify; pNotifyArg = (void *)pDb; pDb->pUnlockNotify = objv[2]; Tcl_IncrRefCount(pDb->pUnlockNotify); } if( sqlite3_unlock_notify(pDb->db, xNotify, pNotifyArg) ){ |
︙ | |||
3772 3773 3774 3775 3776 3777 3778 | 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 | - + | } if( rc==SQLITE_OK ){ Tcl_Obj *pObj; pObj = Tcl_NewStringObj((char*)sqlite3_value_text(pValue), -1); Tcl_SetObjResult(interp, pObj); }else{ |
︙ | |||
4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 | 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 | + + + + + + + + + + + + + + - + + + + + + + + - + + | Tcl_AppendResult(interp, "unknown option: ", zArg, (char*)0); return TCL_ERROR; } } zErrMsg = 0; p = (SqliteDb*)Tcl_Alloc( sizeof(*p) ); memset(p, 0, sizeof(*p)); Tcl_DStringInit(&p->dsErr); if( zFile==0 ) zFile = ""; if( bTranslateFileName ){ zFile = Tcl_TranslateFileName(interp, zFile, &translatedFilename); } if( utf8Encoding!=NULL ){ Tcl_DString ds1, ds2; Tcl_UtfToExternalDString(utf8Encoding, zFile, -1, &ds1); if ( zVfs!=NULL ){ Tcl_UtfToExternalDString(utf8Encoding, zVfs, -1, &ds2); zVfs = Tcl_DStringValue(&ds2); } rc = sqlite3_open_v2(Tcl_DStringValue(&ds1), &p->db, flags, zVfs); Tcl_DStringFree(&ds1); if( zVfs!=NULL ){ Tcl_DStringFree(&ds2); } }else{ |
︙ | |||
4126 4127 4128 4129 4130 4131 4132 4133 4134 | 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + | /* The "sqlite" alias is undocumented. It is here only to support ** legacy scripts. All new scripts should use only the "sqlite3" ** command. */ Tcl_CreateObjCommand(interp, "sqlite", (Tcl_ObjCmdProc*)DbMain, 0, 0); #endif rc = Tcl_PkgProvideEx(interp, "sqlite3", PACKAGE_VERSION, NULL); } if( !utf8EncInit ){ Tcl_Encoding enc; Tcl_MutexLock(&utf8EncMutex); if( ++utf8EncInit>1 ){ goto utf8EncInitDone; } enc = Tcl_GetEncoding(NULL, "utf-8"); /* ** Try to detect the level of UTF-8 support in the Tcl core. */ if( enc!=NULL ){ const char probe1[] = { 0xF0, 0x9F, 0x98, 0x82 }; const char probe1sp[] = { 0xED, 0xA0, 0xBD, 0xED, 0xB8, 0x82 }; Tcl_DString ds; Tcl_ExternalToUtfDString(enc, probe1, sizeof(probe1), &ds); if( Tcl_DStringLength(&ds)==sizeof(probe1) && memcmp(probe1, Tcl_DStringValue(&ds), sizeof(probe1))==0 ){ /* ** Tcl core supports full Unicode. */ Tcl_FreeEncoding(enc); }else if( Tcl_DStringLength(&ds)==sizeof(probe1sp) && memcmp(probe1sp, Tcl_DStringValue(&ds), sizeof(probe1sp))==0 ){ /* ** Tcl core supports full Unicode using surrogate pairs, ** keep utf8Encoding for conversion to/from 4 byte UTF-8 sequences. */ utf8Encoding = enc; }else{ /* ** Tcl core supports BMP only, let SQLite handle corner cases. */ Tcl_FreeEncoding(enc); } Tcl_DStringFree(&ds); } utf8EncInitDone: Tcl_MutexUnlock(&utf8EncMutex); } return rc; } |
︙ |
Changes to jni/tcl/pkgs/tdbcmysql1.1.5/generic/tdbcmysql.c.
︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | + | * referring to it, which avoids taking down the hDBC until the * other objects that refer to it vanish. */ typedef struct ConnectionData { int refCount; /* Reference count. */ PerInterpData* pidata; /* Per-interpreter data */ Tcl_Encoding enc; /* "utf-8" encoding */ MYSQL* mysqlPtr; /* MySql connection handle */ unsigned int nCollations; /* Number of collations defined */ int* collationSizes; /* Character lengths indexed by collation ID */ int flags; } ConnectionData; /* |
︙ | |||
153 154 155 156 157 158 159 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | - + | * structure is reference counted as well. */ typedef struct StatementData { int refCount; /* Reference count */ ConnectionData* cdata; /* Data for the connection to which this * statement pertains. */ |
︙ | |||
325 326 327 328 329 330 331 | 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 | - + - + - + | const char* query; /* How to determine the option value? */ } ConnOptions [] = { { "-compress", TYPE_FLAG, CLIENT_COMPRESS, 0, "SELECT '', @@SLAVE_COMPRESSED_PROTOCOL" }, { "-database", TYPE_STRING, INDX_DB, CONN_OPT_FLAG_MOD, "SELECT '', DATABASE();"}, { "-db", TYPE_STRING, INDX_DB, CONN_OPT_FLAG_MOD |
︙ | |||
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | 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 | + + + + - - + + + | ISOL_REPEATABLE_READ, ISOL_SERIALIZABLE, ISOL_NONE = -1 }; /* Declarations of static functions appearing in this file */ static Tcl_Obj* StringObjFromExternal(ConnectionData* cdata, const char* string, int length); static char* ExternalFromStringObj(ConnectionData* cdata, Tcl_Obj* strObj, Tcl_DString* dsPtr); static MYSQL_BIND* MysqlBindAlloc(int nBindings); static MYSQL_BIND* MysqlBindIndex(MYSQL_BIND* b, int i); static void* MysqlBindAllocBuffer(MYSQL_BIND* b, int i, unsigned long len); static void MysqlBindFreeBuffer(MYSQL_BIND* b, int i); static void MysqlBindSetBufferType(MYSQL_BIND* b, int i, enum enum_field_types t); static void* MysqlBindGetBuffer(MYSQL_BIND* b, int i); static unsigned long MysqlBindGetBufferLength(MYSQL_BIND* b, int i); static void MysqlBindSetLength(MYSQL_BIND* b, int i, unsigned long* p); static void MysqlBindSetIsNull(MYSQL_BIND* b, int i, my_bool* p); static void MysqlBindSetError(MYSQL_BIND* b, int i, my_bool* p); static MYSQL_FIELD* MysqlFieldIndex(MYSQL_FIELD* fields, int i); |
︙ | |||
455 456 457 458 459 460 461 | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | - + + | static void DeleteConnection(ConnectionData* cdata); static int CloneConnection(Tcl_Interp* interp, ClientData oldClientData, ClientData* newClientData); static StatementData* NewStatement(ConnectionData* cdata); static MYSQL_STMT* AllocAndPrepareStatement(Tcl_Interp* interp, StatementData* sdata); |
︙ | |||
706 707 708 709 710 711 712 | 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | /* Methods to create on the result set class */ const static Tcl_MethodType* ResultSetMethods[] = { &ResultSetColumnsMethodType, &ResultSetRowcountMethodType, NULL }; |
︙ | |||
978 979 980 981 982 983 984 | 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 | + - + - + + - + | * Sets the interpreter result and error code to describe the SQL error * *----------------------------------------------------------------------------- */ static void TransferMysqlError( ConnectionData* cdata, /* Connection data */ |
︙ | |||
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | 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 | + - + + + | * Sets the interpreter result and error code to describe the SQL error * *----------------------------------------------------------------------------- */ static void TransferMysqlStmtError( ConnectionData* cdata, /* Connection data */ Tcl_Interp* interp, /* Tcl interpreter */ MYSQL_STMT* stmtPtr /* MySQL statment handle */ ) { const char* sqlstate = mysql_stmt_sqlstate(stmtPtr); Tcl_Obj* errorCode = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, errorCode, Tcl_NewStringObj("TDBC", -1)); Tcl_ListObjAppendElement(NULL, errorCode, Tcl_NewStringObj(Tdbc_MapSqlState(sqlstate), -1)); Tcl_ListObjAppendElement(NULL, errorCode, Tcl_NewStringObj(sqlstate, -1)); Tcl_ListObjAppendElement(NULL, errorCode, Tcl_NewStringObj("MYSQL", -1)); Tcl_ListObjAppendElement(NULL, errorCode, Tcl_NewWideIntObj(mysql_stmt_errno(stmtPtr))); Tcl_SetObjErrorCode(interp, errorCode); |
︙ | |||
1059 1060 1061 1062 1063 1064 1065 | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | - + - + - + - + | MYSQL_RES* result; /* Result of the MySQL query for the option */ MYSQL_ROW row; /* Row of the result set */ int fieldCount; /* Number of fields in a row */ unsigned long* lengths; /* Character lengths of the fields */ Tcl_Obj* retval; /* Return value */ if (mysql_query(cdata->mysqlPtr, ConnOptions[optionNum].query)) { |
︙ | |||
1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 | + + | int objc, /* Parameter count */ Tcl_Obj* const objv[], /* Parameter data */ int skip /* Number of parameters to skip */ ) { const char* stringOpts[INDX_MAX]; /* String-valued options */ Tcl_DString stringBufs[INDX_MAX]; unsigned long mysqlFlags=0; /* Connection flags */ int sslFlag = 0; /* Flag==1 if SSL configuration is needed */ int optionIndex; /* Index of the current option in ConnOptions */ int optionValue; /* Integer value of the current option */ unsigned short port = 0; /* Server port number */ int isolation = ISOL_NONE; /* Isolation level */ int timeout = 0; /* Timeout value */ int i; Tcl_Obj* retval; Tcl_Obj* optval; int result = TCL_ERROR; if (cdata->mysqlPtr != NULL) { /* Query configuration options on an existing connection */ if (objc == skip) { retval = Tcl_NewObj(); |
︙ | |||
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | + - + - + - + - + - + - + - + - + - + - + - + - + | return TCL_ERROR; } /* Extract options from the command line */ for (i = 0; i < INDX_MAX; ++i) { stringOpts[i] = NULL; Tcl_DStringInit(&stringBufs[i]); } for (i = skip; i < objc; i += 2) { /* Unknown option */ if (Tcl_GetIndexFromObjStruct(interp, objv[i], (void*) ConnOptions, sizeof(ConnOptions[0]), "option", 0, &optionIndex) != TCL_OK) { |
︙ | |||
1306 1307 1308 1309 1310 1311 1312 | 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 | - - + + - - + + - - + + - - + + - + - + - - - - + + + + + + + + + + - + | * TODO - mutex around this unless linked to libmysqlclient_r ? */ if (mysql_real_connect(cdata->mysqlPtr, stringOpts[INDX_HOST], stringOpts[INDX_USER], stringOpts[INDX_PASSWD], stringOpts[INDX_DB], port, stringOpts[INDX_SOCKET], mysqlFlags) == NULL) { |
︙ | |||
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | + | ConnectionData* cdata; /* Per-connection data */ /* Hang client data on this connection */ cdata = (ConnectionData*) ckalloc(sizeof(ConnectionData)); cdata->refCount = 1; cdata->pidata = pidata; cdata->enc = Tcl_GetEncoding(NULL, "utf-8"); cdata->mysqlPtr = NULL; cdata->nCollations = 0; cdata->collationSizes = NULL; cdata->flags = 0; IncrPerInterpRefCount(pidata); Tcl_ObjectSetMetadata(thisObject, &connectionDataType, (ClientData) cdata); |
︙ | |||
1476 1477 1478 1479 1480 1481 1482 | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 | - + | } cdata->flags |= CONN_FLAG_IN_XCN; /* Turn off autocommit for the duration of the transaction */ if (cdata->flags & CONN_FLAG_AUTOCOMMIT) { if (mysql_autocommit(cdata->mysqlPtr, 0)) { |
︙ | |||
1543 1544 1545 1546 1547 1548 1549 | 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 | - + + - + | Tcl_WrongNumArgs(interp, 2, objv, "table ?pattern?"); return TCL_ERROR; } results = mysql_list_fields(cdata->mysqlPtr, Tcl_GetString(objv[2]), patternStr); if (results == NULL) { |
︙ | |||
1644 1645 1646 1647 1648 1649 1650 | 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 | - + | } /* End transaction, turn off "transaction in progress", and report status */ rc = mysql_commit(cdata->mysqlPtr); cdata->flags &= ~ CONN_FLAG_IN_XCN; if (rc) { |
︙ | |||
1735 1736 1737 1738 1739 1740 1741 | 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 | - + + - - + + + + + - + - + | static int ConnectionEvaldirectMethod( ClientData clientData, /* Unused */ Tcl_Interp* interp, /* Tcl interpreter */ Tcl_ObjectContext objectContext, /* Object context */ int objc, /* Parameter count */ |
︙ | |||
1913 1914 1915 1916 1917 1918 1919 | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 | - + | } /* End transaction, turn off "transaction in progress", and report status */ rc = mysql_rollback(cdata->mysqlPtr); cdata->flags &= ~CONN_FLAG_IN_XCN; if (rc) { |
︙ | |||
2065 2066 2067 2068 2069 2070 2071 | 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 | - + - - + - + | } else { Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } results = mysql_list_tables(cdata->mysqlPtr, patternStr); if (results == NULL) { |
︙ | |||
2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 | 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 | + | if (cdata->collationSizes != NULL) { ckfree((char*) cdata->collationSizes); } if (cdata->mysqlPtr != NULL) { mysql_close(cdata->mysqlPtr); } DecrPerInterpRefCount(cdata->pidata); Tcl_FreeEncoding(cdata->enc); ckfree((char*) cdata); } /* *----------------------------------------------------------------------------- * * CloneConnection -- |
︙ | |||
2281 2282 2283 2284 2285 2286 2287 | 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 | - + + - + + + - + + | /* * MySQL allows only one writable cursor open at a time, and * the default cursor type is writable. Make all our cursors * read-only to avoid 'Commands out of sync' errors. */ if (stmtPtr == NULL) { |
︙ | |||
2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 | 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 | + - + - + + | * column name. * *----------------------------------------------------------------------------- */ static Tcl_Obj* ResultDescToTcl( ConnectionData* cdata, /* Connection data */ MYSQL_RES* result, /* Result set description */ int flags /* Flags governing the conversion */ ) { Tcl_Obj* retval = Tcl_NewObj(); Tcl_HashTable names; /* Hash table to resolve name collisions */ Tcl_Obj* nameObj; /* Name of a result column */ int isNew; /* Flag == 1 if a result column is unique */ Tcl_HashEntry* entry; /* Hash table entry for a column name */ Tcl_HashEntry* countEntry; /* Ditto */ int count; /* Number used to disambiguate a column name */ Tcl_InitHashTable(&names, TCL_STRING_KEYS); if (result != NULL) { unsigned int fieldCount = mysql_num_fields(result); MYSQL_FIELD* fields = mysql_fetch_fields(result); unsigned int i; for (i = 0; i < fieldCount; ++i) { MYSQL_FIELD* field = MysqlFieldIndex(fields, i); |
︙ | |||
2499 2500 2501 2502 2503 2504 2505 | 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 | - + - + | goto freeSData; } /* Get result set metadata */ sdata->metadataPtr = mysql_stmt_result_metadata(sdata->stmtPtr); if (mysql_stmt_errno(sdata->stmtPtr)) { |
︙ | |||
2917 2918 2919 2920 2921 2922 2923 | 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 | - + | /* * If there is no transaction in progress, turn on auto-commit so that * this statement will execute directly. */ if ((cdata->flags & (CONN_FLAG_IN_XCN | CONN_FLAG_AUTOCOMMIT)) == 0) { if (mysql_autocommit(cdata->mysqlPtr, 1)) { |
︙ | |||
3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 | 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 | + + | /* * At this point, paramValObj contains the parameter to bind. * Convert the parameters to the appropriate data types for * MySQL's prepared statement interface, and bind them. */ if (paramValObj != NULL) { Tcl_DString ds; switch (sdata->params[nBound].dataType & 0xffff) { case MYSQL_TYPE_NEWDECIMAL: case MYSQL_TYPE_DECIMAL: if (sdata->params[nBound].scale == 0) { if (sdata->params[nBound].precision < 10) { goto smallinteger; |
︙ | |||
3128 3129 3130 3131 3132 3133 3134 | 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 | - + + + + + + | MysqlBindSetBufferType(rdata->paramBindings, nBound, MYSQL_TYPE_BLOB); paramValStr = (char*) Tcl_GetByteArrayFromObj(paramValObj, &len); } else { MysqlBindSetBufferType(rdata->paramBindings, nBound, MYSQL_TYPE_STRING); |
︙ | |||
3163 3164 3165 3166 3167 3168 3169 | 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 | - + | */ if (mysql_stmt_bind_param(rdata->stmtPtr, rdata->paramBindings) || ((nColumns > 0) && mysql_stmt_bind_result(rdata->stmtPtr, resultBindings)) || mysql_stmt_execute(rdata->stmtPtr) || mysql_stmt_store_result(rdata->stmtPtr) ) { |
︙ | |||
3371 3372 3373 3374 3375 3376 3377 | 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 | - - + + | break; default: if (field->charsetnr == 63) { colObj = Tcl_NewByteArrayObj((unsigned char*) bufPtr, resultLengths[i]); } else { |
︙ | |||
3403 3404 3405 3406 3407 3408 3409 | 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 | - + | } Tcl_SetObjResult(interp, literals[LIT_1]); status = TCL_OK; cleanup: if (status != TCL_OK) { |
︙ |
Changes to jni/tcl/pkgs/tdbcodbc1.1.1/generic/tdbcodbc.c.
︙ | |||
818 819 820 821 822 823 824 | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | - + | unsigned int ch; int bytes; ch = ptr16[i]; if (ch > 0x10ffff) { ch = 0xfffd; } |
︙ | |||
845 846 847 848 849 850 851 | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | - + | unsigned int ch; int bytes; ch = ptr32[i]; if (ch > 0x10ffff) { ch = 0xfffd; } |
︙ | |||
915 916 917 918 919 920 921 | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | - + | if (Tcl_UtfCharComplete(bytes, end - bytes)) { bytes += Tcl_UtfToUniChar(bytes, &ch); } else { ch = *bytes++ & 0x00ff; } uch = ch; |
︙ | |||
941 942 943 944 945 946 947 | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | - + | if (Tcl_UtfCharComplete(bytes, end - bytes)) { bytes += Tcl_UtfToUniChar(bytes, &ch); } else { ch = *bytes++ & 0x00ff; } uch = ch; |
︙ |
Changes to jni/tcl/pkgs/tdbcpostgres1.1.1/generic/tdbcpostgres.c.
︙ | |||
190 191 192 193 194 195 196 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - + | static char* _PQport(const PGconn* conn) { return PQport(conn); } static char* _PQuser(const PGconn* conn) { return PQuser(conn); } static char* _PQtty(const PGconn* conn) { return PQtty(conn); } /* Table of configuration options */ static const struct { |
︙ | |||
254 255 256 257 258 259 260 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | + - + - + | * destruction until the last statement or result set that refers * to it is destroyed. */ typedef struct ConnectionData { int refCount; /* Reference count. */ PerInterpData* pidata; /* Per-interpreter data */ Tcl_Encoding enc; /* "utf-8" encoding */ |
︙ | |||
396 397 398 399 400 401 402 403 404 405 406 | 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 | + + + + - - - - + + + + + | ISOL_REPEATABLE_READ, ISOL_SERIALIZABLE, ISOL_NONE = -1 }; /* Static functions defined within this file */ static Tcl_Obj* StringObjFromExternal(ConnectionData* cdata, const char* string, int length); static char* ExternalFromStringObj(ConnectionData* cdata, Tcl_Obj* strObj, Tcl_DString* dsPtr); static int DeterminePostgresMajorVersion(Tcl_Interp* interp, ConnectionData* cdata, int* versionPtr); static void DummyNoticeProcessor(void*, const PGresult*); |
︙ | |||
442 443 444 445 446 447 448 | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | - + + | ClientData* newClientData); static char* GenStatementName(ConnectionData* cdata); static void UnallocateStatement(PGconn* pgPtr, char* stmtName); static StatementData* NewStatement(ConnectionData* cdata); static PGresult* PrepareStatement(Tcl_Interp* interp, StatementData* sdata, char* stmtName); |
︙ | |||
675 676 677 678 679 680 681 682 683 684 685 686 687 688 | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | &StatementParamtypeMethodType, NULL }; /* *----------------------------------------------------------------------------- * * StringObjFromExternal -- * * Return a new Tcl string object from a string with conversion from * external to internal utf-8 encoding. * * Results: * New string object. * *----------------------------------------------------------------------------- */ static Tcl_Obj* StringObjFromExternal( ConnectionData* cdata, /* Connection data */ const char* string, /* String to convert */ int length /* Length of string */ ) { Tcl_DString ds; Tcl_Obj* obj; Tcl_ExternalToUtfDString(cdata->enc, string, length, &ds); obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); return obj; } /* *----------------------------------------------------------------------------- * * ExternalFromStringObj -- * * Return a string from Tcl_Obj* in an uninitialized Tcl_DString * which the caller must free. The resulting string is converted * to external utf-8 encoding. * * Results: * New string in provided Tcl_DString. * *----------------------------------------------------------------------------- */ static char* ExternalFromStringObj( ConnectionData* cdata, /* Connection data */ Tcl_Obj* strObj, /* Tcl_Obj to convert */ Tcl_DString *dsPtr /* Result area */ ) { Tcl_UtfToExternalDString(cdata->enc, Tcl_GetString(strObj), -1, dsPtr); return Tcl_DStringValue(dsPtr); } /* *----------------------------------------------------------------------------- * * DummyNoticeReceiver -- * * Ignores warnings and notices from the PostgreSQL client library * * Results: * None. * |
︙ | |||
710 711 712 713 714 715 716 | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 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 | - + + - - + - + + + - + - + | * Results: * TCL_OK on success or the error was non fatal otherwise TCL_ERROR . * * Side effects: * Sets the interpreter result and error code appropiately to * query execution process. Optionally, when res parameter is * not NULL and the execution is successful, it returns the |
︙ | |||
772 773 774 775 776 777 778 | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | + - + - + + - + + - + + - + - + - + | * connection error. * *----------------------------------------------------------------------------- */ static void TransferPostgresError( ConnectionData* cdata, /* Connection data */ |
︙ | |||
870 871 872 873 874 875 876 | 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | - - - + + + - - - + - + | * Side effects: * Stores the version number in '*versionPtr' if successful. * *----------------------------------------------------------------------------- */ static int |
︙ | |||
922 923 924 925 926 927 928 | 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 | - + - + - - + + - + | QueryConnectionOption ( ConnectionData* cdata, /* Connection data */ Tcl_Interp* interp, /* Tcl interpreter */ int optionNum /* Position of the option in the table */ ) { PerInterpData* pidata = cdata->pidata; /* Per-interpreter data */ Tcl_Obj** literals = pidata->literals; |
︙ | |||
991 992 993 994 995 996 997 | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | - + | return literals[LIT_1]; } } if (ConnOptions[optionNum].queryF != NULL) { value = ConnOptions[optionNum].queryF(cdata->pgPtr); if (value != NULL) { |
︙ | |||
1037 1038 1039 1040 1041 1042 1043 | 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 | - + + | ) { int optionIndex; /* Index of the current option in * ConnOptions */ int optionValue; /* Integer value of the current option */ int i; size_t j; char portval[16]; /* String representation of port number */ |
︙ | |||
1095 1096 1097 1098 1099 1100 1101 | 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 | + + - + + | Tcl_WrongNumArgs(interp, skip, objv, "?-option value?..."); return TCL_ERROR; } /* Extract options from the command line */ for (i = 0; i < INDX_MAX; ++i) { if (cdata->savedOpts[i] != NULL) { ckfree(cdata->savedOpts[i]); |
︙ | |||
1125 1126 1127 1128 1129 1130 1131 1132 | 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 | + - + + | return TCL_ERROR; } /* Record option value */ switch (ConnOptions[optionIndex].type) { case TYPE_STRING: valPtr = Tcl_GetString(objv[i+1]); cdata->savedOpts[ConnOptions[optionIndex].info] = |
︙ | |||
1151 1152 1153 1154 1155 1156 1157 | 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | - + + | "be in range " "[0..65535]", -1)); Tcl_SetErrorCode(interp, "TDBC", "GENERAL_ERROR", "HY000", "POSTGRES", "-1", NULL); return TCL_ERROR; } snprintf(portval, 16, "%d", optionValue); |
︙ | |||
1189 1190 1191 1192 1193 1194 1195 | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 | - + - + - + - + - + | "propably out of memory.", -1)); Tcl_SetErrorCode(interp, "TDBC", "GENERAL_ERROR", "HY001", "POSTGRES", "NULL", NULL); return TCL_ERROR; } if (PQstatus(cdata->pgPtr) != CONNECTION_OK) { |
︙ | |||
1245 1246 1247 1248 1249 1250 1251 | 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | - + | /* * On PostgreSQL 9.0 and later, change 'bytea_output' to the * backward-compatible 'escape' setting, so that the code in * ResultSetNextrowMethod will retrieve byte array values correctly * on either 8.x or 9.x servers. */ if (vers >= 9) { |
︙ | |||
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 | + | /* Hang client data on this connection */ cdata = (ConnectionData*) ckalloc(sizeof(ConnectionData)); memset(cdata, 0, sizeof(ConnectionData)); cdata->refCount = 1; cdata->pidata = pidata; cdata->enc = Tcl_GetEncoding(NULL, "utf-8"); cdata->pgPtr = NULL; cdata->stmtCounter = 0; cdata->flags = 0; cdata->isolation = ISOL_NONE; cdata->readOnly = 0; IncrPerInterpRefCount(pidata); Tcl_ObjectSetMetadata(thisObject, &connectionDataType, (ClientData) cdata); |
︙ | |||
1364 1365 1366 1367 1368 1369 1370 | 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 | - + | "POSTGRES", "-1", NULL); return TCL_ERROR; } cdata->flags |= CONN_FLAG_IN_XCN; /* Execute begin trasnaction block command */ |
︙ | |||
1422 1423 1424 1425 1426 1427 1428 | 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | - + | "POSTGRES", "-1", NULL); return TCL_ERROR; } cdata->flags &= ~ CONN_FLAG_IN_XCN; /* Execute commit SQL command */ |
︙ | |||
1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 | + - + + + + | char* columnName; /* Name of the column */ Oid typeOid; /* Oid of column type */ Tcl_Obj* retval; /* List of table names */ Tcl_Obj* attrs; /* Attributes of the column */ Tcl_Obj* name; /* Name of a column */ Tcl_Obj* sqlQuery = Tcl_NewStringObj("SELECT * FROM \"", -1); /* Query used */ Tcl_DString ds; Tcl_IncrRefCount(sqlQuery); /* Check parameters */ if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "table ?pattern?"); return TCL_ERROR; } /* Check if table exists by retreiving one row. * The result will be later used to determine column types (oids) */ Tcl_AppendObjToObj(sqlQuery, objv[2]); Tcl_AppendToObj(sqlQuery, "\" LIMIT 1", -1); |
︙ | |||
1512 1513 1514 1515 1516 1517 1518 | 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | - - + + + + + + - + | if (objc == 4) { Tcl_AppendToObj(sqlQuery, "' AND column_name LIKE '", -1); Tcl_AppendObjToObj(sqlQuery, objv[3]); } Tcl_AppendToObj(sqlQuery, "'", -1); |
︙ | |||
1552 1553 1554 1555 1556 1557 1558 | 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 | - + - + - + | } } /* 1 is numeric_precision column number */ if (!PQgetisnull(res, i, 1)) { Tcl_DictObjPut(NULL, attrs, literals[LIT_PRECISION], |
︙ | |||
1695 1696 1697 1698 1699 1700 1701 | 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | - + | "POSTGRES", "-1", NULL); return TCL_ERROR; } cdata->flags &= ~CONN_FLAG_IN_XCN; /* Send end transaction SQL command */ |
︙ | |||
1734 1735 1736 1737 1738 1739 1740 | 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 | - + + + - + - + + + + - + | /* The current connection object */ ConnectionData* cdata = (ConnectionData*) Tcl_ObjectGetMetadata(thisObject, &connectionDataType); /* Instance data */ Tcl_Obj** literals = cdata->pidata->literals; /* Literal pool */ PGresult* res; /* Result of libpq call */ |
︙ | |||
1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 | + + + + + + + + + | DecrConnectionRefCount((ConnectionData*)clientData); } static void DeleteConnection( ConnectionData* cdata /* Instance data for the connection */ ) { int i; if (cdata->pgPtr != NULL) { PQfinish(cdata->pgPtr); } DecrPerInterpRefCount(cdata->pidata); for (i = 0; i < INDX_MAX; ++i) { if (cdata->savedOpts[i] != NULL) { ckfree(cdata->savedOpts[i]); cdata->savedOpts[i] = NULL; } } Tcl_FreeEncoding(cdata->enc); ckfree(cdata); } /* *----------------------------------------------------------------------------- * * CloneConnection -- |
︙ | |||
1946 1947 1948 1949 1950 1951 1952 | 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 | - + - + | * Nothing. * *----------------------------------------------------------------------------- */ static void UnallocateStatement( |
︙ | |||
2013 2014 2015 2016 2017 2018 2019 | 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 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 | - + - + - + + - + - + | *----------------------------------------------------------------------------- */ static PGresult* PrepareStatement( Tcl_Interp* interp, /* Tcl interpreter for error reporting */ StatementData* sdata, /* Statement data */ |
︙ | |||
2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 | 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 | + - + - + - + + | * column name. * *----------------------------------------------------------------------------- */ static Tcl_Obj* ResultDescToTcl( ConnectionData* cdata, /* Instance data for the connection */ PGresult* result, /* Result set description */ int flags /* Flags governing the conversion */ ) { Tcl_Obj* retval = Tcl_NewObj(); Tcl_HashTable names; /* Hash table to resolve name collisions */ |
︙ | |||
2281 2282 2283 2284 2285 2286 2287 | 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 | - + | /* Prepare the statement */ res = PrepareStatement(interp, sdata, NULL); if (res == NULL) { goto freeSData; } |
︙ | |||
2656 2657 2658 2659 2660 2661 2662 | 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 | - + | int* paramLengths; /* Table of parameter lengths */ int* paramFormats; /* Table of parameter formats * (binary or string) */ char* paramNeedsFreeing; /* Flags for whether a parameter needs * its memory released */ Tcl_Obj** paramTempObjs; /* Temporary parameter objects allocated * to canonicalize numeric parameter values */ |
︙ | |||
2710 2711 2712 2713 2714 2715 2716 | 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 | - + | if (sdata->flags & STMT_FLAG_BUSY) { rdata->stmtName = GenStatementName(cdata); res = PrepareStatement(interp, sdata, rdata->stmtName); if (res == NULL) { return TCL_ERROR; } |
︙ | |||
2732 2733 2734 2735 2736 2737 2738 | 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 | - + + + | ckfree(sdata->stmtName); sdata->stmtName = GenStatementName(cdata); rdata->stmtName = sdata->stmtName; res = PrepareStatement(interp, sdata, NULL); if (res == NULL) { return TCL_ERROR; } |
︙ | |||
2771 2772 2773 2774 2775 2776 2777 | 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 | - + | paramValObj = Tcl_GetVar2Ex(interp, paramName, NULL, TCL_LEAVE_ERR_MSG); } /* At this point, paramValObj contains the parameter value */ if (paramValObj != NULL) { |
︙ | |||
2826 2827 2828 2829 2830 2831 2832 | 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 | - - + + + - - + + + - - + + + + - + - + + + | Tcl_WideInt val; if (Tcl_GetWideIntFromObj(NULL, paramValObj, &val) == TCL_OK) { paramTempObjs[i] = Tcl_NewWideIntObj(val); Tcl_IncrRefCount(paramTempObjs[i]); paramFormats[i] = 0; paramValues[i] = |
︙ | |||
3005 3006 3007 3008 3009 3010 3011 | 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 | - + | int nColumns = 0; /* Number of columns in the result set */ Tcl_Obj* colObj; /* Column obtained from the row */ Tcl_Obj* colName; /* Name of the current column */ Tcl_Obj* resultRow; /* Row of the result set under construction */ int status = TCL_ERROR; /* Status return from this command */ |
︙ | |||
3043 3044 3045 3046 3047 3048 3049 | 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 | - + - + | buffer = PQgetvalue(rdata->execResult, rdata->rowCount, i); if (PQftype(rdata->execResult, i) == BYTEAOID) { /* * Postgres returns backslash-escape sequences for * binary data. Substitute them away. */ Tcl_Obj* toSubst; |
︙ | |||
3176 3177 3178 3179 3180 3181 3182 | 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 | - + | ResultSetRowcountMethod( ClientData clientData, /* Not used */ Tcl_Interp* interp, /* Tcl interpreter */ Tcl_ObjectContext context, /* Object context */ int objc, /* Parameter count */ Tcl_Obj *const objv[] /* Parameter vector */ ) { |
︙ | |||
3198 3199 3200 3201 3202 3203 3204 | 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 | - + | } nTuples = PQcmdTuples(rdata->execResult); if (strlen(nTuples) == 0) { Tcl_SetObjResult(interp, literals[LIT_0]); } else { Tcl_SetObjResult(interp, |
︙ |
Changes to jni/tcl/tcl-config.mk.
︙ | |||
49 50 51 52 53 54 55 | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - + | -DHAVE_ZLIB=1 \ -DMP_PREC=4 \ -DMP_FIXED_CUTOFFS=1 \ -DMP_NO_STDINT=1 \ -DTCL_TOMMATH=1 \ -D_REENTRANT=1 \ -D_THREADSAFE=1 \ |
︙ |
Changes to jni/tcl/tests/cmdIL.test.
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - | ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] testConstraint testobj [llength [info commands testobj]] |
︙ | |||
501 502 503 504 505 506 507 | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | - + - + - + - + - + - + - + | test_lsort 0 } -result 0 -cleanup { rename test_lsort "" } test cmdIL-5.6 {lsort with multiple list-style index options} { lsort -index {1 2 3} -index 0 {{a b} {c d} {b e}} } {{a b} {b e} {c d}} |
︙ |
Changes to jni/tcl/tests/encoding.test.
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - - + | proc runtests {} { variable x # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] testConstraint testbytestring [llength [info commands testbytestring]] testConstraint teststringbytes [llength [info commands teststringbytes]] |
︙ | |||
303 304 305 306 307 308 309 | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | - - - + + + + - + | append x [encoding convertfrom jis0208 8C&A] } "8C&A\u4e4e\u3b1" test encoding-12.5 {LoadTableEncoding: symbol encoding} { set x [encoding convertto symbol \u3b3] append x [encoding convertto symbol \u67] append x [encoding convertfrom symbol \x67] } "\x67\x67\u3b3" |
︙ | |||
329 330 331 332 333 334 335 | 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 430 431 432 433 434 435 436 437 | - - - + + + + + + - + - - - - - - - - + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - + - + + + + + + - + | set z } 00 test encoding-15.3 {UtfToUtfProc null character input} teststringbytes { set y [encoding convertfrom utf-8 [encoding convertto utf-8 \u0000]] binary scan [teststringbytes $y] H* z set z } c080 |
︙ |
Changes to jni/tcl/tests/scan.test.
︙ | |||
83 84 85 86 87 88 89 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | - + + | } } } testConstraint ieeeFloatingPoint [testIEEE] testConstraint wideIs64bit \ [expr {(wide(0x80000000) > 0) && (wide(0x8000000000000000) < 0)}] |
︙ |
Changes to jni/tcl/tests/split.test.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - | # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. if {"::tcltest" ni [namespace children]} { package require tcltest 2.5 namespace import -force ::tcltest::* } |
︙ | |||
67 68 69 70 71 72 73 | 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 | - + - + - + - + - + | } {{} ab cd {} ef {}} test split-1.13 {basic split commands} { split "12,34,56," {,} } {12 34 56 {}} test split-1.14 {basic split commands} { split ",12,,,34,56," {,} } {{} 12 {} {} 34 56 {}} |
︙ |
Changes to jni/tcl/tests/string.test.
︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - - + - | catch [list package require -exact Tcltest [info patchlevel]] # Some tests require the testobj command testConstraint testobj [expr {[info commands testobj] != {}}] testConstraint testindexobj [expr {[info commands testindexobj] != {}}] testConstraint testevalex [expr {[info commands testevalex] != {}}] |
︙ | |||
1327 1328 1329 1330 1331 1332 1333 | 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 | - + + + + | list $input_hex $rxBuffer_hex $rxCRC_hex } {000341 000341 0341} test string-12.22.$noComp {string range, shimmering binary/index} { set s 0000000001 binary scan $s a* x run {string range $s $s end} } 000000001 |
︙ | |||
1661 1662 1663 1664 1665 1666 1667 | 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 | - + - - + + - - + + - + | } -result 6 test string-21.13.$noComp {string wordend, unicode} -body { run {string wordend "xyz\u2045de fg" 0} } -result 3 test string-21.14.$noComp {string wordend, unicode} -body { run {string wordend "\uC700\uC700 abc" 8} } -result 6 |
︙ | |||
1715 1716 1717 1718 1719 1720 1721 | 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 | - + - + - - + + - + - + | run {string wordstart "\uC700\uC700 abc" 8} } -result 3 test string-22.14.$noComp {string wordstart, invalid UTF-8} -constraints testbytestring -body { # See Bug c61818e4c9 set demo [testbytestring "abc def\xE0\xA9ghi"] run {string index $demo [string wordstart $demo 10]} } -result g |
︙ | |||
1841 1842 1843 1844 1845 1846 1847 | 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 | - + - + - + - + | binary scan [run {string reverse [binary format H* 010203]}] H* x set x } 030201 test string-24.15.$noComp {string reverse command - pure bytearray} { binary scan [run {tcl::string::reverse [binary format H* 010203]}] H* x set x } 030201 |
︙ |
Changes to jni/tcl/tests/stringComp.test.
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - | ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] # Some tests require the testobj command testConstraint testobj [expr {[info commands testobj] != {}}] |
︙ | |||
224 225 226 227 228 229 230 | 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 | - - - - - - - + - + - + - + | } 0 {} {unicode beyond U+FFFF} { string compare \uD83D\uDE00 \uD83D\uDE01\U0001F600\U0001F601 } -1 {} } { if {$tname eq ""} { continue } if {$tcode eq ""} { set tcode ok } |
︙ | |||
733 734 735 736 737 738 739 | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | - + - + - + - + | [string match *a*l*\u0000*123 $longString] \ [string match *a*l*\u0000*123* $longString] \ [string match *a*l*\u0000*cba* $longString] \ [string match *===* $longString] } foo } {0 1 1 1 0 0} |
︙ |
Changes to jni/tcl/tests/utf.test.
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - - + | } namespace path ::tcl::mathop ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] |
︙ | |||
49 50 51 52 53 54 55 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 93 94 95 96 97 98 99 100 101 102 103 104 105 | - - + + - + - + - + - + + + + - + + + + - + + + + | } 1 test utf-1.5 {Tcl_UniCharToUtf: overflowed Tcl_UniChar} testbytestring { expr {[format %c 0x110000] eq [testbytestring \xEF\xBF\xBD]} } 1 test utf-1.6 {Tcl_UniCharToUtf: negative Tcl_UniChar} testbytestring { expr {[format %c -1] eq [testbytestring \xEF\xBF\xBD]} } 1 |
︙ | |||
108 109 110 111 112 113 114 | 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 | - + - - - - + - - - - + - + | } 1 test utf-2.6 {Tcl_UtfToUniChar: lead (3-byte) followed by 1 trail} testbytestring { string length [testbytestring \xE2\xA2] } 2 test utf-2.7 {Tcl_UtfToUniChar: lead (3-byte) followed by 2 trail} testbytestring { string length [testbytestring \xE4\xB9\x8E] } 1 |
︙ | |||
171 172 173 174 175 176 177 | 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 | - + + - + + - + - - - + - + - + - - - - + - - - | # Bug [2738427]: Tcl_NumUtfChars(...) no overflow check test utf-4.9 {Tcl_NumUtfChars: #u20AC, calc len, incomplete} {testnumutfchars testbytestring} { testnumutfchars [testbytestring \xE2\x82\xAC] end-1 } 2 test utf-4.10 {Tcl_NumUtfChars: #u0000, calc len, overcomplete} {testnumutfchars testbytestring} { testnumutfchars [testbytestring \x00] end+1 } 2 |
︙ | |||
421 422 423 424 425 426 427 | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | - + - + - + - + - + - + - + - + - + - + - + - + - + - + | } 3 test utf-6.67 {Tcl_UtfNext} testutfnext { testutfnext \xE8\xA0\xA0\xF8 } 3 test utf-6.68 {Tcl_UtfNext} testutfnext { testutfnext \xF2\xA0\xA0G } 1 |
︙ | |||
496 497 498 499 500 501 502 | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | - + - + - + - + - + - + - + - - - - + | } 1 test utf-6.85 {Tcl_UtfNext - overlong sequences} testutfnext { testutfnext \xE0\xA0\x80 } 3 test utf-6.86 {Tcl_UtfNext - overlong sequences} testutfnext { testutfnext \xF0\x80\x80\x80 } 1 |
︙ | |||
577 578 579 580 581 582 583 | 570 571 572 573 574 575 576 577 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 | + + + + + + + + + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + | } 0 test utf-6.108 {Tcl_UtfNext, read limits} testutfnext { testutfnext \xE8\xA0\xA0\xA0 2 } 0 test utf-6.109 {Tcl_UtfNext, read limits} testutfnext { testutfnext \xE8\xA0\xA0\xA0 3 } 3 test utf-6.108.0 {Tcl_UtfNext, read limits} {testutfnext wtf8} { testutfnext \xF2\xA0\xA0\xA0G 1 } 1 test utf-6.108.1 {Tcl_UtfNext, read limits} {testutfnext ucs4} { testutfnext \xF2\xA0\xA0\xA0G 1 } 0 test utf-6.109.0 {Tcl_UtfNext, read limits} {testutfnext wtf8} { testutfnext \xF2\xA0\xA0\xA0G 2 } 1 test utf-6.109.1 {Tcl_UtfNext, read limits} {testutfnext ucs4} { testutfnext \xF2\xA0\xA0\xA0G 2 } 0 |
︙ | |||
716 717 718 719 720 721 722 | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | - + - + - + - + - + - + | } 2 test utf-7.9.1 {Tcl_UtfPrev} testutfprev { testutfprev A\xF8\xA0\xA0\xA0 3 } 2 test utf-7.9.2 {Tcl_UtfPrev} testutfprev { testutfprev A\xF8\xA0\xF8\xA0 3 } 2 |
︙ | |||
773 774 775 776 777 778 779 | 778 779 780 781 782 783 784 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 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | - + - + - + - + - + - + - + - - - - - + + + + + - - + + - - - - + + + + - + - + - - - - + - + - + - + - + - + - + | } 3 test utf-7.14.1 {Tcl_UtfPrev} testutfprev { testutfprev A\xF8\xA0\xA0\xA0 4 } 3 test utf-7.14.2 {Tcl_UtfPrev} testutfprev { testutfprev A\xF8\xA0\xA0\xF8 4 } 3 |
︙ | |||
878 879 880 881 882 883 884 | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | - + - + | } 2 test utf-7.28 {Tcl_UtfPrev -- overlong sequence} testutfprev { testutfprev A\xE0 } 1 test utf-7.28.1 {Tcl_UtfPrev -- overlong sequence} testutfprev { testutfprev A\xE0\x80\x80 2 } 1 |
︙ | |||
911 912 913 914 915 916 917 | 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 | - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + - + - - - - - - - - - - + - + - + - + - + - + - + - - + + - - - - + - - - - + - - - - + - - - - + - + - - - - + - + - - - - + - + - - - - - + + - - - - - + + - - + + - - - - - - - + - - + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + | } 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 |
︙ | |||
1239 1240 1241 1242 1243 1244 1245 | 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 | - + - + - + - - - - + - + - + | } \u00C3AB test utf-11.4 {Tcl_UtfToUpper} { string toupper \u01E3AB } \u01E2AB test utf-11.5 {Tcl_UtfToUpper Georgian (new in Unicode 11)} { string toupper \u10D0\u1C90 } \u1C90\u1C90 |
︙ | |||
1298 1299 1300 1301 1302 1303 1304 | 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | - + - + | } \u10D0\u1C90 test utf-13.6 {Tcl_UtfToTitle Georgian (new in Unicode 11)} { string totitle \u1C90\u10D0 } \u1C90\u10D0 test utf-13.7 {Tcl_UtfToTitle low/high surrogate)} { string totitle \uDC24\uD824 } \uDC24\uD824 |
︙ | |||
1361 1362 1363 1364 1365 1366 1367 | 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | - + - + | test utf-19.1 {TclUniCharLen} -body { list [regexp \\d abc456def foo] $foo } -cleanup { unset -nocomplain foo } -result {1 4} |
︙ | |||
1441 1442 1443 1444 1445 1446 1447 | 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | - + | test utf-22.1 {Tcl_UniCharIsWordChar} { string wordend "xyz123_bar fg" 0 } 10 test utf-22.2 {Tcl_UniCharIsWordChar} { string wordend "x\u5080z123_bar\u203C fg" 0 } 10 |
︙ | |||
1498 1499 1500 1501 1502 1503 1504 | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 | - - - - + + + + | incr count } variable count 1 UniCharCaseCmpTest < a b UniCharCaseCmpTest > b a UniCharCaseCmpTest > B a UniCharCaseCmpTest > aBcB abca |
︙ |
Changes to jni/tcl/win/tclWinError.c.
︙ | |||
173 174 175 176 177 178 179 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - + | EINVAL, /* 154 */ EINVAL, /* 155 */ EINVAL, /* 156 */ EINVAL, /* 157 */ EACCES, /* ERROR_NOT_LOCKED 158 */ EINVAL, /* 159 */ EINVAL, /* 160 */ |
︙ | |||
386 387 388 389 390 391 392 | 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 | - + + - + - - + + - - + + + + | const char *format, ...) { #define TCL_MAX_WARN_LEN 1024 va_list argList; va_start(argList, format); if (IsDebuggerPresent()) { |
︙ |
Changes to jni/tcl/win/tclWinFile.c.
︙ | |||
821 822 823 824 825 826 827 | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | - + + - + - - + + + + | TCL_NORETURN void tclWinDebugPanic( const char *format, ...) { #define TCL_MAX_WARN_LEN 1024 va_list argList; char buf[TCL_MAX_WARN_LEN * TCL_UTF_MAX]; |
︙ | |||
879 880 881 882 883 884 885 | 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 | + - + + + + + + + + - + + + + + + + + + | void TclpFindExecutable( const char *argv0) /* If NULL, install PanicMessageBox, otherwise * ignore. */ { WCHAR wName[MAX_PATH]; int i; |
︙ | |||
3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 | 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 | + | Tcl_Obj *pathPtr) { WCHAR *nativePathPtr = NULL; const char *str; Tcl_Obj *validPathPtr; size_t len; WCHAR *wp; Tcl_DString ds; if (TclFSCwdIsNative()) { /* * The cwd is native, which means we can use the translated path * without worrying about normalization (this will also usually be * shorter so the utf-to-external conversion will be somewhat faster). */ |
︙ | |||
3089 3090 3091 3092 3093 3094 3095 | 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 | + - - + + - - - + + - - + + - - + - - - - + - - - - - + + + + - - + - - - - + + | } /* * For a reserved device, strip a possible postfix ':' */ len = WinIsReserved(str); wp = (WCHAR *) Tcl_WinUtfToTChar(str, (len == 0) ? -1 : len, &ds); |
︙ |
Changes to jni/tcl/win/tclWinInit.c.
︙ | |||
496 497 498 499 500 501 502 | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | - + | const WCHAR *wSrc, char *dst) { char *start; start = dst; while (*wSrc != '\0') { |
︙ |
Changes to jni/tcl/win/tclWinSerial.c.
︙ | |||
1807 1808 1809 1810 1811 1812 1813 | 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | - + - - - - + - - - | dcb.XonChar = argv[0][0]; dcb.XoffChar = argv[1][0]; if (argv[0][0] & 0x80 || argv[1][0] & 0x80) { Tcl_UniChar character; int charLen; |
︙ |
Changes to jni/tdom/expat/xmltok.c.
︙ | |||
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | + + + | static int PTRFASTCALL utf8_isInvalid2(const ENCODING *enc, const char *p) { UNUSED_P(enc); return UTF8_INVALID2((const unsigned char *)p); } int XmlAllowWTF = 0; /* when 1, don't treat 0xD800..0xDFFF as invalid */ static int PTRFASTCALL utf8_isInvalid3(const ENCODING *enc, const char *p) { UNUSED_P(enc); if (XmlAllowWTF) return 0; return UTF8_INVALID3((const unsigned char *)p); } static int PTRFASTCALL utf8_isInvalid4(const ENCODING *enc, const char *p) { UNUSED_P(enc); return UTF8_INVALID4((const unsigned char *)p); |
︙ |
Changes to jni/tdom/generic/dom.c.
︙ | |||
2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 | 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 | + + + + + + + + + + | info.parser = parser; info.currentNode = doc->rootNode; } if (channel == NULL) { status = XML_Parse (parser, xml, length, 1); } else { #if TCL_UTF_MAX == 3 extern int XmlAllowWTF; #endif Tcl_DStringInit (&dStr); if (Tcl_GetChannelOption (interp, channel, "-encoding", &dStr) != TCL_OK) { domFreeDocument (doc, NULL, NULL); *resultcode = TCL_ERROR; doc = NULL; goto cleanup; } #if TCL_UTF_MAX == 3 if (XmlAllowWTF) { bufObj = Tcl_NewObj(); Tcl_SetObjLength (bufObj, 6144); } else #endif if (strcmp (Tcl_DStringValue (&dStr), "utf-8")==0 ) { useBinary = 1; } else { bufObj = Tcl_NewObj(); Tcl_SetObjLength (bufObj, 6144); } Tcl_DStringFree (&dStr); |
︙ |
Changes to jni/tdom/generic/tdominit.c.
︙ | |||
70 71 72 73 74 75 76 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | - + - - + - - - - - - - - - + + + + + + + + + + + + + + + | #ifdef USE_TCL_STUBS if (Tcl_InitStubs(interp, "8.4", 0) == NULL) { return TCL_ERROR; } #endif |
︙ |
Changes to jni/tdom/renxpat.h.
︙ | |||
64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | + | #define XML_SetUnknownEncodingHandler tdom_XML_SetUnknownEncodingHandler #define XML_SetUnparsedEntityDeclHandler tdom_XML_SetUnparsedEntityDeclHandler #define XML_SetUserData tdom_XML_SetUserData #define XML_SetXmlDeclHandler tdom_XML_SetXmlDeclHandler #define XML_StopParser tdom_XML_StopParser #define XML_UseForeignDTD tdom_XML_UseForeignDTD #define XML_UseParserAsHandlerArg tdom_XML_UseParserAsHandlerArg #define XmlAllowWTF tdom_XmlAllowWTF #define XmlPrologStateInit tdom_XmlPrologStateInit #define XmlPrologStateInitExternalEntity tdom_XmlPrologStateInitExternalEntity #define XML_SimpleParseDocument tdom_XML_SimpleParseDocument #define _INTERNAL_trim_to_complete_utf8_characters tdom__INTERNAL_trim_to_complete_utf8_characters #define XmlGetUtf16InternalEncoding tdom_XmlGetUtf16InternalEncoding #define XmlGetUtf16InternalEncodingNS tdom_XmlGetUtf16InternalEncodingNS #define XmlGetUtf8InternalEncoding tdom_XmlGetUtf8InternalEncoding |
︙ |
Changes to jni/tkpath/sdl/tkSDLAGGPath.cpp.
︙ | |||
634 635 636 637 638 639 640 641 642 643 644 645 646 647 | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | + + + + + + + + + | * but we need a 1:1 mapping here. */ char *up = utf8; while (up < utf8 + length) { Tcl_UniChar uch; up += Tcl_UtfToUniChar(up, &uch); chu = uch; #if TCL_UTF_MAX == 3 if (((uch & 0xFC00) == 0xD800) && (up < utf8 + length)) { int n = Tcl_UtfToUniChar(up, &uch); if ((uch &0xFC00) == 0xDC00) { up += n; chu = (((chu & 0x3FF) << 10) | (uch & 0x3FF)) + 0x10000; } } #endif Tcl_DStringAppend(&ds, (const char *) &chu, sizeof(unsigned)); } #else Tcl_Encoding enc = Tcl_GetEncoding(NULL, "ucs-4"); Tcl_UtfToExternalDString(enc, utf8, -1, &ds); Tcl_FreeEncoding(enc); #endif |
︙ |
Changes to jni/tkzinc/generic/Draw.c.
︙ | |||
2008 2009 2010 2011 2012 2013 2014 | 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 | - + - + | ZnRenderString(ZnTexFontInfo *tfi, unsigned char *string, unsigned int len) { unsigned int clen; int ch; Tcl_UniChar c = 0; |
︙ |
Changes to jni/vu/generic/tkCombobox.c.
︙ | |||
2004 2005 2006 2007 2008 2009 2010 | 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 | + + + - + + + + + - - + + + + + + + + + + + + + + | /* * If we're displaying a special character instead of the value of * the combo, recompute the displayString. */ if (comboPtr->showChar != NULL) { Tcl_UniChar ch; #if TCL_UTF_MAX == 3 Tcl_UniChar ch2 = 0; #endif |
︙ |
Changes to undroid/build-undroidwish-freebsd.sh.
︙ | |||
70 71 72 73 74 75 76 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ | |||
1351 1352 1353 1354 1355 1356 1357 | 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 | - + | echo -n "build ffidl ... " ( exec 3>&1 exec >> build.log 2>&1 cd ffidl test -e build-stamp && echo >&3 "already done" && exit 0 mkdir -p lib-src && rm -rf lib-src/libffi && cp -rp ../libffi lib-src |
︙ |
Changes to undroid/build-undroidwish-generic.sh.
︙ | |||
70 71 72 73 74 75 76 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-haiku.sh.
︙ | |||
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - - + + - - + + | fi if type g++-$(uname -p) >/dev/null 2>&1 ; then CXX=g++-$(uname -p) else CXX=g++ fi if type ccache >/dev/null 2>&1 ; then |
︙ |
Changes to undroid/build-undroidwish-illumos.sh.
︙ | |||
79 80 81 82 83 84 85 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-kmsdrm.sh.
︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-linux32.sh.
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-linux64.sh.
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-macosx.sh.
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP="strip -S -x" AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-openbsd.sh.
︙ | |||
70 71 72 73 74 75 76 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-termux.sh.
︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - - - + + + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-wayland.sh.
︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - - + + | echo "undroidwish - AndroWish sans the borg, a project just for pun." echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-undroidwish-win32.sh.
︙ | |||
101 102 103 104 105 106 107 | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | - - - + + + - - - + + + | # SSE like VIA C3 echo using toolchain from /opt/mingw64/bin PATH="/opt/mingw64/bin:$PATH" STRIP="x86_64-w64-mingw32-strip" OBJCOPY="x86_64-w64-mingw32-objcopy" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" |
︙ |
Changes to undroid/build-undroidwish-win64.sh.
︙ | |||
99 100 101 102 103 104 105 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - - + + - - + + | if test -d /opt/mingw64/bin ; then echo using toolchain from /opt/mingw64/bin PATH="/opt/mingw64/bin:$PATH" STRIP="x86_64-w64-mingw32-strip" OBJCOPY="x86_64-w64-mingw32-objcopy" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" |
︙ |
Changes to undroid/build-vanilla-freebsd.sh.
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | - - + + | echo "vanilla{tclsh,wish} - Build script for standard Tcl/Tk" echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ | |||
1301 1302 1303 1304 1305 1306 1307 | 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 | - + | echo -n "build ffidl ... " ( exec 3>&1 exec >> build.log 2>&1 cd ffidl test -e build-stamp && echo >&3 "already done" && exit 0 mkdir -p lib-src && rm -rf lib-src/libffi && cp -rp ../libffi lib-src |
︙ |
Changes to undroid/build-vanilla-generic.sh.
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | - - + + | echo "vanilla{tclsh,wish} - Build script for standard Tcl/Tk" echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-vanilla-illumos.sh.
︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - - + + | echo "vanilla{tclsh,wish} - Build script for standard Tcl/Tk" echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-vanilla-linux32.sh.
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - - + + | echo "vanilla{tclsh,wish} - Build script for standard Tcl/Tk" echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-vanilla-linux64.sh.
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - - + + | echo "vanilla{tclsh,wish} - Build script for standard Tcl/Tk" echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-vanilla-macosx.sh.
︙ | |||
76 77 78 79 80 81 82 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | - - - + + + | echo "vanilla{tclsh,wish} - Build script for standard Tcl/Tk" echo # the toolchain STRIP="strip -S -x" AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-vanilla-openbsd.sh.
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | - - + + | echo "vanilla{tclsh,wish} - Build script for standard Tcl/Tk" echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-vanilla-termux.sh.
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | - - + + | echo "vanilla{tclsh,wish} - Build script for standard Tcl/Tk" echo # the toolchain STRIP=strip AR=ar RANLIB=ranlib |
︙ |
Changes to undroid/build-vanilla-win32.sh.
︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | - - - + + + - - - + + + | # SSE like VIA C3 echo using toolchain from /opt/mingw64/bin PATH="/opt/mingw64/bin:$PATH" STRIP="x86_64-w64-mingw32-strip" OBJCOPY="x86_64-w64-mingw32-objcopy" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" |
︙ |
Changes to undroid/build-vanilla-win64.sh.
︙ | |||
100 101 102 103 104 105 106 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - - + + - - + + | if test -d /opt/mingw64/bin ; then echo using toolchain from /opt/mingw64/bin PATH="/opt/mingw64/bin:$PATH" STRIP="x86_64-w64-mingw32-strip" OBJCOPY="x86_64-w64-mingw32-objcopy" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" |
︙ |
Changes to undroid/ck8.x/ck.h.
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - - - - - - | #define CK_VERSION "8.2" #define CK_MINOR_VERSION 2 #elif (TCL_MINOR_VERSION == 1) #define CK_VERSION "8.1" #define CK_MINOR_VERSION 1 #else #error unsupported Tcl minor version |
︙ |
Changes to undroid/ck8.x/ckBind.c.
︙ | |||
1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 | + + + + + + + + + + + + + + | NULL, &numc, NULL); numChars += numc; } else { numStorage[numChars++] = eventPtr->key.keycode; } } if (eventPtr->key.is_uch) { #if TCL_UTF_MAX == 3 int uch = eventPtr->key.uch; numChars = 0; if (uch >= 0x10000) { uch -= 0x10000; numChars += Tcl_UniCharToUtf((uch>>10) | 0xd800, numStorage); uch = (uch&0x3ff) | 0xdc00; } numChars += Tcl_UniCharToUtf(uch, numStorage + numChars); #else numChars = Tcl_UniCharToUtf(eventPtr->key.uch, numStorage); #endif } numStorage[numChars] = '\0'; string = numStorage; } else if (eventPtr->type == CK_EV_BARCODE) { string = CkGetBarcodeData(winPtr->mainPtr); if (string == NULL) { numStorage[0] = '\0'; |
︙ |
Changes to undroid/ck8.x/ckEntry.c.
︙ | |||
564 565 566 567 568 569 570 571 572 573 574 575 576 577 | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | + + + + + + + + + + + + + + + + + | charsPerPage = 1; index += charsPerPage*count; break; case CK_SCROLL_UNITS: index += count; break; } #if TCL_UTF_MAX == 3 /* * Adjust to begin of surrogate pair. */ if (index > 0) { char *cPtr = Tcl_UtfAtIndex(entryPtr->string, index); Tcl_UniChar ch; Tcl_UtfToUniChar(cPtr, &ch); if ((ch & 0xfc00) == 0xdc00) { cPtr = Tcl_UtfPrev(cPtr, entryPtr->string); Tcl_UtfToUniChar(cPtr, &ch); if ((ch & 0xfc00) == 0xd800) index--; } } #endif } if (index >= entryPtr->numChars) { index = entryPtr->numChars-1; } if (index < 0) { index = 0; } |
︙ | |||
916 917 918 919 920 921 922 | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | - + - + + - + - | */ if (entryPtr->displayString != NULL) { ckfree(entryPtr->displayString); entryPtr->displayString = NULL; } if (entryPtr->showChar != NULL) { |
︙ | |||
976 977 978 979 980 981 982 983 984 985 986 987 988 989 | 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 | + + + + + + + + + + + + + + + + + + + | maxOffScreen += 1; } if (entryPtr->leftIndex > maxOffScreen) { entryPtr->leftIndex = maxOffScreen; } leftIndex = Tcl_UtfAtIndex(displayString, entryPtr->leftIndex) - displayString; #if TCL_UTF_MAX == 3 /* * Adjust to begin of surrogate pair. */ if (entryPtr->leftIndex > 0) { char *cPtr = displayString + leftIndex; Tcl_UniChar ch; Tcl_UtfToUniChar(cPtr, &ch); if ((ch & 0xfc00) == 0xdc00) { cPtr = Tcl_UtfPrev(cPtr, displayString); Tcl_UtfToUniChar(cPtr, &ch); if ((ch & 0xfc00) == 0xd800) { entryPtr->leftIndex--; leftIndex = cPtr - displayString; } } } #endif CkMeasureChars(winPtr->mainPtr, displayString, leftIndex, 0, INT_MAX, 0, CK_NEWLINES_NOT_SPECIAL|CK_PARTIAL_OK, &rightX, &dummy); entryPtr->leftX = 0; entryPtr->tabOrigin = entryPtr->leftX - rightX; } |
︙ | |||
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 | 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 1120 1121 1122 1123 1124 1125 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | * element. */ char *string) /* New characters to add (NULL-terminated * string). */ { int length, clength; char *new; int inspos; #if TCL_UTF_MAX == 3 Tcl_UniChar ch; #endif length = strlen(string); if (length == 0) { return; } clength = Tcl_NumUtfChars(string, -1); new = (char *) ckalloc((unsigned) (entryPtr->numBytes + length + 1)); inspos = Tcl_UtfAtIndex(entryPtr->string, index) - entryPtr->string; #if TCL_UTF_MAX == 3 if (length) { char *prevPtr; Tcl_UtfToUniChar(string + length, &ch); if ((ch & 0xfc00) == 0xdc00) { prevPtr = Tcl_UtfPrev(string + length, string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xfc00) == 0xd800) { length = prevPtr - string; index -= 1; } } } #endif strncpy(new, entryPtr->string, (size_t) inspos); strcpy(new+inspos, string); strcpy(new+inspos+length, entryPtr->string+inspos); ckfree(entryPtr->string); entryPtr->string = new; entryPtr->numChars += clength; entryPtr->numBytes += length; #if TCL_UTF_MAX == 3 /* * Account for high surrogate at end of inserted string. */ if (length > 1) { char *lastPtr = Tcl_UtfPrev(new+inspos+length, new); Tcl_UtfToUniChar(lastPtr, &ch); if ((ch & 0xfc00) == 0xd800) { /* * A high surrogate. If followed by low surrogate, * adjust index after it. */ lastPtr = Tcl_UtfNext(lastPtr); Tcl_UtfToUniChar(lastPtr, &ch); if ((ch & 0xfc00) == 0xdc00) index++; } } #endif /* * Inserting characters invalidates all indexes into the string. * Touch up the indexes so that they still refer to the same * characters (at new positions). When updating the selection * end-points, don't include the new text in the selection unless * it was completely surrounded by the selection. |
︙ | |||
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | if ((index + count) > entryPtr->numChars) { count = entryPtr->numChars - index; } if (count <= 0) { return; } #if TCL_UTF_MAX == 3 delpos = Tcl_UtfAtIndex(entryPtr->string, index) - entryPtr->string; /* * Delete complete surrogate pairs. */ if (delpos >= 0) { Tcl_UniChar ch; char *prevPtr, *nextPtr; Tcl_UtfToUniChar(entryPtr->string + delpos, &ch); if ((ch & 0xfc00) == 0xdc00) { prevPtr = Tcl_UtfPrev(entryPtr->string + delpos, entryPtr->string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xfc00) == 0xd800) { delpos = prevPtr - entryPtr->string; count++; index--; } } else if ((count == 1) && ((ch & 0xfc00) == 0xd800)) { nextPtr = Tcl_UtfNext(entryPtr->string + delpos); Tcl_UtfToUniChar(nextPtr, &ch); if ((ch & 0xfc00) == 0xdc00) { count++; } } if ((index + count) > entryPtr->numChars) { count = entryPtr->numChars - index; } } #endif delcount = Tcl_UtfAtIndex(entryPtr->string + delpos, count) - (entryPtr->string + delpos); #if TCL_UTF_MAX == 3 if (delcount) { int len; Tcl_UniChar ch; char *prevPtr; len = Tcl_UtfToUniChar(entryPtr->string + delpos + delcount, &ch); if ((ch & 0xfc00) == 0xdc00) { prevPtr = Tcl_UtfPrev(entryPtr->string + delpos + delcount, entryPtr->string); Tcl_UtfToUniChar(prevPtr, &ch); if ((ch & 0xfc00) == 0xd800) { delcount += len; count++; } } } #endif new = (char *) ckalloc((unsigned) (entryPtr->numBytes + 1 - delcount)); strncpy(new, entryPtr->string, (size_t) delpos); strcpy(new+delpos, entryPtr->string+delpos+delcount); entryPtr->numChars = Tcl_NumUtfChars(new, -1); entryPtr->numBytes = strlen(new); ckfree(entryPtr->string); entryPtr->string = new; |
︙ | |||
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 | 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | + + + + | * specified. */ char *string, /* Specifies character in entryPtr. */ int *indexPtr) /* Where to store converted index. */ { size_t length; int dummy; CkWindow *winPtr = entryPtr->winPtr; int roundUp = 0; #if TCL_UTF_MAX == 3 int oldInsertPos = entryPtr->insertPos; #endif length = strlen(string); if (string[0] == 'a') { if (strncmp(string, "anchor", length) == 0) { *indexPtr = entryPtr->selectAnchor; } else { |
︙ | |||
1338 1339 1340 1341 1342 1343 1344 | 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | - + | *indexPtr = entryPtr->selectFirst; } else if (strncmp(string, "sel.last", length) == 0) { *indexPtr = entryPtr->selectLast; } else { goto badIndex; } } else if (string[0] == '@') { |
︙ | |||
1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 | 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | goto badIndex; } if (*indexPtr < 0){ *indexPtr = 0; } else if (*indexPtr > entryPtr->numChars) { *indexPtr = entryPtr->numChars; } #if TCL_UTF_MAX == 3 roundUp = (indexPtr == &entryPtr->insertPos) && (*indexPtr == (oldInsertPos + 1)); #endif } #if TCL_UTF_MAX == 3 /* * Enforce index on start or end of surrogate pair. */ if (*indexPtr) { Tcl_UniChar ch; string = Tcl_UtfAtIndex(entryPtr->string, *indexPtr); Tcl_UtfToUniChar(string, &ch); if ((ch & 0xfc00) == 0xdc00) { if (roundUp) { *indexPtr += 1; } else { string = Tcl_UtfPrev(string, entryPtr->string); Tcl_UtfToUniChar(string, &ch); if ((ch & 0xfc00) == 0xd800) { *indexPtr -= 1; } } } } #endif return TCL_OK; } /* *---------------------------------------------------------------------- * * EntrySelectTo -- |
︙ | |||
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 | + + + + + + + + + + + + + + + + + + + + | * Pick new starting and ending points for the selection. */ if (entryPtr->selectAnchor > entryPtr->numChars) { entryPtr->selectAnchor = entryPtr->numChars; } if (entryPtr->selectAnchor <= index) { #if TCL_UTF_MAX == 3 /* * Correct ending point for surrogate pair. */ Tcl_UniChar ch; char *string; string = Tcl_UtfAtIndex(entryPtr->string, index); string += Tcl_UtfToUniChar(string, &ch); if (((ch & 0xfc00) == 0xdc00) && (index + 1 < entryPtr->numChars)) { index += 1; } else if (((ch & 0xfc00) == 0xd800) && (index + 1 < entryPtr->numChars) && (index == entryPtr->insertPos)) { Tcl_UtfToUniChar(string, &ch); if ((ch & 0xfc00) == 0xdc00) { index += 2; } } #endif newFirst = entryPtr->selectAnchor; newLast = index; } else { newFirst = index; newLast = entryPtr->selectAnchor; if (newLast < 0) { newFirst = newLast = -1; |
︙ |
Changes to undroid/ck8.x/ckEvent.c.
︙ | |||
700 701 702 703 704 705 706 | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | - + - - - - - - - - + + + + + + + + + + + + | code2 = code; break; } } nodelay(curscr, TRUE); done_uc: ucbuf[ucp] = '\0'; |
︙ |
Changes to undroid/ck8.x/ckText.c.
︙ | |||
456 457 458 459 460 461 462 | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | - + | if (segPtr->typePtr == &ckTextCharType) { savedChar = segPtr->body.chars[last]; segPtr->body.chars[last] = 0; Tcl_AppendResult(interp, segPtr->body.chars + offset, (char *) NULL); segPtr->body.chars[last] = savedChar; } |
︙ | |||
497 498 499 500 501 502 503 | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | - + | result = TCL_ERROR; goto done; } if (textPtr->state == ckTextNormalUid) { for (j = 3; j < argc; j += 2) { InsertChars(textPtr, &index1, argv[j]); if (argc > (j+1)) { |
︙ |
Changes to undroid/ck8.x/ckTextIndex.c.
︙ | |||
822 823 824 825 826 827 828 829 830 831 832 833 834 835 | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | + + + + + + + + + + + + | */ for ( ; segPtr != NULL; segPtr = segPtr->nextPtr) { if (segPtr->typePtr == &ckTextCharType) { start = segPtr->body.chars + byteOffset; end = segPtr->body.chars + segPtr->size; for (p = start; p < end; p += Tcl_UtfToUniChar(p, &ch)) { #if TCL_UTF_MAX == 3 if (((ch & 0xfc00) == 0xd800) && (p < end)) { char *pp = p; pp += Tcl_UtfToUniChar(pp, &ch); if ((ch & 0xfc00) == 0xdc00) { p = pp; if (count > 0) count--; } } #endif if (count == 0) { dstPtr->charIndex += (p - start); return; } count--; } } else { |
︙ | |||
979 980 981 982 983 984 985 986 987 988 989 990 991 992 | 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 | + + + + + + + + + + + + + + + + + | segSize -= segPtr->size; } while (1) { if (segPtr->typePtr == &ckTextCharType) { start = segPtr->body.chars; end = segPtr->body.chars + segSize; for (p = end; ; p = Tcl_UtfPrev(p, start)) { #if TCL_UTF_MAX == 3 Tcl_UniChar ch; Tcl_UtfToUniChar(p, &ch); if (((ch & 0xfc00) == 0xdc00) && (p > start)) { char *pp = Tcl_UtfPrev(p, start); if (pp != NULL) { Tcl_UtfToUniChar(pp, &ch); if ((ch & 0xfc00) == 0xd800) { p = pp; if (count > 0) count--; } } } #endif if (count == 0) { dstPtr->charIndex -= (end - p); return; } if (p == start) { break; } |
︙ |
Changes to undroid/ck8.x/ckUtil.c.
︙ | |||
496 497 498 499 500 501 502 503 504 505 506 507 508 509 | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | Tcl_SetResult(interp, EncodingTable[Encoding].name, TCL_STATIC); return TCL_OK; } /* *-------------------------------------------------------------- * * NumUtfChars, UtfToUniChar, UtfAtIndex -- * * Wrappers for Tcl_NumUtfChars(), Tcl_UtfToUniChar(), and * Tcl_UtAtIndex() counting/producing 32 bit codepoints. * *-------------------------------------------------------------- */ static int NumUtfChars(buf, len) char *buf; int len; { Tcl_UniChar ch; char *end; int n, i = 0; if (len < 0) { len = strlen(buf); } end = buf + len; while (buf < end) { n = Tcl_UtfToUniChar(buf, &ch); #if TCL_UTF_MAX == 3 if ((ch & 0xfc00) == 0xd800) { int n2; Tcl_UniChar ch2; n2 = Tcl_UtfToUniChar(buf + n, &ch2); if ((ch2 & 0xfc00) == 0xdc00) buf += n2; } #endif buf += n; i++; } return i; } static int UtfToUniChar(buf, chPtr) char *buf; int *chPtr; { int len; Tcl_UniChar ch; len = Tcl_UtfToUniChar(buf, &ch); #if TCL_UTF_MAX == 3 if ((ch & 0xfc00) == 0xd800) { int len2; Tcl_UniChar ch2; len2 = Tcl_UtfToUniChar(buf + len, &ch2); if ((ch2 & 0xfc00) == 0xdc00) { *chPtr = (((ch & 0x3ff) << 10) | (ch2 & 0x3ff)) + 0x10000; len += len2; return len; } } #endif *chPtr = ch; return len; } static CONST char * UtfAtIndex(src, index) CONST char *src; int index; { int len; Tcl_UniChar ch = 0; while (index-- > 0) { len = Tcl_UtfToUniChar(src, &ch); #if TCL_UTF_MAX == 3 if ((ch & 0xfc00) == 0xd800) { int len2; Tcl_UniChar ch2; len2 = Tcl_UtfToUniChar(src + len, &ch2); if ((ch2 & 0xfc00) == 0xdc00) { len += len2; index++; } } #endif src += len; } return src; } /* *-------------------------------------------------------------- * * MakeUCRepl -- * * Make replacement for unprintable chars. * *-------------------------------------------------------------- */ |
︙ | |||
610 611 612 613 614 615 616 | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | - + - - + | char *term; /* Pointer to most recent character that * may legally be a terminating character. */ int termX; /* X-position just after term. */ int curX; /* X-position corresponding to p. */ int newX; /* X-position corresponding to p+1. */ int rem; int nChars = 0; |
︙ | |||
688 689 690 691 692 693 694 | 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | - + | } } if (newX > maxX) { break; } p = p2; if (maxChars > 1) { |
︙ | |||
722 723 724 725 726 727 728 | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | - + - + | * P points to the first character that doesn't fit in the desired * span. Use the flags to figure out what to return. */ if ((flags & CK_PARTIAL_OK) && (curX < maxX)) { curX = newX; if (*p) { |
︙ | |||
794 795 796 797 798 799 800 | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | - + - + - - + - + | /* * Scan the string one character at a time and display the * character. */ getmaxyx(window, dummy, maxX); p = string; |
︙ | |||
971 972 973 974 975 976 977 | 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 | - + - + - - + - + | * Scan the string one character at a time and display the * character. */ count = 0; getmaxyx(window, dummy, maxX); p = string; |
︙ |
Changes to undroid/ck8.x/library/text.tcl.
︙ | |||
271 272 273 274 275 276 277 278 279 280 281 282 283 284 | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | + + + + + | scan $i "%d.%d" line char if {$ckPriv(prevPos) ne $i} { set ckPriv(char) $char } set new [$w index [expr {$line + $n}].$ckPriv(char)] if {[$w compare $new == end] || [$w compare $new == "insert linestart"]} { set new $i } else { scan [$w get $new] "%c" char if {($char & 0xfffffc00) == 0xdc00} { set new [$w index "$new + 1c"] } } set ckPriv(prevPos) $new return $new } # ckTextScrollPages -- # This is a utility procedure used in bindings for moving up and down |
︙ |
Changes to undroid/tclbsd/generic/bsd.c.
︙ | |||
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | + + + + | Tcl_Interp *interp; int objc; Tcl_Obj *const objv[]; { char *path; Tcl_Obj *resultObj = Tcl_GetObjResult (interp); struct statfs statfsbuf; Tcl_DString ds; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "path"); return TCL_ERROR; } path = Tcl_GetStringFromObj (objv[1], NULL); path = Tcl_UtfToExternalDString (NULL, path, -1, &ds); if (statfs (path, &statfsbuf) < 0) { Tcl_DStringFree (&ds); Tcl_SetStringObj (resultObj, Tcl_PosixError (interp), -1); return TCL_ERROR; } Tcl_DStringFree (&ds); return StatfsBufToList (interp, resultObj, &statfsbuf); } /*----------------------------------------------------------------------------- * BSD_GetfsstatObjCmd -- * |
︙ | |||
827 828 829 830 831 832 833 | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | - + + + + + + + | BSD_SetProcTitleObjCmd (clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *const objv[]; { #ifdef HAVE_SETPROCTITLE |
︙ |
Changes to undroid/tclbsd/generic/bsdsyslog.c.
︙ | |||
130 131 132 133 134 135 136 | 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 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 | - + + - + + + + + - - - - - - - + | if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", TCL_EXACT, &optIndex) != TCL_OK) { return TCL_ERROR; } switch ((enum options) optIndex) { case OPT_LOG: { |
︙ |
Changes to undroid/twapi/twapi/base/errors.c.
︙ | |||
347 348 349 350 351 352 353 | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - + - - + + | errorCodeObj = Twapi_MakeWindowsErrorCodeObj(error, extra); /* Third element of error code is also the message */ if (ObjListIndex(NULL, errorCodeObj, 2, &msgObj) == TCL_OK && msgObj != NULL) { Tcl_Obj *resultObj = ObjDuplicate(ObjGetResult(interp)); if (ObjCharLength(resultObj)) { |
︙ |
Changes to undroid/twapi/twapi/base/tclobjs.c.
︙ | |||
4377 4378 4379 4380 4381 4382 4383 | 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 | - + + + - - - + + + - - | } TWAPI_EXTERN Tcl_Obj *ObjFromTclUniCharN(const Tcl_UniChar *ws, int len) { if (ws == NULL) return ObjFromEmptyString(); |
︙ |
Changes to undroid/twapi/twapi/base/winchars.c.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | /* * This implementation is only enabled when TCL_MAX_UTF > 4 resulting in * sizeof(Tcl_UniChar) != sizeof(WCHAR). Otherwise the Obj{To,From}WinChars * are inlined as Obj{To,From}TclUniChar in twapi.h * * TWAPI_FORCE_WINCHARS is used for testing purposes. */ |
︙ |
Changes to undroid/twapi/twapi/include/twapi.h.
︙ | |||
1519 1520 1521 1522 1523 1524 1525 | 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 | - + | TWAPI_EXTERN Tcl_UniChar *ObjToTclUniChar(Tcl_Obj *objP); TWAPI_EXTERN Tcl_UniChar *ObjToTclUniCharN(Tcl_Obj *objP, int *lenP); TWAPI_EXTERN Tcl_UniChar *ObjToTclUniCharDW(Tcl_Obj *objP, DWORD *lenP); TWAPI_EXTERN Tcl_Obj *ObjFromTclUniCharN(const Tcl_UniChar *ws, int len); TWAPI_EXTERN Tcl_Obj *ObjFromTclUniChar(const Tcl_UniChar *ws); |
︙ |
Changes to undroid/twapi/twapi/input/input.c.
︙ | |||
208 209 210 211 212 213 214 | 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 | - - + + - + - + - + - - + + | num_chars = Tcl_GetCharLength(input_obj); /* Now loop through every character adding it to the input event array */ /* Win2K and up, accepts unicode characters */ /* NUmber of events is twice number of chars (keydown + keyup) */ |
︙ |
Changes to undroid/twapi/twapi/storage/dirmonitor.c.
︙ | |||
721 722 723 724 725 726 727 | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | - + - - + + | ++pattern; } else if (pattern[0] == L'+') { include = 1; ++pattern; } else include = 1; /* Default is inclusive pattern */ |