Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch novem-64bit-sizes Excluding Merge-Ins
This is equivalent to a diff from 7ae862fc61 to ec3dfc657f
|
2013-09-30
| ||
| 09:44 | merge novem Closed-Leaf check-in: ec3dfc657f user: dkf tags: novem-64bit-sizes | |
| 09:44 | merge trunk check-in: e25b747b7d user: jan.nijtmans tags: novem | |
| 08:31 | merge trunk check-in: 7ae862fc61 user: jan.nijtmans tags: novem | |
|
2013-09-29
| ||
| 20:46 | merge novem check-in: 2170e066f2 user: dkf tags: novem-64bit-sizes | |
|
2013-09-28
| ||
| 22:52 | typo; spotted by stu check-in: 97ba1dcf13 user: dkf tags: trunk | |
|
2013-09-27
| ||
| 17:39 | merge trunk check-in: f55df9a649 user: jan.nijtmans tags: novem | |
Changes to generic/regc_locale.c.
| ︙ | |||
744 745 746 747 748 749 750 | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | - + |
NOTE(REG_ULOCALE);
/*
* Search table.
*/
Tcl_DStringInit(&ds);
|
| ︙ | |||
916 917 918 919 920 921 922 | 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | - + |
/*
* Extract the class name
*/
len = endp - startp;
Tcl_DStringInit(&ds);
|
| ︙ |
Changes to generic/tcl.decls.
| ︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | - + - + - + - + |
const char *name, const char *version, int exact,
void *clientDataPtr)
}
declare 2 {
void Tcl_Panic(const char *format, ...)
}
declare 3 {
|
| ︙ | |||
82 83 84 85 86 87 88 | 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | - + - + - + - + - + - + + |
declare 14 {
int Tcl_AppendAllObjTypes(Tcl_Interp *interp, Tcl_Obj *objPtr)
}
declare 15 {
void Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...)
}
declare 16 {
|
| ︙ | |||
166 167 168 169 170 171 172 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | - + - + - + - + - - + + - + - + - + - + - + - + - + - + |
declare 39 {
int Tcl_GetLongFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr)
}
declare 40 {
const Tcl_ObjType *Tcl_GetObjType(const char *typeName)
}
declare 41 {
|
| ︙ | |||
305 306 307 308 309 310 311 | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | - + - + - - + + - + - + |
declare 81 {
int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan)
}
declare 82 {
int Tcl_CommandComplete(const char *cmd)
}
declare 83 {
|
| ︙ | |||
430 431 432 433 434 435 436 | 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 | - + + - + |
declare 115 {
int Tcl_DoOneEvent(int flags)
}
declare 116 {
void Tcl_DoWhenIdle(Tcl_IdleProc *proc, ClientData clientData)
}
declare 117 {
|
| ︙ | |||
532 533 534 535 536 537 538 | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | - + - + |
}
declare 147 {
void Tcl_FreeResult(Tcl_Interp *interp)
}
declare 148 {
int Tcl_GetAlias(Tcl_Interp *interp, const char *slaveCmd,
Tcl_Interp **targetInterpPtr, const char **targetCmdPtr,
|
| ︙ | |||
610 611 612 613 614 615 616 | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | - + - + |
}
# Obsolete. Should now use Tcl_FSGetPathType which is objectified
# and therefore usually faster.
declare 168 {
Tcl_PathType Tcl_GetPathType(const char *path)
}
declare 169 {
|
| ︙ | |||
668 669 670 671 672 673 674 | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | - + |
int Tcl_InterpDeleted(Tcl_Interp *interp)
}
declare 185 {
int Tcl_IsSafe(Tcl_Interp *interp)
}
# Obsolete, use Tcl_FSJoinPath
declare 186 {
|
| ︙ | |||
691 692 693 694 695 696 697 | 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 | - + - + |
declare 190 {
int Tcl_MakeSafe(Tcl_Interp *interp)
}
declare 191 {
Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket)
}
declare 192 {
|
| ︙ | |||
741 742 743 744 745 746 747 | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | - + |
declare 204 {
const char *Tcl_PosixError(Tcl_Interp *interp)
}
declare 205 {
void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position)
}
declare 206 {
|
| ︙ | |||
780 781 782 783 784 785 786 | 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | - + - + |
declare 216 {
void Tcl_Release(ClientData clientData)
}
declare 217 {
void Tcl_ResetResult(Tcl_Interp *interp)
}
declare 218 {
|
| ︙ | |||
861 862 863 864 865 866 867 | 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | - - + + - + + |
declare 240 {
const char *Tcl_SignalMsg(int sig)
}
declare 241 {
void Tcl_SourceRCFile(Tcl_Interp *interp)
}
declare 242 {
|
| ︙ | |||
893 894 895 896 897 898 899 | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | - + |
int flags, Tcl_VarTraceProc *proc, ClientData clientData)
}
declare 249 {
char *Tcl_TranslateFileName(Tcl_Interp *interp, const char *name,
Tcl_DString *bufferPtr)
}
declare 250 {
|
| ︙ | |||
946 947 948 949 950 951 952 | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | - + - + |
#}
declare 262 {
ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp, const char *part1,
const char *part2, int flags, Tcl_VarTraceProc *procPtr,
ClientData prevClientData)
}
declare 263 {
|
| ︙ | |||
1066 1067 1068 1069 1070 1071 1072 | 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 | - + - + - - - + + + - + |
void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, ClientData clientData)
}
# Removed in 9.0:
#declare 290 {
# void Tcl_DiscardResult(Tcl_SavedResult *statePtr)
#}
declare 291 {
|
| ︙ | |||
1139 1140 1141 1142 1143 1144 1145 | 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 | - + - - + + |
void Tcl_ConditionNotify(Tcl_Condition *condPtr)
}
declare 311 {
void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr,
const Tcl_Time *timePtr)
}
declare 312 {
|
| ︙ | |||
1168 1169 1170 1171 1172 1173 1174 | 1171 1172 1173 1174 1175 1176 1177 1178 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 | - + - + - + - + - - - + + + - + - + - + |
void Tcl_ThreadAlert(Tcl_ThreadId threadId)
}
declare 319 {
void Tcl_ThreadQueueEvent(Tcl_ThreadId threadId, Tcl_Event *evPtr,
Tcl_QueuePosition position)
}
declare 320 {
|
| ︙ | |||
1278 1279 1280 1281 1282 1283 1284 | 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 | - + - + - + - - + + + - - + + - + - + - - + + |
}
declare 353 {
int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
size_t numChars)
}
declare 354 {
char *Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
|
| ︙ | |||
1364 1365 1366 1367 1368 1369 1370 | 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 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 | - + - + - + - + - + - + - + - + - + - + |
int Tcl_RegExpExecObj(Tcl_Interp *interp, Tcl_RegExp regexp,
Tcl_Obj *textObj, int offset, int nmatches, int flags)
}
declare 377 {
void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr)
}
declare 378 {
|
| ︙ | |||
1544 1545 1546 1547 1548 1549 1550 | 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 | - + - + - + - + - + - + |
Tcl_CommandTraceProc *proc, ClientData clientData)
}
declare 427 {
void Tcl_UntraceCommand(Tcl_Interp *interp, const char *varName,
int flags, Tcl_CommandTraceProc *proc, ClientData clientData)
}
declare 428 {
|
| ︙ | |||
1666 1667 1668 1669 1670 1671 1672 | 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 | - + - + |
declare 459 {
int Tcl_FSConvertToPathType(Tcl_Interp *interp, Tcl_Obj *pathPtr)
}
declare 460 {
Tcl_Obj *Tcl_FSJoinPath(Tcl_Obj *listObj, int elements)
}
declare 461 {
|
| ︙ | |||
1735 1736 1737 1738 1739 1740 1741 | 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | - + |
declare 480 {
void Tcl_FSMountsChanged(const Tcl_Filesystem *fsPtr)
}
# TIP#56 (evaluate a parsed script) msofer
declare 481 {
int Tcl_EvalTokensStandard(Tcl_Interp *interp, Tcl_Token *tokenPtr,
|
| ︙ | |||
1805 1806 1807 1808 1809 1810 1811 | 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 | - + + - + - + |
Tcl_Obj **valuePtrPtr)
}
declare 496 {
int Tcl_DictObjRemove(Tcl_Interp *interp, Tcl_Obj *dictPtr,
Tcl_Obj *keyPtr)
}
declare 497 {
|
| ︙ | |||
2107 2108 2109 2110 2111 2112 2113 | 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 | - + - - + + - + - + |
declare 572 {
const char *Tcl_GetEncodingNameFromEnvironment(Tcl_DString *bufPtr)
}
# TIP#268 (extended version numbers and requirements) akupries
declare 573 {
int Tcl_PkgRequireProc(Tcl_Interp *interp, const char *name,
|
| ︙ | |||
2161 2162 2163 2164 2165 2166 2167 | 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 | - - + + - + - + |
Tcl_ObjCmdProc *nreProc, ClientData clientData,
Tcl_CmdDeleteProc *deleteProc)
}
declare 584 {
int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags)
}
declare 585 {
|
| ︙ | |||
2234 2235 2236 2237 2238 2239 2240 | 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 | - + |
int Tcl_GetEnsembleParameterList(Tcl_Interp *interp, Tcl_Command token,
Tcl_Obj **paramListPtr)
}
# TIP#265 (option parser) dkf for Sam Bromley
declare 604 {
int Tcl_ParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable,
|
| ︙ | |||
2272 2273 2274 2275 2276 2277 2278 | 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 | - + - + - + + |
}
declare 611 {
int Tcl_ZlibInflate(Tcl_Interp *interp, int format, Tcl_Obj *data,
int buffersize, Tcl_Obj *gzipHeaderDictObj)
}
declare 612 {
unsigned int Tcl_ZlibCRC32(unsigned int crc, const unsigned char *buf,
|
| ︙ | |||
2366 2367 2368 2369 2370 2371 2372 | 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 | - + - + - + - + |
################################
# Windows specific functions
# Added in Tcl 8.1
declare 0 win {
|
| ︙ |
Changes to generic/tcl.h.
| ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | + + + | * Also, many extensions need stdio.h, and they've grown accustomed to tcl.h * providing it for them rather than #include-ing it themselves as they * should, so also for their sake, we keep the #include to be consistent with * prior Tcl releases. */ #include <stdio.h> // TODO: AUTOCONFERY #include <sys/types.h> //#include <stddef.h> /* *---------------------------------------------------------------------------- * Support for functions with a variable number of arguments. * * The following TCL_VARARGS* macros are to support old extensions * written for older versions of Tcl where the macros permitted |
| ︙ | |||
551 552 553 554 555 556 557 | 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 | - + - + - + - - + + + - + | typedef int (Tcl_AppInitProc) (Tcl_Interp *interp); typedef int (Tcl_AsyncProc) (ClientData clientData, Tcl_Interp *interp, int code); typedef void (Tcl_ChannelProc) (ClientData clientData, int mask); typedef void (Tcl_CloseProc) (ClientData data); typedef void (Tcl_CmdDeleteProc) (ClientData clientData); typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp, |
| ︙ | |||
645 646 647 648 649 650 651 | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | - + | * embedded null characters. The array's * storage is allocated by ckalloc. NULL means * the string rep is invalid and must be * regenerated from the internal rep. Clients * should use Tcl_GetStringFromObj or * Tcl_GetString to get a pointer to the byte * array as a readonly value. */ |
| ︙ | |||
672 673 674 675 676 677 678 679 680 681 682 683 684 685 | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | + + + + + + + + |
* off the pointer. */
void *ptr;
unsigned long value;
} ptrAndLongRep;
} internalRep;
} Tcl_Obj;
/*
* Used in many functions to indicate that the length of the string argument
* is not directly known and should be worked out by using strlen() or
* equivalent.
*/
#define TCL_STRLEN ((size_t) -1)
/*
* Macros to increment and decrement a Tcl_Obj's reference count, and to test
* whether an object is shared (i.e. has reference count > 1). Note: clients
* should use Tcl_DecrRefCount() when they are finished using an object, and
* should never call TclFreeObj() directly. TclFreeObj() is only defined and
* made public in tcl.h to support Tcl_DecrRefCount's macro definition.
*/
|
| ︙ | |||
743 744 745 746 747 748 749 | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | - + - + |
* WARNING!! The structure definition must be kept consistent with the
* CallFrame structure in tclInt.h. If you change one, change the other.
*/
typedef struct Tcl_CallFrame {
Tcl_Namespace *nsPtr;
int dummy1;
|
| ︙ | |||
804 805 806 807 808 809 810 | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | - + - + |
* macros Tcl_DStringValue and Tcl_DStringLength.
*/
#define TCL_DSTRING_STATIC_SIZE 200
typedef struct Tcl_DString {
char *string; /* Points to beginning of string: either
* staticSpace below or a malloced array. */
|
| ︙ | |||
1086 1087 1088 1089 1090 1091 1092 | 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 | - + - + - + - + - + - + |
struct Tcl_HashTable {
Tcl_HashEntry **buckets; /* Pointer to bucket array. Each element
* points to first entry in bucket's hash
* chain, or NULL. */
Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
/* Bucket array used for small tables (to
* avoid mallocs and frees). */
|
| ︙ | |||
1288 1289 1290 1291 1292 1293 1294 | 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | - - - - + + + + | */ typedef int (Tcl_DriverBlockModeProc) (ClientData instanceData, int mode); typedef int (Tcl_DriverCloseProc) (ClientData instanceData, Tcl_Interp *interp); typedef int (Tcl_DriverClose2Proc) (ClientData instanceData, Tcl_Interp *interp, int flags); |
| ︙ | |||
1724 1725 1726 1727 1728 1729 1730 | 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | - - + + |
* token.
*/
typedef struct Tcl_Token {
int type; /* Type of token, such as TCL_TOKEN_WORD; see
* below for valid types. */
const char *start; /* First character in token. */
|
| ︙ | |||
1839 1840 1841 1842 1843 1844 1845 | 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 | - + - + - + - - + + |
*/
#define NUM_STATIC_TOKENS 20
typedef struct Tcl_Parse {
const char *commentStart; /* Pointer to # that begins the first of one
* or more comments preceding the command. */
|
| ︙ | |||
2103 2104 2105 2106 2107 2108 2109 | 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 | - + | * Types of callback functions for the TCL_ARGV_FUNC and TCL_ARGV_GENFUNC * argument types: */ typedef int (Tcl_ArgvFuncProc)(ClientData clientData, Tcl_Obj *objPtr, void *dstPtr); typedef int (Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp, |
| ︙ |
Changes to generic/tclAlloc.c.
| ︙ | |||
690 691 692 693 694 695 696 | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | - + | * None. * *---------------------------------------------------------------------- */ char * TclpAlloc( |
| ︙ | |||
738 739 740 741 742 743 744 | 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | - + |
*
*----------------------------------------------------------------------
*/
char *
TclpRealloc(
char *oldPtr, /* Pointer to alloced block. */
|
| ︙ |
Changes to generic/tclAssembly.c.
| ︙ | |||
214 215 216 217 218 219 220 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - + |
* generation */
Tcl_Parse* parsePtr; /* Parse of the current line of source */
Tcl_HashTable labelHash; /* Hash table whose keys are labels and whose
* values are 'label' objects storing the code
* offsets of the labels. */
int cmdLine; /* Current line number within the assembly
* code */
|
| ︙ | |||
275 276 277 278 279 280 281 | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | - + + | Tcl_Obj* jumpTable); static int FindLocalVar(AssemblyEnv* envPtr, Tcl_Token** tokenPtrPtr); static int FinishAssembly(AssemblyEnv*); static void FreeAssembleCodeInternalRep(Tcl_Obj *objPtr); static void FreeAssemblyEnv(AssemblyEnv*); static int GetBooleanOperand(AssemblyEnv*, Tcl_Token**, int*); |
| ︙ | |||
732 733 734 735 736 737 738 | 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 | - + - + |
*-----------------------------------------------------------------------------
*/
int
Tcl_AssembleObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
816 817 818 819 820 821 822 | 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | - + |
CompileEnv compEnv; /* Compilation environment structure */
register ByteCode *codePtr = NULL;
/* Bytecode resulting from the assembly */
Namespace* namespacePtr; /* Namespace in which variable and command
* names in the bytecode resolve */
int status; /* Status return from Tcl_AssembleCode */
const char* source; /* String representation of the source code */
|
| ︙ | |||
952 953 954 955 956 957 958 | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | - + |
*/
if (TCL_ERROR == TclAssembleCode(envPtr, tokenPtr[1].start,
tokenPtr[1].size, TCL_EVAL_DIRECT)) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (\"%.*s\" body, line %d)",
|
| ︙ | |||
1232 1233 1234 1235 1236 1237 1238 | 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | - + |
Tcl_Obj* instNameObj; /* Name of the instruction */
int tblIdx; /* Index in TalInstructionTable of the
* instruction */
enum TalInstType instType; /* Type of the instruction */
Tcl_Obj* operand1Obj = NULL;
/* First operand to the instruction */
const char* operand1; /* String rep of the operand */
|
| ︙ | |||
1552 1553 1554 1555 1556 1557 1558 | 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 | - - - + + + + + + + + + - + |
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd);
break;
case ASSEM_INDEX:
if (parsePtr->numWords != 2) {
Tcl_WrongNumArgs(interp, 1, &instNameObj, "count");
goto cleanup;
|
| ︙ | |||
1919 1920 1921 1922 1923 1924 1925 | 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 | - + |
*/
static int
CreateMirrorJumpTable(
AssemblyEnv* assemEnvPtr, /* Assembly environment */
Tcl_Obj* jumps) /* List of alternating keywords and labels */
{
|
| ︙ | |||
1941 1942 1943 1944 1945 1946 1947 | 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 | - + |
if (Tcl_ListObjGetElements(interp, jumps, &objc, &objv) != TCL_OK) {
return TCL_ERROR;
}
if (objc % 2 != 0) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"jump table must have an even number of list elements",
|
| ︙ | |||
2053 2054 2055 2056 2057 2058 2059 | 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 | - + + |
Tcl_Interp* interp = (Tcl_Interp*) assemEnvPtr->envPtr->iPtr;
Tcl_Obj* operandObj = Tcl_NewObj();
if (!TclWordKnownAtCompileTime(*tokenPtrPtr, operandObj)) {
Tcl_DecrRefCount(operandObj);
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2193 2194 2195 2196 2197 2198 2199 | 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 | - + |
*-----------------------------------------------------------------------------
*/
static int
GetListIndexOperand(
AssemblyEnv* assemEnvPtr, /* Assembly environment */
Tcl_Token** tokenPtrPtr, /* Current token from the parser */
|
| ︙ | |||
2258 2259 2260 2261 2262 2263 2264 | 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 | - + - + |
Tcl_Interp* interp = (Tcl_Interp*) envPtr->iPtr;
/* Tcl interpreter */
Tcl_Token* tokenPtr = *tokenPtrPtr;
/* INOUT: Pointer to the next token in the
* source code. */
Tcl_Obj* varNameObj; /* Name of the variable */
const char* varNameStr;
|
| ︙ | |||
2345 2346 2347 2348 2349 2350 2351 | 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 | - + + |
CheckOneByte(
Tcl_Interp* interp, /* Tcl interpreter for error reporting */
int value) /* Value to check */
{
Tcl_Obj* result; /* Error message */
if (value < 0 || value > 0xff) {
|
| ︙ | |||
2380 2381 2382 2383 2384 2385 2386 | 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 | - + + |
CheckSignedOneByte(
Tcl_Interp* interp, /* Tcl interpreter for error reporting */
int value) /* Value to check */
{
Tcl_Obj* result; /* Error message */
if (value > 0x7f || value < -0x80) {
|
| ︙ | |||
2413 2414 2415 2416 2417 2418 2419 | 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 | - + |
CheckNonNegative(
Tcl_Interp* interp, /* Tcl interpreter for error reporting */
int value) /* Value to check */
{
Tcl_Obj* result; /* Error message */
if (value < 0) {
|
| ︙ | |||
2446 2447 2448 2449 2450 2451 2452 | 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 | - + |
CheckStrictlyPositive(
Tcl_Interp* interp, /* Tcl interpreter for error reporting */
int value) /* Value to check */
{
Tcl_Obj* result; /* Error message */
if (value <= 0) {
|
| ︙ | |||
3359 3360 3361 3362 3363 3364 3365 | 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 | - + + |
*/
if (blockPtr->initialStackDepth == initialStackDepth) {
return TCL_OK;
}
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3388 3389 3390 3391 3392 3393 3394 | 3399 3400 3401 3402 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 | - + + - - + + + + |
/*
* Calculate minimum stack depth, and flag an error if the block
* underflows the stack.
*/
if (initialStackDepth + blockPtr->minStackDepth < 0) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
3679 3680 3681 3682 3683 3684 3685 | 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 | - + |
if (bbPtr->catchState == BBCS_UNKNOWN) {
bbPtr->enclosingCatch = enclosing;
} else if (bbPtr->enclosingCatch != enclosing) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"execution reaches an instruction in inconsistent "
|
| ︙ | |||
3738 3739 3740 3741 3742 3743 3744 | 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 | - + + |
* If the block ends a catch, the state for the successor is whatever
* the state was on entry to the catch.
*/
if (enclosing == NULL) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3813 3814 3815 3816 3817 3818 3819 | 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 | - + + |
/* Compilation environment */
Tcl_Interp* interp = (Tcl_Interp*) envPtr->iPtr;
/* Tcl interpreter */
if (assemEnvPtr->curr_bb->catchState >= BBCS_INCATCH) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ |
Changes to generic/tclBasic.c.
| ︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - + |
typedef struct {
Tcl_Interp *interp; /* Interp this struct belongs to. */
Tcl_AsyncHandler async; /* Async handler token for script
* cancellation. */
char *result; /* The script cancellation result or NULL for
* a default result. */
|
| ︙ | |||
111 112 113 114 115 116 117 | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - - + + + - + - + - - + + | static Tcl_ObjCmdProc ExprIsqrtFunc; static Tcl_ObjCmdProc ExprRandFunc; static Tcl_ObjCmdProc ExprRoundFunc; static Tcl_ObjCmdProc ExprSqrtFunc; static Tcl_ObjCmdProc ExprSrandFunc; static Tcl_ObjCmdProc ExprUnaryFunc; static Tcl_ObjCmdProc ExprWideFunc; |
| ︙ | |||
1690 1691 1692 1693 1694 1695 1696 | 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 | - + |
* the source, in order to avoid potential confusion, lets prevent "::" in
* the token too. - dl
*/
if (strstr(hiddenCmdToken, "::") != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use namespace qualifiers in hidden command"
|
| ︙ | |||
1714 1715 1716 1717 1718 1719 1720 | 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 | - - + + |
/*
* Check that the command is really in global namespace
*/
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1844 1845 1846 1847 1848 1849 1850 | 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 | - - + + |
* Check that we have a regular name for the command (that the user is not
* trying to do an expose and a rename (to another namespace) at the same
* time).
*/
if (strstr(cmdName, "::") != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1882 1883 1884 1885 1886 1887 1888 | 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 | - + | /* * This case is theoritically impossible, we might rather Tcl_Panic * than 'nicely' erroring out ? */ Tcl_SetObjResult(interp, Tcl_NewStringObj( "trying to expose a non-global command namespace command", |
| ︙ | |||
2339 2340 2341 2342 2343 2344 2345 | 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 | - + - - + + + - |
*----------------------------------------------------------------------
*/
int
TclInvokeStringCommand(
ClientData clientData, /* Points to command's Command structure. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2387 2388 2389 2390 2391 2392 2393 | 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 | - + + - - + + - |
*----------------------------------------------------------------------
*/
int
TclInvokeObjectCommand(
ClientData clientData, /* Points to command's Command structure. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2589 2590 2591 2592 2593 2594 2595 | 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 | - + - + |
* The trace function needs to get a fully qualified name for old and new
* commands [Tcl bug #651271], or else there's no way for the trace
* function to get the namespace from which the old command is being
* renamed!
*/
Tcl_DStringInit(&newFullName);
|
| ︙ | |||
2882 2883 2884 2885 2886 2887 2888 | 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 | - + - + |
/*
* Add the full name of the containing namespace, followed by the "::"
* separator, and the command name.
*/
if (cmdPtr != NULL) {
if (cmdPtr->nsPtr != NULL) {
|
| ︙ | |||
3380 3381 3382 3383 3384 3385 3386 | 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 | - + |
/*
* If the interpreter has been deleted, return an error.
*/
if (iPtr->flags & DELETED) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3409 3410 3411 3412 3413 3414 3415 | 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 | - + |
*/
if (((iPtr->numLevels) <= iPtr->maxNestingDepth)) {
return TCL_OK;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3518 3519 3520 3521 3522 3523 3524 | 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 | - + |
/*
* If the TCL_LEAVE_ERR_MSG flags bit is set, place an error in the
* interp's result; otherwise, we leave it alone.
*/
if (flags & TCL_LEAVE_ERR_MSG) {
const char *id, *message = NULL;
|
| ︙ | |||
3543 3544 3545 3546 3547 3548 3549 | 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 | - + |
} else {
id = "ICANCEL";
if (length == 0) {
message = "eval canceled";
}
}
|
| ︙ | |||
3689 3690 3691 3692 3693 3694 3695 | 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 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_EvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
|
| ︙ | |||
3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 | 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 | + |
/*
* Schedule leave traces. Raise the refCount on the resolved
* cmdPtr, so that when it passes to the leave traces we know
* it's still valid.
*/
cmdPtr->refCount++;
// TODO: Check consequences of packing objc into a machine word
TclNRAddCallback(interp, TEOV_RunLeaveTraces, INT2PTR(objc),
commandPtr, cmdPtr, objv);
}
TclNRAddCallback(interp, Dispatch,
cmdPtr->nreProc ? cmdPtr->nreProc : cmdPtr->objProc,
cmdPtr->objClientData, INT2PTR(objc), objv);
|
| ︙ | |||
4014 4015 4016 4017 4018 4019 4020 | 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 | - + |
*
*----------------------------------------------------------------------
*/
static void
TEOV_PushExceptionHandlers(
Tcl_Interp *interp,
|
| ︙ | |||
4109 4110 4111 4112 4113 4114 4115 | 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 | - - + |
ClientData data[],
Tcl_Interp *interp,
int result)
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *listPtr;
const char *cmdString;
|
| ︙ | |||
4132 4133 4134 4135 4136 4137 4138 | 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 | - + - + |
iPtr->flags &= ~ERR_ALREADY_LOGGED;
return result;
}
static int
TEOV_NotFound(
Tcl_Interp *interp,
|
| ︙ | |||
4233 4234 4235 4236 4237 4238 4239 | 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 | - + - - + |
static int
TEOV_NotFoundCallback(
ClientData data[],
Tcl_Interp *interp,
int result)
{
Interp *iPtr = (Interp *) interp;
|
| ︙ | |||
4260 4261 4262 4263 4264 4265 4266 | 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 | - + + - + |
}
static int
TEOV_RunEnterTraces(
Tcl_Interp *interp,
Command **cmdPtrPtr,
Tcl_Obj *commandPtr,
|
| ︙ | |||
4318 4319 4320 4321 4322 4323 4324 | 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 | - + |
{
Interp *iPtr = (Interp *) interp;
int traceCode = TCL_OK;
int objc = PTR2INT(data[0]);
Tcl_Obj *commandPtr = data[1];
Command *cmdPtr = data[2];
Tcl_Obj **objv = data[3];
|
| ︙ | |||
4401 4402 4403 4404 4405 4406 4407 | 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 | - + |
int
Tcl_EvalTokensStandard(
Tcl_Interp *interp, /* Interpreter in which to lookup variables,
* execute nested commands, and report
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
|
| ︙ | |||
4434 4435 4436 4437 4438 4439 4440 | 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 | - + - + - + |
*/
int
Tcl_EvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
|
| ︙ | |||
4480 4481 4482 4483 4484 4485 4486 | 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 | - + + - + - + |
{
Interp *iPtr = (Interp *) interp;
const char *p, *next;
const unsigned int minObjs = 20;
Tcl_Obj **objv, **objvSpace;
int *expand, *lines, *lineSpace;
Tcl_Token *tokenPtr;
|
| ︙ | |||
4622 4623 4624 4625 4626 4627 4628 | 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 | - + | * command. We use a separate pointer into the table of * continuation line locations to not lose our position for the * per-command parsing. */ int wordLine = line; const char *wordStart = parsePtr->commandStart; |
| ︙ | |||
4675 4676 4677 4678 4679 4680 4681 | 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 | - + |
if (code != TCL_OK) {
break;
}
objv[objectsUsed] = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(objv[objectsUsed]);
if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
|
| ︙ | |||
4700 4701 4702 4703 4704 4705 4706 | 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 | - + |
} else {
expand[objectsUsed] = 0;
objectsNeeded++;
}
if (wordCLNext) {
TclContinuationsEnterDerived(objv[objectsUsed],
|
| ︙ | |||
4726 4727 4728 4729 4730 4731 4732 | 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 | - + |
ckalloc(objectsNeeded * sizeof(Tcl_Obj *));
lines = lineSpace = ckalloc(objectsNeeded * sizeof(int));
}
objectsUsed = 0;
while (wordIdx--) {
if (expand[wordIdx]) {
|
| ︙ | |||
4955 4956 4957 4958 4959 4960 4961 | 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 | - + |
* TIP #280
*----------------------------------------------------------------------
*/
void
TclAdvanceContinuations(
int *line,
|
| ︙ | |||
5014 5015 5016 5017 5018 5019 5020 | 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 | - + - + + |
*----------------------------------------------------------------------
*/
void
TclArgumentEnter(
Tcl_Interp *interp,
Tcl_Obj **objv,
|
| ︙ | |||
5082 5083 5084 5085 5086 5087 5088 | 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 | - + - + |
*----------------------------------------------------------------------
*/
void
TclArgumentRelease(
Tcl_Interp *interp,
Tcl_Obj **objv,
|
| ︙ | |||
5131 5132 5133 5134 5135 5136 5137 | 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 | - + - + |
*----------------------------------------------------------------------
*/
void
TclArgumentBCEnter(
Tcl_Interp *interp,
Tcl_Obj *objv[],
|
| ︙ | |||
5392 5393 5394 5395 5396 5397 5398 | 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 | - + - + - + |
* a previous call to Tcl_CreateInterp). */
register Tcl_Obj *objPtr, /* Pointer to object containing commands to
* execute. */
int flags, /* Collection of OR-ed bits that control the
* evaluation of the script. Supported values
* are TCL_EVAL_GLOBAL and TCL_EVAL_DIRECT. */
const CmdFrame *invoker, /* Frame of the command doing the eval. */
|
| ︙ | |||
5519 5520 5521 5522 5523 5524 5525 | 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 | - + - + |
return TCL_ERROR;
}
if (flags & TCL_EVAL_GLOBAL) {
savedVarFramePtr = iPtr->varFramePtr;
iPtr->varFramePtr = iPtr->rootFramePtr;
}
Tcl_IncrRefCount(objPtr);
|
| ︙ | |||
5588 5589 5590 5591 5592 5593 5594 | 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 | - + |
if (iPtr->numLevels == 0) {
if (result == TCL_RETURN) {
result = TclUpdateReturnInfo(iPtr);
}
if ((result != TCL_OK) && (result != TCL_ERROR) && !allowExceptions) {
const char *script;
|
| ︙ | |||
5673 5674 5675 5676 5677 5678 5679 | 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 | - + - + |
int returnCode) /* The unexpected result code. */
{
char buf[TCL_INTEGER_SPACE];
Tcl_ResetResult(interp);
if (returnCode == TCL_BREAK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
5722 5723 5724 5725 5726 5727 5728 | 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 | - + |
if (*exprstring == '\0') {
/*
* Legacy compatibility - return 0 for the zero-length string.
*/
*ptr = 0;
} else {
|
| ︙ | |||
5747 5748 5749 5750 5751 5752 5753 | 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 | - + |
if (*exprstring == '\0') {
/*
* Legacy compatibility - return 0 for the zero-length string.
*/
*ptr = 0.0;
} else {
|
| ︙ | |||
5772 5773 5774 5775 5776 5777 5778 | 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 | - + |
* An empty string. Just set the result boolean to 0 (false).
*/
*ptr = 0;
return TCL_OK;
} else {
int result;
|
| ︙ | |||
5930 5931 5932 5933 5934 5935 5936 | 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 | - + |
*----------------------------------------------------------------------
*/
int
TclObjInvokeNamespace(
Tcl_Interp *interp, /* Interpreter in which command is to be
* invoked. */
|
| ︙ | |||
5978 5979 5980 5981 5982 5983 5984 | 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 | - + - + - + |
*----------------------------------------------------------------------
*/
int
TclObjInvoke(
Tcl_Interp *interp, /* Interpreter in which command is to be
* invoked. */
|
| ︙ | |||
6026 6027 6028 6029 6030 6031 6032 | 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 | + - + + + - + + |
"invalid hidden command name \"%s\"", cmdName));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "HIDDENTOKEN", cmdName,
NULL);
return TCL_ERROR;
}
cmdPtr = Tcl_GetHashValue(hPtr);
/*
|
| ︙ | |||
6085 6086 6087 6088 6089 6090 6091 | 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 | - + |
if (expr[0] == '\0') {
/*
* An empty string. Just set the interpreter's result to 0.
*/
Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
} else {
|
| ︙ | |||
6152 6153 6154 6155 6156 6157 6158 | 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 | - + |
void
Tcl_AppendObjToErrorInfo(
Tcl_Interp *interp, /* Interpreter to which error information
* pertains. */
Tcl_Obj *objPtr) /* Message to record. */
{
|
| ︙ | |||
6310 6311 6312 6313 6314 6315 6316 | 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 | - + |
*/
static int
ExprCeilFunc(
ClientData clientData, /* Ignored */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6346 6347 6348 6349 6350 6351 6352 | 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 | - + |
}
static int
ExprFloorFunc(
ClientData clientData, /* Ignored */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6381 6382 6383 6384 6385 6386 6387 | 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 | - + |
return TCL_OK;
}
static int
ExprIsqrtFunc(
ClientData clientData, /* Ignored */
Tcl_Interp *interp, /* The interpreter in which to execute. */
|
| ︙ | |||
6471 6472 6473 6474 6475 6476 6477 | 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 | - + - + |
mp_clear(&big);
Tcl_SetObjResult(interp, Tcl_NewBignumObj(&root));
}
return TCL_OK;
negarg:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
6525 6526 6527 6528 6529 6530 6531 | 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 | - + |
static int
ExprUnaryFunc(
ClientData clientData, /* Contains the address of a function that
* takes one double argument and returns a
* double result. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6585 6586 6587 6588 6589 6590 6591 | 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 | - + |
static int
ExprBinaryFunc(
ClientData clientData, /* Contains the address of a function that
* takes two double arguments and returns a
* double result. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6627 6628 6629 6630 6631 6632 6633 | 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 | - + |
}
static int
ExprAbsFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6736 6737 6738 6739 6740 6741 6742 | 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 | - + - + |
}
static int
ExprBoolFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6784 6785 6786 6787 6788 6789 6790 | 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 | - + |
}
static int
ExprEntierFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6840 6841 6842 6843 6844 6845 6846 | 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 | - + |
}
static int
ExprIntFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6872 6873 6874 6875 6876 6877 6878 | 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 | - + |
}
static int
ExprWideFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6905 6906 6907 6908 6909 6910 6911 | 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 | - + |
}
static int
ExprRandFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
6998 6999 7000 7001 7002 7003 7004 | 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 | - + |
}
static int
ExprRoundFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
7073 7074 7075 7076 7077 7078 7079 | 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 | - + |
}
static int
ExprSrandFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
|
| ︙ | |||
7145 7146 7147 7148 7149 7150 7151 | 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 | - - + + |
*
*----------------------------------------------------------------------
*/
static void
MathFuncWrongNumArgs(
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
7325 7326 7327 7328 7329 7330 7331 | 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 | - + |
*/
int
Tcl_NRCallObjProc(
Tcl_Interp *interp,
Tcl_ObjCmdProc *objProc,
ClientData clientData,
|
| ︙ | |||
7406 7407 7408 7409 7410 7411 7412 | 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 | - + - + |
return TclNREvalObjEx(interp, objPtr, flags, NULL, INT_MIN);
}
int
Tcl_NREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
|
| ︙ | |||
7512 7513 7514 7515 7516 7517 7518 | 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 | - + - + + |
runPtr->data[1] = listPtr;
}
int
TclNRTailcallObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
7556 7557 7558 7559 7560 7561 7562 | 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 | - + - + |
Tcl_Namespace *ns1Ptr;
/* The tailcall data is in a Tcl list: the first element is the
* namespace, the rest the command to be tailcalled. */
listPtr = Tcl_NewListObj(objc, objv);
|
| ︙ | |||
7661 7662 7663 7664 7665 7666 7667 | 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 | - + - + - + - + - + |
#define iPtr ((Interp *) interp)
int
TclNRYieldObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
7938 7939 7940 7941 7942 7943 7944 | 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 | - + |
} else {
/*
* Coroutine is active: yield
*/
if (corPtr->stackLevel != stackLevel) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
7978 7979 7980 7981 7982 7983 7984 | 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 | - + - + - + + - + |
*----------------------------------------------------------------------
*/
static int
NRCoroInjectObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
8057 8058 8059 8060 8061 8062 8063 | 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 | - - - - + + + + |
Tcl_SetObjResult(interp, objv[1]);
} else if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?arg?");
return TCL_ERROR;
}
break;
default:
|
| ︙ | |||
8092 8093 8094 8095 8096 8097 8098 | 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 | - + |
*----------------------------------------------------------------------
*/
int
TclNRCoroutineObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
8148 8149 8150 8151 8152 8153 8154 | 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 | - + - + |
* struct and create the corresponding command.
*/
corPtr = ckalloc(sizeof(CoroutineData));
Tcl_DStringInit(&ds);
if (nsPtr != iPtr->globalNsPtr) {
|
| ︙ | |||
8242 8243 8244 8245 8246 8247 8248 | 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 | - + |
* This is used in the [info] ensemble
*/
int
TclInfoCoroutineCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ |
Changes to generic/tclBinary.c.
| ︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - - + + + | #include <math.h> /* * The following constants are used by GetFormatSpec to indicate various * special conditions in the parsing of a format specifier. */ |
| ︙ | |||
56 57 58 59 60 61 62 | 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 | - + - + - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - | static void DupByteArrayInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); static int FormatNumber(Tcl_Interp *interp, int type, Tcl_Obj *src, unsigned char **cursorPtr); static void FreeByteArrayInternalRep(Tcl_Obj *objPtr); static int GetFormatSpec(const char **formatPtr, char *cmdPtr, |
| ︙ | |||
191 192 193 194 195 196 197 | 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 | - + - + - + |
* The following structure is the internal rep for a ByteArray object. Keeps
* track of how much memory has been used and how much has been allocated for
* the byte array to enable growing and shrinking of the ByteArray object with
* fewer mallocs.
*/
typedef struct {
|
| ︙ | |||
232 233 234 235 236 237 238 | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | - + |
#undef Tcl_NewByteArrayObj
Tcl_Obj *
Tcl_NewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
|
| ︙ | |||
275 276 277 278 279 280 281 | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
|
| ︙ | |||
315 316 317 318 319 320 321 | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | - - - + + + - - - - + |
*----------------------------------------------------------------------
*/
void
Tcl_SetByteArrayObj(
Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */
const unsigned char *bytes, /* The array of bytes to use as the new
|
| ︙ | |||
362 363 364 365 366 367 368 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | - + |
*
*----------------------------------------------------------------------
*/
unsigned char *
Tcl_GetByteArrayFromObj(
Tcl_Obj *objPtr, /* The ByteArray object. */
|
| ︙ | |||
403 404 405 406 407 408 409 | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | - + |
*
*----------------------------------------------------------------------
*/
unsigned char *
Tcl_SetByteArrayLength(
Tcl_Obj *objPtr, /* The ByteArray object. */
|
| ︙ | |||
446 447 448 449 450 451 452 | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | - + |
*/
static int
SetByteArrayFromAny(
Tcl_Interp *interp, /* Not used. */
Tcl_Obj *objPtr) /* The object to convert to type ByteArray. */
{
|
| ︙ | |||
519 520 521 522 523 524 525 | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | - + - + |
*/
static void
DupByteArrayInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
|
| ︙ | |||
561 562 563 564 565 566 567 | 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 | - + - + - + - + |
*/
static void
UpdateStringOfByteArray(
Tcl_Obj *objPtr) /* ByteArray object whose string rep to
* update. */
{
|
| ︙ | |||
624 625 626 627 628 629 630 | 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 | - + - + - + |
*----------------------------------------------------------------------
*/
void
TclAppendBytesToByteArray(
Tcl_Obj *objPtr,
const unsigned char *bytes,
|
| ︙ | |||
744 745 746 747 748 749 750 | 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 | - + - + - + + - + |
*----------------------------------------------------------------------
*/
static int
BinaryFormatCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
859 860 861 862 863 864 865 | 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 | - + - + - + + |
* non-list value.
*/
if (count == BINARY_NOCOUNT) {
arg++;
count = 1;
} else {
|
| ︙ | |||
937 938 939 940 941 942 943 | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | - + |
/*
* Prepare the result object by preallocating the caclulated number of
* bytes and filling with nulls.
*/
resultPtr = Tcl_NewObj();
buffer = Tcl_SetByteArrayLength(resultPtr, length);
|
| ︙ | |||
974 975 976 977 978 979 980 | 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 | - + - + - + |
if (count == BINARY_ALL) {
count = length;
} else if (count == BINARY_NOCOUNT) {
count = 1;
}
if (length >= count) {
|
| ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | - + |
break;
}
case 'h':
case 'H': {
unsigned char *last;
int c;
|
| ︙ | |||
1135 1136 1137 1138 1139 1140 1141 | 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 | - + - + - + + |
case 'W':
case 'r':
case 'R':
case 'd':
case 'q':
case 'Q':
case 'f': {
|
| ︙ | |||
1225 1226 1227 1228 1229 1230 1231 | 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 | - + |
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad field specifier \"%s\"", buf));
return TCL_ERROR;
}
error:
|
| ︙ | |||
1249 1250 1251 1252 1253 1254 1255 | 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 | - + - + - + - + - - |
*----------------------------------------------------------------------
*/
int
BinaryScanCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1569 1570 1571 1572 1573 1574 1575 | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 | - + |
}
/*
* Set the result to the last position of the cursor.
*/
done:
|
| ︙ | |||
1595 1596 1597 1598 1599 1600 1601 | 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 | - + |
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad field specifier \"%s\"", buf));
return TCL_ERROR;
}
error:
|
| ︙ | |||
1624 1625 1626 1627 1628 1629 1630 | 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | - + |
*----------------------------------------------------------------------
*/
static int
GetFormatSpec(
const char **formatPtr, /* Pointer to format string. */
char *cmdPtr, /* Pointer to location of command char. */
|
| ︙ | |||
1782 1783 1784 1785 1786 1787 1788 | 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | - + |
*----------------------------------------------------------------------
*/
static void
CopyNumber(
const void *from, /* source */
void *to, /* destination */
|
| ︙ | |||
2305 2306 2307 2308 2309 2310 2311 | 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 | - + - + |
*----------------------------------------------------------------------
*/
static int
BinaryEncodeHex(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2349 2350 2351 2352 2353 2354 2355 | 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 | - + + - + |
*----------------------------------------------------------------------
*/
static int
BinaryDecodeHex(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2377 2378 2379 2380 2381 2382 2383 | 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 | - + |
strict = 1;
break;
}
}
TclNewObj(resultObj);
datastart = data = (unsigned char *)
|
| ︙ | |||
2417 2418 2419 2420 2421 2422 2423 | 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 | - + |
}
*cursor++ = UCHAR(value);
value = 0;
}
if (cut > size) {
cut = size;
}
|
| ︙ | |||
2468 2469 2470 2471 2472 2473 2474 | 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 | - + - + + - - + - + + + + + + + |
} \
} while (0)
static int
BinaryEncode64(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2574 2575 2576 2577 2578 2579 2580 | 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 | - + - - + + - + |
*----------------------------------------------------------------------
*/
static int
BinaryEncodeUu(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2690 2691 2692 2693 2694 2695 2696 | 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 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 | - + - + + - + - + - + - + |
*----------------------------------------------------------------------
*/
static int
BinaryDecodeUu(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2792 2793 2794 2795 2796 2797 2798 | 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 | - + |
/*
* If we've reached the end of the line, skip until we process a
* newline.
*/
if (lineLen == 0 && data < dataend) {
|
| ︙ | |||
2814 2815 2816 2817 2818 2819 2820 | 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 | - + |
/*
* Sanity check, clean up and finish.
*/
if (lineLen > 0 && strict) {
goto shortUu;
}
|
| ︙ | |||
2853 2854 2855 2856 2857 2858 2859 | 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 | - + - + - - - + + |
*----------------------------------------------------------------------
*/
static int
BinaryDecode64(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2883 2884 2885 2886 2887 2888 2889 | 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 | - + |
strict = 1;
break;
}
}
TclNewObj(resultObj);
datastart = data = (unsigned char *)
|
| ︙ | |||
2976 2977 2978 2979 2980 2981 2982 | 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 | - - + + - |
}
Tcl_SetByteArrayLength(resultObj, cursor - begin - cut);
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
bad64:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
Changes to generic/tclCkalloc.c.
| ︙ | |||
128 129 130 131 132 133 134 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - + - + | static int ckallocInit = 0; /* * Prototypes for procedures defined in this file: */ static int CheckmemCmd(ClientData clientData, Tcl_Interp *interp, |
| ︙ | |||
196 197 198 199 200 201 202 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - + |
(unsigned long)current_bytes_malloced,
maximum_malloc_packets,
(unsigned long)maximum_bytes_malloced);
if (flags == 0) {
fprintf((FILE *)clientData, "%s", buf);
} else {
/* Assume objPtr to append to */
|
| ︙ | |||
390 391 392 393 394 395 396 | 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 | - + - + | * and __LINE__. * *---------------------------------------------------------------------- */ char * Tcl_DbCkalloc( |
| ︙ | |||
454 455 456 457 458 459 460 | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | - + |
total_mallocs);
fflush(stderr);
alloc_tracing = TRUE;
trace_on_at_malloc = 0;
}
if (alloc_tracing) {
|
| ︙ | |||
480 481 482 483 484 485 486 | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | - + |
Tcl_MutexUnlock(ckallocMutexPtr);
return result->body;
}
char *
Tcl_AttemptDbCkalloc(
|
| ︙ | |||
543 544 545 546 547 548 549 | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | - + |
total_mallocs);
fflush(stderr);
alloc_tracing = TRUE;
trace_on_at_malloc = 0;
}
if (alloc_tracing) {
|
| ︙ | |||
666 667 668 669 670 671 672 | 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 | - + |
*
*--------------------------------------------------------------------
*/
char *
Tcl_DbCkrealloc(
char *ptr,
|
| ︙ | |||
697 698 699 700 701 702 703 | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | - + |
Tcl_DbCkfree(ptr, file, line);
return newPtr;
}
char *
Tcl_AttemptDbCkrealloc(
char *ptr,
|
| ︙ | |||
748 749 750 751 752 753 754 | 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 | - + - + - + + - + | * Same as the debug versions. * *---------------------------------------------------------------------- */ char * Tcl_Alloc( |
| ︙ | |||
809 810 811 812 813 814 815 | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | - + |
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
MemoryCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
986 987 988 989 990 991 992 | 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | - + |
*----------------------------------------------------------------------
*/
static int
CheckmemCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Interpreter for evaluation. */
|
| ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 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 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 | - + - - - + - + - + - - - + - + - + - + - - + - + - - + - - - + - + - + - + - + - + - - + - + - | * that memory was actually allocated. * *---------------------------------------------------------------------- */ char * Tcl_Alloc( |
| ︙ |
Changes to generic/tclClock.c.
| ︙ | |||
138 139 140 141 142 143 144 | 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 | - + - + - + - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - | /* * Function prototypes for local procedures in this file: */ static int ConvertUTCToLocal(Tcl_Interp *, TclDateFields *, Tcl_Obj *, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, |
| ︙ | |||
266 267 268 269 270 271 272 | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | - + |
* Create the client data, which is a refcounted literal pool.
*/
data = ckalloc(sizeof(ClockClientData));
data->refCount = 0;
data->literals = ckalloc(LIT__END * sizeof(Tcl_Obj*));
for (i = 0; i < LIT__END; ++i) {
|
| ︙ | |||
315 316 317 318 319 320 321 | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | - + |
*----------------------------------------------------------------------
*/
static int
ClockConvertlocaltoutcObjCmd(
ClientData clientData, /* Client data */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
342 343 344 345 346 347 348 | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | - + |
dict = objv[1];
if (Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS],
&secondsObj)!= TCL_OK) {
return TCL_ERROR;
}
if (secondsObj == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("key \"localseconds\" not "
|
| ︙ | |||
407 408 409 410 411 412 413 | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | - + |
*----------------------------------------------------------------------
*/
int
ClockGetdatefieldsObjCmd(
ClientData clientData, /* Opaque pointer to literal pool, etc. */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
521 522 523 524 525 526 527 | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | - + |
*----------------------------------------------------------------------
*/
static int
ClockGetjuliandayfromerayearmonthdayObjCmd(
ClientData clientData, /* Opaque pointer to literal pool, etc. */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
611 612 613 614 615 616 617 | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | - + |
*----------------------------------------------------------------------
*/
static int
ClockGetjuliandayfromerayearweekdayObjCmd(
ClientData clientData, /* Opaque pointer to literal pool, etc. */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
701 702 703 704 705 706 707 | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | - + |
static int
ConvertLocalToUTC(
Tcl_Interp *interp, /* Tcl interpreter */
TclDateFields *fields, /* Fields of the time */
Tcl_Obj *tzdata, /* Time zone data */
int changeover) /* Julian Day of the Gregorian transition */
{
|
| ︙ | |||
746 747 748 749 750 751 752 | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | - + - + |
*----------------------------------------------------------------------
*/
static int
ConvertLocalToUTCUsingTable(
Tcl_Interp *interp, /* Tcl interpreter */
TclDateFields *fields, /* Time to convert, with 'seconds' filled in */
|
| ︙ | |||
875 876 877 878 879 880 881 | 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | - + |
/*
* If conversion fails, report an error.
*/
if (localErrno != 0
|| (fields->seconds == -1 && timeVal.tm_yday == -1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
904 905 906 907 908 909 910 | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | - + |
static int
ConvertUTCToLocal(
Tcl_Interp *interp, /* Tcl interpreter */
TclDateFields *fields, /* Fields of the time */
Tcl_Obj *tzdata, /* Time zone data */
int changeover) /* Julian Day of the Gregorian transition */
{
|
| ︙ | |||
949 950 951 952 953 954 955 | 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | - + - + |
*----------------------------------------------------------------------
*/
static int
ConvertUTCToLocalUsingTable(
Tcl_Interp *interp, /* Tcl interpreter */
TclDateFields *fields, /* Fields of the date */
|
| ︙ | |||
1015 1016 1017 1018 1019 1020 1021 | 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 | - + + - + |
/*
* Use 'localtime' to determine local year, month, day, time of day.
*/
tock = (time_t) fields->seconds;
if ((Tcl_WideInt) tock != fields->seconds) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1066 1067 1068 1069 1070 1071 1072 | 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 | - + |
sprintf(buffer+1, "%02d", diff / 3600);
diff %= 3600;
sprintf(buffer+3, "%02d", diff / 60);
diff %= 60;
if (diff > 0) {
sprintf(buffer+5, "%02d", diff);
}
|
| ︙ | |||
1089 1090 1091 1092 1093 1094 1095 | 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | - + |
*----------------------------------------------------------------------
*/
static Tcl_Obj *
LookupLastTransition(
Tcl_Interp *interp, /* Interpreter for error messages */
Tcl_WideInt tick, /* Time from the epoch */
|
| ︙ | |||
1591 1592 1593 1594 1595 1596 1597 | 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 | - + - + |
*----------------------------------------------------------------------
*/
int
ClockGetenvObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1676 1677 1678 1679 1680 1681 1682 | 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 | - + |
*----------------------------------------------------------------------
*/
int
ClockClicksObjCmd(
ClientData clientData, /* Client data is unused */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
1747 1748 1749 1750 1751 1752 1753 | 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | - + |
*----------------------------------------------------------------------
*/
int
ClockMillisecondsObjCmd(
ClientData clientData, /* Client data is unused */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
1784 1785 1786 1787 1788 1789 1790 | 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | - + |
*----------------------------------------------------------------------
*/
int
ClockMicrosecondsObjCmd(
ClientData clientData, /* Client data is unused */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
1821 1822 1823 1824 1825 1826 1827 | 1802 1803 1804 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 | - + - + |
*-----------------------------------------------------------------------------
*/
static int
ClockParseformatargsObjCmd(
ClientData clientData, /* Client data containing literal pool */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
1939 1940 1941 1942 1943 1944 1945 | 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 | - + |
*----------------------------------------------------------------------
*/
int
ClockSecondsObjCmd(
ClientData clientData, /* Client data is unused */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ |
Changes to generic/tclCmdAH.c.
| ︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | - - - - + + + + - + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + |
* all its working arrays appended afterwards so they can be allocated and
* freed in a single step.
*/
struct ForeachState {
Tcl_Obj *bodyPtr; /* The script body of the command. */
int bodyIdx; /* The argument index of the body. */
|
| ︙ | |||
115 116 117 118 119 120 121 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + |
*/
/* ARGSUSED */
int
Tcl_BreakObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
147 148 149 150 151 152 153 | 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 | - + - + |
*/
/* ARGSUSED */
int
Tcl_CatchObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
253 254 255 256 257 258 259 | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | - + |
*/
/* ARGSUSED */
int
Tcl_CdObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
309 310 311 312 313 314 315 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | - + |
*/
/* ARGSUSED */
int
Tcl_ConcatObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
344 345 346 347 348 349 350 | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | - + |
*/
/* ARGSUSED */
int
Tcl_ContinueObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
374 375 376 377 378 379 380 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_EncodingObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
402 403 404 405 406 407 408 | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | - + |
switch ((enum options) index) {
case ENC_CONVERTTO:
case ENC_CONVERTFROM: {
Tcl_Obj *data;
Tcl_DString ds;
Tcl_Encoding encoding;
|
| ︙ | |||
464 465 466 467 468 469 470 | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | - + |
case ENC_SYSTEM:
if (objc > 3) {
Tcl_WrongNumArgs(interp, 2, objv, "?encoding?");
return TCL_ERROR;
}
if (objc == 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
493 494 495 496 497 498 499 | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | - + |
*----------------------------------------------------------------------
*/
int
EncodingDirsObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
542 543 544 545 546 547 548 | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | - + |
*/
/* ARGSUSED */
int
Tcl_ErrorObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
605 606 607 608 609 610 611 | 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 | - + - + |
return result;
}
int
Tcl_EvalObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
675 676 677 678 679 680 681 | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | - + |
*/
/* ARGSUSED */
int
Tcl_ExitObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
724 725 726 727 728 729 730 | 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 | - + - + |
*/
/* ARGSUSED */
int
Tcl_ExprObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
921 922 923 924 925 926 927 | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | - + + - + + |
Tcl_DStringInit(&newBuf);
TclDStringAppendLiteral(&newBuf, "tcl:file:");
for (i=0 ; unsafeInfo[i].cmdName != NULL ; i++) {
if (unsafeInfo[i].unsafe) {
const char *oldName, *newName;
Tcl_DStringSetLength(&oldBuf, 13);
|
| ︙ | |||
972 973 974 975 976 977 978 | 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 | - + |
*----------------------------------------------------------------------
*/
static int
BadFileSubcommand(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1004 1005 1006 1007 1008 1009 1010 | 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrAccessTimeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1076 1077 1078 1079 1080 1081 1082 | 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrModifyTimeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1146 1147 1148 1149 1150 1151 1152 | 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrLinkStatCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1182 1183 1184 1185 1186 1187 1188 | 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrStatCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1218 1219 1220 1221 1222 1223 1224 | 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 | - + - + |
*----------------------------------------------------------------------
*/
static int
FileAttrTypeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1256 1257 1258 1259 1260 1261 1262 | 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrSizeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1293 1294 1295 1296 1297 1298 1299 | 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrIsDirectoryCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrIsExecutableCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1362 1363 1364 1365 1366 1367 1368 | 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrIsExistingCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1393 1394 1395 1396 1397 1398 1399 | 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrIsFileCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1431 1432 1433 1434 1435 1436 1437 | 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrIsOwnedCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1481 1482 1483 1484 1485 1486 1487 | 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrIsReadableCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1512 1513 1514 1515 1516 1517 1518 | 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 | - + |
*----------------------------------------------------------------------
*/
static int
FileAttrIsWritableCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1543 1544 1545 1546 1547 1548 1549 | 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 | - + |
*----------------------------------------------------------------------
*/
static int
PathDirNameCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1582 1583 1584 1585 1586 1587 1588 | 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | - + |
*----------------------------------------------------------------------
*/
static int
PathExtensionCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1621 1622 1623 1624 1625 1626 1627 | 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 | - + |
*----------------------------------------------------------------------
*/
static int
PathRootNameCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1660 1661 1662 1663 1664 1665 1666 | 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 | - + |
*----------------------------------------------------------------------
*/
static int
PathTailCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1699 1700 1701 1702 1703 1704 1705 | 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | - + - + + |
*----------------------------------------------------------------------
*/
static int
PathFilesystemCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1740 1741 1742 1743 1744 1745 1746 | 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 | - + |
*----------------------------------------------------------------------
*/
static int
PathJoinCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1772 1773 1774 1775 1776 1777 1778 | 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 | - + |
*----------------------------------------------------------------------
*/
static int
PathNativeNameCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1809 1810 1811 1812 1813 1814 1815 | 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 | - + |
*----------------------------------------------------------------------
*/
static int
PathNormalizeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1847 1848 1849 1850 1851 1852 1853 | 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 | - + |
*----------------------------------------------------------------------
*/
static int
PathSplitCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1890 1891 1892 1893 1894 1895 1896 | 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 | - + |
*----------------------------------------------------------------------
*/
static int
PathTypeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1938 1939 1940 1941 1942 1943 1944 | 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 | - + |
*----------------------------------------------------------------------
*/
static int
FilesystemSeparatorCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1962 1963 1964 1965 1966 1967 1968 | 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 | - + |
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(separator, 1));
} else {
Tcl_Obj *separatorObj = Tcl_FSPathSeparator(objv[1]);
if (separatorObj == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1993 1994 1995 1996 1997 1998 1999 | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 | - + |
*----------------------------------------------------------------------
*/
static int
FilesystemVolumesCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2160 2161 2162 2163 2164 2165 2166 | 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 | - + + |
STORE_ARY("blksize", Tcl_NewLongObj((long)statPtr->st_blksize));
#endif
STORE_ARY("atime", Tcl_NewLongObj((long)statPtr->st_atime));
STORE_ARY("mtime", Tcl_NewLongObj((long)statPtr->st_mtime));
STORE_ARY("ctime", Tcl_NewLongObj((long)statPtr->st_ctime));
mode = (unsigned short) statPtr->st_mode;
STORE_ARY("mode", Tcl_NewIntObj(mode));
|
| ︙ | |||
2254 2255 2256 2257 2258 2259 2260 | 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 | - + - + |
*/
/* ARGSUSED */
int
Tcl_ForObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2449 2450 2451 2452 2453 2454 2455 | 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 | - + - + - + - + - + - + - + |
*/
/* ARGSUSED */
int
Tcl_ForeachObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2520 2521 2522 2523 2524 2525 2526 | 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 | - + - + - + - + |
*
* The setting up of all of these pointers is moderately messy, but allows
* the rest of this code to be simple and for us to use a single memory
* allocation for better performance.
*/
statePtr = TclStackAlloc(interp,
|
| ︙ | |||
2596 2597 2598 2599 2600 2601 2602 | 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 | - + |
result = ForeachAssignments(interp, statePtr);
if (result == TCL_ERROR) {
goto done;
}
TclNRAddCallback(interp, ForeachLoopStep, statePtr, NULL, NULL, NULL);
return TclNREvalObjEx(interp, objv[objc-1], 0,
|
| ︙ | |||
2691 2692 2693 2694 2695 2696 2697 | 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 | - + |
*/
static inline int
ForeachAssignments(
Tcl_Interp *interp,
struct ForeachState *statePtr)
{
|
| ︙ | |||
2729 2730 2731 2732 2733 2734 2735 | 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 | - + |
*/
static inline void
ForeachCleanup(
Tcl_Interp *interp,
struct ForeachState *statePtr)
{
|
| ︙ | |||
2767 2768 2769 2770 2771 2772 2773 | 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 | - + |
*/
/* ARGSUSED */
int
Tcl_FormatObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to generic/tclCmdIL.c.
| ︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | - + - - + + - + |
typedef struct {
int isIncreasing; /* Nonzero means sort in increasing order. */
int sortMode; /* The sort mode. One of SORTMODE_* values
* defined below. */
Tcl_Obj *compareCmdPtr; /* The Tcl comparison command when sortMode is
* SORTMODE_COMMAND. Pre-initialized to hold
* base of command. */
|
| ︙ | |||
103 104 105 106 107 108 109 | 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 134 135 | - + - - + - - + - - + - - + - - + - - - + - - - + - - + - - + - - + - - + - - + - - + - - - + - - + - - + - - + - - + - | /* * Forward declarations for procedures defined in this file: */ static int DictionaryCompare(const char *left, const char *right); static int IfConditionCallback(ClientData data[], Tcl_Interp *interp, int result); |
| ︙ | |||
209 210 211 212 213 214 215 | 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 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_IfObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
345 346 347 348 349 350 351 | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | - + |
if (i >= objc) {
goto missingScript;
}
}
if (i < objc - 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong # args: extra words after \"else\" clause in \"if\" command",
|
| ︙ | |||
392 393 394 395 396 397 398 | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_IncrObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
473 474 475 476 477 478 479 | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | - + |
*----------------------------------------------------------------------
*/
static int
InfoArgsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
505 506 507 508 509 510 511 | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | - + |
*/
listObjPtr = Tcl_NewListObj(0, NULL);
for (localPtr = procPtr->firstLocalPtr; localPtr != NULL;
localPtr = localPtr->nextPtr) {
if (TclIsVarArgument(localPtr)) {
Tcl_ListObjAppendElement(interp, listObjPtr,
|
| ︙ | |||
536 537 538 539 540 541 542 | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | - + |
*----------------------------------------------------------------------
*/
static int
InfoBodyCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
607 608 609 610 611 612 613 | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | - + |
*----------------------------------------------------------------------
*/
static int
InfoCmdCountCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
649 650 651 652 653 654 655 | 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 | - + - + |
*----------------------------------------------------------------------
*/
static int
InfoCommandsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
727 728 729 730 731 732 733 | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 | - + |
if (entryPtr != NULL) {
if (specificNsInPattern) {
cmd = Tcl_GetHashValue(entryPtr);
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
|
| ︙ | |||
755 756 757 758 759 760 761 | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | - + |
if (entryPtr == NULL) {
tablePtr = &globalNsPtr->cmdTable;
entryPtr = Tcl_FindHashEntry(tablePtr, simplePattern);
}
if (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(tablePtr, entryPtr);
Tcl_ListObjAppendElement(interp, listPtr,
|
| ︙ | |||
777 778 779 780 781 782 783 | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | - + |
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (specificNsInPattern) {
cmd = Tcl_GetHashValue(entryPtr);
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
|
| ︙ | |||
800 801 802 803 804 805 806 | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | - + |
entryPtr = Tcl_FirstHashEntry(&globalNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (Tcl_FindHashEntry(&nsPtr->cmdTable,cmdName) == NULL) {
Tcl_ListObjAppendElement(interp, listPtr,
|
| ︙ | |||
829 830 831 832 833 834 835 | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | - + |
Tcl_InitObjHashTable(&addedCommandsTable);
entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
|
| ︙ | |||
855 856 857 858 859 860 861 | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | - + |
foundGlobal = 1;
}
entryPtr = Tcl_FirstHashEntry(&pathNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&pathNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
|
| ︙ | |||
882 883 884 885 886 887 888 | 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | - + |
if (!foundGlobal) {
entryPtr = Tcl_FirstHashEntry(&globalNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
|
| ︙ | |||
926 927 928 929 930 931 932 | 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | - + |
*----------------------------------------------------------------------
*/
static int
InfoCompleteCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
963 964 965 966 967 968 969 | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | - + |
*----------------------------------------------------------------------
*/
static int
InfoDefaultCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | - + |
*----------------------------------------------------------------------
*/
static int
InfoErrorStackCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1094 1095 1096 1097 1098 1099 1100 | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | - + |
*----------------------------------------------------------------------
*/
int
TclInfoExistsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1139 1140 1141 1142 1143 1144 1145 | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | - + |
*----------------------------------------------------------------------
*/
static int
InfoFrameCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1270 1271 1272 1273 1274 1275 1276 | 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | - + |
Tcl_Interp *interp, /* Current interpreter. */
CmdFrame *framePtr) /* Frame to get info for. */
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *tmpObj;
Tcl_Obj *lv[20]; /* Keep uptodate when more keys are added to
* the dict. */
|
| ︙ | |||
1297 1298 1299 1300 1301 1302 1303 | 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 | - + + - + + |
switch (framePtr->type) {
case TCL_LOCATION_EVAL:
/*
* Evaluation, dynamic script. Type, line, cmd, the latter through
* str.
*/
|
| ︙ | |||
1336 1337 1338 1339 1340 1341 1342 | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | - + + | TclGetSrcInfoForPc(fPtr); /* * Now filled: cmd.str.(cmd,len), line * Possibly modified: type, path! */ |
| ︙ | |||
1361 1362 1363 1364 1365 1366 1367 | 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 | - + + |
}
case TCL_LOCATION_SOURCE:
/*
* Evaluation of a script file.
*/
|
| ︙ | |||
1399 1400 1401 1402 1403 1404 1405 | 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | - + - + + |
TclNewObj(procNameObj);
Tcl_GetCommandFullName(interp, (Tcl_Command) procPtr->cmdPtr,
procNameObj);
ADD_PAIR("proc", procNameObj);
} else if (procPtr->cmdPtr->clientData) {
ExtraFrameInfo *efiPtr = procPtr->cmdPtr->clientData;
|
| ︙ | |||
1467 1468 1469 1470 1471 1472 1473 | 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | - + |
*----------------------------------------------------------------------
*/
static int
InfoFunctionsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1491 1492 1493 1494 1495 1496 1497 | 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | - + |
" ::foreach cmd [::info commands tcl::mathfunc::$pattern] {\n"
" ::set cmd [::namespace tail $cmd]\n"
" ::if {$cmd ni $cmds} {\n"
" ::lappend cmds $cmd\n"
" }\n"
" }\n"
" ::return $cmds\n"
|
| ︙ | |||
1532 1533 1534 1535 1536 1537 1538 | 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 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
InfoHostnameCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1578 1579 1580 1581 1582 1583 1584 | 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 | - + |
*----------------------------------------------------------------------
*/
static int
InfoLevelCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1652 1653 1654 1655 1656 1657 1658 | 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 1666 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
InfoLibraryCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1699 1700 1701 1702 1703 1704 1705 | 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 | - + |
*----------------------------------------------------------------------
*/
static int
InfoLoadedCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1742 1743 1744 1745 1746 1747 1748 | 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 | - + |
*----------------------------------------------------------------------
*/
static int
InfoNameOfExecutableCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1778 1779 1780 1781 1782 1783 1784 | 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 | - + - + |
*----------------------------------------------------------------------
*/
static int
InfoPatchLevelCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1825 1826 1827 1828 1829 1830 1831 | 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 | - + |
*----------------------------------------------------------------------
*/
static int
InfoProcsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1904 1905 1906 1907 1908 1909 1910 | 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 | - + |
} else {
simpleProcOK:
if (specificNsInPattern) {
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
elemObjPtr);
} else {
|
| ︙ | |||
1932 1933 1934 1935 1936 1937 1938 | 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 | - + |
} else {
procOK:
if (specificNsInPattern) {
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
elemObjPtr);
} else {
|
| ︙ | |||
1971 1972 1973 1974 1975 1976 1977 | 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | - + |
cmdPtr = Tcl_GetHashValue(entryPtr);
realCmdPtr = (Command *) TclGetOriginalCommand(
(Tcl_Command) cmdPtr);
if (TclIsProc(cmdPtr) || ((realCmdPtr != NULL)
&& TclIsProc(realCmdPtr))) {
Tcl_ListObjAppendElement(interp, listPtr,
|
| ︙ | |||
2012 2013 2014 2015 2016 2017 2018 | 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 | - + |
*----------------------------------------------------------------------
*/
static int
InfoScriptCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2059 2060 2061 2062 2063 2064 2065 | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 | - + - + |
*----------------------------------------------------------------------
*/
static int
InfoSharedlibCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2097 2098 2099 2100 2101 2102 2103 | 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 | - + |
*----------------------------------------------------------------------
*/
static int
InfoTclVersionCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2137 2138 2139 2140 2141 2142 2143 | 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_JoinObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2194 2195 2196 2197 2198 2199 2200 | 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_LassignObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2268 2269 2270 2271 2272 2273 2274 | 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_LindexObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2327 2328 2329 2330 2331 2332 2333 | 2310 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 | - + + - + - + - - + + - + - + + |
*----------------------------------------------------------------------
*/
int
Tcl_LinsertObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2406 2407 2408 2409 2410 2411 2412 | 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 | - + - - + |
*----------------------------------------------------------------------
*/
int
Tcl_ListObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2442 2443 2444 2445 2446 2447 2448 | 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 2454 2455 2456 2457 2458 2459 2460 2461 2462 | - + - - + - + + - + + |
*----------------------------------------------------------------------
*/
int
Tcl_LlengthObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2488 2489 2490 2491 2492 2493 2494 | 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 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 | - + - - + + - + + - + - - + - - + - + - - + - - - + + + - + |
*----------------------------------------------------------------------
*/
int
Tcl_LrangeObjCmd(
ClientData notUsed, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2583 2584 2585 2586 2587 2588 2589 | 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 | - + - - + - + + |
*----------------------------------------------------------------------
*/
int
Tcl_LrepeatObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2619 2620 2621 2622 2623 2624 2625 | 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 | - + |
*/
objc -= 2;
objv += 2;
/* Final sanity check. Do not exceed limits on max list length. */
|
| ︙ | |||
2656 2657 2658 2659 2660 2661 2662 | 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 | - + |
register Tcl_Obj *tmpPtr = objv[0];
tmpPtr->refCount += elementCount;
for (i=0 ; i<elementCount ; i++) {
dataArray[i] = tmpPtr;
}
} else {
|
| ︙ | |||
2692 2693 2694 2695 2696 2697 2698 | 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 | - + + - + + |
*----------------------------------------------------------------------
*/
int
Tcl_LreplaceObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2743 2744 2745 2746 2747 2748 2749 | 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 | - + |
if ((first >= listLen) && (listLen > 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"list doesn't contain element %s", TclGetString(objv[2])));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LREPLACE", "BADIDX",
NULL);
return TCL_ERROR;
}
|
| ︙ | |||
2801 2802 2803 2804 2805 2806 2807 | 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_LreverseObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2880 2881 2882 2883 2884 2885 2886 | 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 | - + - - + + + + |
*----------------------------------------------------------------------
*/
int
Tcl_LsearchObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3010 3011 3012 3013 3014 3015 3016 | 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 | - + - + |
* If there was a previous -start option, release its saved index
* because it will either be replaced or there will be an error.
*/
if (startPtr != NULL) {
Tcl_DecrRefCount(startPtr);
}
|
| ︙ | |||
3039 3040 3041 3042 3043 3044 3045 | 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 | - + - + |
case LSEARCH_INDEX: { /* -index */
Tcl_Obj **indices;
int j;
if (sortInfo.indexc > 1) {
TclStackFree(interp, sortInfo.indexv);
}
|
| ︙ | |||
3073 3074 3075 3076 3077 3078 3079 | 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 | - + | sortInfo.indexv = NULL; break; case 1: sortInfo.indexv = &sortInfo.singleIndex; break; default: sortInfo.indexv = |
| ︙ | |||
3105 3106 3107 3108 3109 3110 3111 | 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 | - + + - + |
*/
if (returnSubindices && sortInfo.indexc==0) {
if (startPtr != NULL) {
Tcl_DecrRefCount(startPtr);
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3460 3461 3462 3463 3464 3465 3466 | 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 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 3491 | - + - + - + - + - + |
} else {
itemPtr = listv[i];
}
Tcl_ListObjAppendElement(interp, listPtr, itemPtr);
} else if (returnSubindices) {
int j;
|
| ︙ | |||
3535 3536 3537 3538 3539 3540 3541 | 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_LsetObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3620 3621 3622 3623 3624 3625 3626 | 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 | - + - - + + |
*----------------------------------------------------------------------
*/
int
Tcl_LsortObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3683 3684 3685 3686 3687 3688 3689 | 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 | - + - + - + |
case LSORT_ASCII:
sortInfo.sortMode = SORTMODE_ASCII;
break;
case LSORT_COMMAND:
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-command\" option must be followed "
|
| ︙ | |||
3731 3732 3733 3734 3735 3736 3737 | 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 | - + |
* options is done.
*/
for (j=0 ; j<indexc ; j++) {
if (TclGetIntForIndexM(interp, indexv[j], SORTIDX_END,
&dummy) != TCL_OK) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
|
| ︙ | |||
3759 3760 3761 3762 3763 3764 3765 | 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 | - + - + |
case LSORT_INDICES:
indices = 1;
break;
case LSORT_STRIDE:
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-stride\" option must be "
|
| ︙ | |||
3804 3805 3806 3807 3808 3809 3810 | 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 | - + | sortInfo.indexv = NULL; break; case 1: sortInfo.indexv = &sortInfo.singleIndex; break; default: sortInfo.indexv = |
| ︙ | |||
3868 3869 3870 3871 3872 3873 3874 | 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 | - + - + |
* because of the -stride option. [TIP #326]
*/
if (group) {
if (length % groupSize) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"list size must be a multiple of the stride length",
|
| ︙ | |||
4036 4037 4038 4039 4040 4041 4042 | 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 | - + - + |
listRepPtr = ListRepPtr(resultPtr);
newArray = &listRepPtr->elements;
if (group) {
for (i=0; elementPtr!=NULL ; elementPtr=elementPtr->nextPtr) {
idx = elementPtr->payload.index;
for (j = 0; j < groupSize; j++) {
if (indices) {
|
| ︙ | |||
4231 4232 4233 4234 4235 4236 4237 | 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 | - + |
double a, b;
a = elemPtr1->collationKey.doubleValue;
b = elemPtr2->collationKey.doubleValue;
order = ((a >= b) - (a <= b));
} else {
Tcl_Obj **objv, *paramObjv[2];
|
| ︙ | |||
4275 4276 4277 4278 4279 4280 4281 | 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 | - + + |
/*
* Parse the result of the command.
*/
if (TclGetIntFromObj(infoPtr->interp,
Tcl_GetObjResult(infoPtr->interp), &order) != TCL_OK) {
Tcl_SetObjResult(infoPtr->interp, Tcl_NewStringObj(
|
| ︙ | |||
4449 4450 4451 4452 4453 4454 4455 | 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 | - + - + + - + - + |
static Tcl_Obj *
SelectObjFromSublist(
Tcl_Obj *objPtr, /* Obj to select sublist from. */
SortInfo *infoPtr) /* Information passed from the top-level
* "lsearch" or "lsort" command. */
{
|
| ︙ |
Changes to generic/tclCmdMZ.c.
| ︙ | |||
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_PwdObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
121 122 123 124 125 126 127 | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | - + - - + + + + |
*----------------------------------------------------------------------
*/
int
Tcl_RegexpObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
188 189 190 191 192 193 194 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - + + |
case REGEXP_LINESTOP:
cflags |= TCL_REG_NLSTOP;
break;
case REGEXP_LINEANCHOR:
cflags |= TCL_REG_NLANCH;
break;
case REGEXP_START: {
|
| ︙ | |||
224 225 226 227 228 229 230 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | - + + |
/*
* Check if the user requested -inline, but specified match variables; a
* no-no.
*/
if (doinline && ((objc - 2) != 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
453 454 455 456 457 458 459 | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | - + |
* if -all wasn't specified, otherwise it's all-1 (the number of times
* through the while - 1).
*/
if (doinline) {
Tcl_SetObjResult(interp, resultPtr);
} else {
|
| ︙ | |||
479 480 481 482 483 484 485 | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | - + - + + + |
*----------------------------------------------------------------------
*/
int
Tcl_RegsubObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
537 538 539 540 541 542 543 | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | - + + |
case REGSUB_LINESTOP:
cflags |= TCL_REG_NLSTOP;
break;
case REGSUB_LINEANCHOR:
cflags |= TCL_REG_NLANCH;
break;
case REGSUB_START: {
|
| ︙ | |||
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 | - + - + |
return TCL_ERROR;
}
objc -= idx;
objv += idx;
if (startIndex) {
|
| ︙ | |||
624 625 626 627 628 629 630 | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | - + - |
wlen = 0;
}
} else {
wsrclc = Tcl_UniCharToLower(*wsrc);
for (p = wfirstChar = wstring; wstring < wend; wstring++) {
if ((*wstring == *wsrc ||
(nocase && Tcl_UniCharToLower(*wstring)==wsrclc)) &&
|
| ︙ | |||
887 888 889 890 891 892 893 | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_RenameObjCmd(
ClientData dummy, /* Arbitrary value passed to the command. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
923 924 925 926 927 928 929 | 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_ReturnObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
970 971 972 973 974 975 976 | 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 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_SourceObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1030 1031 1032 1033 1034 1035 1036 | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_SplitObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 | - + - + + |
*----------------------------------------------------------------------
*/
static int
StringFirstCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
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 | - - - - - - + + + + + + - + - + | /* * Reread to prevent shimmering problems. */ needleStr = Tcl_GetUnicodeFromObj(objv[1], &needleLen); haystackStr = Tcl_GetUnicodeFromObj(objv[2], &haystackLen); |
| ︙ | |||
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 | - + + - + |
*----------------------------------------------------------------------
*/
static int
StringLastCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1354 1355 1356 1357 1358 1359 1360 | 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | - + |
match = p - haystackStr;
break;
}
}
}
str_last_done:
|
| ︙ | |||
1380 1381 1382 1383 1384 1385 1386 | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | - + - + + |
*----------------------------------------------------------------------
*/
static int
StringIndexCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1443 1444 1445 1446 1447 1448 1449 | 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 | - + - + + |
*----------------------------------------------------------------------
*/
static int
StringIsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1575 1576 1577 1578 1579 1580 1581 | 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 | - + |
if (length1 == 0) {
if (strict) {
result = 0;
}
goto str_is_done;
}
end = string1 + length1;
|
| ︙ | |||
1612 1613 1614 1615 1616 1617 1618 | 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 | - + |
if (length1 == 0) {
if (strict) {
result = 0;
}
goto str_is_done;
}
end = string1 + length1;
|
| ︙ | |||
1664 1665 1666 1667 1668 1669 1670 | 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 | - + | * Don't bother computing the failure point if we're not going to * return it. */ break; } end = string1 + length1; |
| ︙ | |||
1712 1713 1714 1715 1716 1717 1718 | 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 | - + | /* * Need to figure out where the list parsing failed, which is * fairly expensive. This is adapted from the core of * SetListFromAny(). */ const char *elemStart, *nextElem; |
| ︙ | |||
1794 1795 1796 1797 1798 1799 1800 | 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 | - + |
/*
* Only set the failVarObj when we will return 0 and we have indicated a
* valid fail index (>= 0).
*/
str_is_done:
if ((result == 0) && (failVarObj != NULL) &&
|
| ︙ | |||
1838 1839 1840 1841 1842 1843 1844 | 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | - + - + |
*----------------------------------------------------------------------
*/
static int
StringMapCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1924 1925 1926 1927 1928 1929 1930 | 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 | - + |
return TCL_OK;
} else if (mapElemc & 1) {
/*
* The charMap must be an even number of key/value items.
*/
Tcl_SetObjResult(interp,
|
| ︙ | |||
1968 1969 1970 1971 1972 1973 1974 | 1978 1979 1980 1981 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 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 | - + - + - + - + - + | /* * Special case for one map pair which avoids the extra for loop and * extra calls to get Unicode data. The algorithm is otherwise * identical to the multi-pair case. This will be >30% faster on * larger strings. */ |
| ︙ | |||
2034 2035 2036 2037 2038 2039 2040 | 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 | - + | ustring2 = mapStrings[index]; length2 = mapLens[index]; if ((length2 > 0) && ((*ustring1 == *ustring2) || (nocase && (Tcl_UniCharToLower(*ustring1) == u2lc[index/2]))) && /* Restrict max compare length. */ (end-ustring1 >= length2) && ((length2 == 1) || |
| ︙ | |||
2108 2109 2110 2111 2112 2113 2114 | 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 | - + - + |
*----------------------------------------------------------------------
*/
static int
StringMatchCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2160 2161 2162 2163 2164 2165 2166 | 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 | - + + - + |
*----------------------------------------------------------------------
*/
static int
StringRangeCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2185 2186 2187 2188 2189 2190 2191 | 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 | - + |
TclGetIntForIndexM(interp, objv[3], length, &last) != TCL_OK) {
return TCL_ERROR;
}
if (first < 0) {
first = 0;
}
|
| ︙ | |||
2216 2217 2218 2219 2220 2221 2222 | 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 | - + + - + |
*----------------------------------------------------------------------
*/
static int
StringReptCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2271 2272 2273 2274 2275 2276 2277 | 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 | - + - + |
}
length2 = length1 * count;
/*
* Include space for the NUL.
*/
|
| ︙ | |||
2328 2329 2330 2331 2332 2333 2334 | 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 | - + - + + + + + + - - - - |
*----------------------------------------------------------------------
*/
static int
StringRplcCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2394 2395 2396 2397 2398 2399 2400 | 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 | - + |
*----------------------------------------------------------------------
*/
static int
StringRevCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2429 2430 2431 2432 2433 2434 2435 | 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 | - + - + + - + - + - + |
*----------------------------------------------------------------------
*/
static int
StringStartCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2490 2491 2492 2493 2494 2495 2496 | 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 | - + - + + |
*----------------------------------------------------------------------
*/
static int
StringEndCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2552 2553 2554 2555 2556 2557 2558 | 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 | - + - + + |
*----------------------------------------------------------------------
*/
static int
StringEqualCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2670 2671 2672 2673 2674 2675 2676 | 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 | - + | * The requested length is negative, so we ignore it by setting it * to length + 1 so we correct the match var. */ reqlength = length + 1; } |
| ︙ | |||
2702 2703 2704 2705 2706 2707 2708 | 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | - + + - + |
*----------------------------------------------------------------------
*/
static int
StringCmpCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2817 2818 2819 2820 2821 2822 2823 | 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 | - + |
* The requested length is negative, so we ignore it by setting it to
* length + 1 so we correct the match var.
*/
reqlength = length + 1;
}
|
| ︙ | |||
2850 2851 2852 2853 2854 2855 2856 | 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 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
StringBytesCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2887 2888 2889 2890 2891 2892 2893 | 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 | - + - + |
*----------------------------------------------------------------------
*/
static int
StringLenCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2921 2922 2923 2924 2925 2926 2927 | 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 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
StringLowerCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2977 2978 2979 2980 2981 2982 2983 | 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 | - + | end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); string2 = TclGetString(resultPtr) + (start - string1); length2 = Tcl_UtfToLower(string2); Tcl_SetObjLength(resultPtr, length2 + (start - string1)); |
| ︙ | |||
3006 3007 3008 3009 3010 3011 3012 | 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 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
StringUpperCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3062 3063 3064 3065 3066 3067 3068 | 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 | - + | end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); string2 = TclGetString(resultPtr) + (start - string1); length2 = Tcl_UtfToUpper(string2); Tcl_SetObjLength(resultPtr, length2 + (start - string1)); |
| ︙ | |||
3091 3092 3093 3094 3095 3096 3097 | 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 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
StringTitleCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3147 3148 3149 3150 3151 3152 3153 | 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 | - + | end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); string2 = TclGetString(resultPtr) + (start - string1); length2 = Tcl_UtfToTitle(string2); Tcl_SetObjLength(resultPtr, length2 + (start - string1)); |
| ︙ | |||
3176 3177 3178 3179 3180 3181 3182 | 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 | - + - + |
*----------------------------------------------------------------------
*/
static int
StringTrimCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3224 3225 3226 3227 3228 3229 3230 | 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 | - + - + |
*----------------------------------------------------------------------
*/
static int
StringTrimLCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3270 3271 3272 3273 3274 3275 3276 | 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 | - + - + |
*----------------------------------------------------------------------
*/
static int
StringTrimRCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3370 3371 3372 3373 3374 3375 3376 | 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 | - + |
*
*----------------------------------------------------------------------
*/
int
TclSubstOptions(
Tcl_Interp *interp,
|
| ︙ | |||
3411 3412 3413 3414 3415 3416 3417 | 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 | - + - + |
return TCL_OK;
}
int
Tcl_SubstObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3459 3460 3461 3462 3463 3464 3465 | 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 | - + + - + - - + + |
*----------------------------------------------------------------------
*/
int
Tcl_SwitchObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3506 3507 3508 3509 3510 3511 3512 | 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 | - + |
mode = OPT_EXACT;
foundmode = 0;
indexVarObj = NULL;
matchVarObj = NULL;
numMatchesSaved = 0;
noCase = 0;
|
| ︙ | |||
3647 3648 3649 3650 3651 3652 3653 | 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 | - + - + |
* Complain if there is an odd number of words in the list of patterns and
* bodies.
*/
if (objc % 2) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3992 3993 3994 3995 3996 3997 3998 | 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 | - + - + - + |
*/
/* ARGSUSED */
int
Tcl_ThrowObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4054 4055 4056 4057 4058 4059 4060 | 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_TimeObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4146 4147 4148 4149 4150 4151 4152 | 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 | - + - + - + + |
*----------------------------------------------------------------------
*/
int
Tcl_TryObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4194 4195 4196 4197 4198 4199 4200 | 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 | - + - + - + - + - + - + - + - + |
if (Tcl_GetIndexFromObjStruct(interp, objv[i], handlerNames,
sizeof(char *), "handler type", 0, &type) != TCL_OK) {
Tcl_DecrRefCount(handlersObj);
return TCL_ERROR;
}
switch ((enum Handlers) type) {
case TryFinally: /* finally script */
|
| ︙ | |||
4278 4279 4280 4281 4282 4283 4284 | 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 | - + + |
haveHandlers = 1;
i += 3;
break;
}
}
if (bodyShared) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
4357 4358 4359 4360 4361 4362 4363 | 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 | - - + + |
static int
TryPostBody(
ClientData data[],
Tcl_Interp *interp,
int result)
{
Tcl_Obj *resultObj, *options, *handlersObj, *finallyObj, *cmdObj, **objv;
|
| ︙ | |||
4425 4426 4427 4428 4429 4430 4431 | 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 | - + |
* matching of the errorcode list. However, if this was an
* 'on' handler, the list that we are matching against will be
* empty.
*/
if (code == TCL_ERROR) {
Tcl_Obj *errorCodeName, *errcode, **bits1, **bits2;
|
| ︙ | |||
4722 4723 4724 4725 4726 4727 4728 | 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_WhileObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4763 4764 4765 4766 4767 4768 4769 | 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 | - + + - + - + - + - + | } /* *---------------------------------------------------------------------- * * TclListLines -- * |
| ︙ |
Changes to generic/tclCompCmds.c.
| ︙ | |||
240 241 242 243 244 245 246 | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | - + + |
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr, *dataTokenPtr;
int isScalar, localIndex, code = TCL_OK;
|
| ︙ | |||
908 909 910 911 912 913 914 | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 | - + + |
/*
* Parse the increment amount, if present.
*/
if (parsePtr->numWords == 4) {
const char *word;
|
| ︙ | |||
1092 1093 1094 1095 1096 1097 1098 | 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | - + + |
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
int worker; /* Temp var for building the value in. */
Tcl_Token *tokenPtr;
Tcl_Obj *keyObj, *valueObj, *dictObj;
const char *bytes;
|
| ︙ | |||
1327 1328 1329 1330 1331 1332 1333 | 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | - + + |
* construct a new dictionary with the loop
* body result. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *varsTokenPtr, *dictTokenPtr, *bodyTokenPtr;
int keyVarIndex, valueVarIndex, nameChars, loopRange, catchRange;
int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset;
|
| ︙ | |||
2096 2097 2098 2099 2100 2101 2102 | 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 | - + |
unsigned int pcOffset)
{
DictUpdateInfo *duiPtr = clientData;
int i;
for (i=0 ; i<duiPtr->length ; i++) {
if (i) {
|
| ︙ | |||
2456 2457 2458 2459 2460 2461 2462 | 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 | - + |
/*
* We parse the variable list argument words and create two arrays:
* varcList[i] is number of variables in i-th var list.
* varvList[i] points to array of var names in i-th var list.
*/
|
| ︙ | |||
2491 2492 2493 2494 2495 2496 2497 | 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 | - - + + |
}
/*
* Allocate storage for the varcList and varvList arrays if necessary.
*/
numLists = (numWords - 2)/2;
|
| ︙ | |||
2859 2860 2861 2862 2863 2864 2865 | 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 2898 2899 2900 2901 2902 | - + - + - + - + - + |
ByteCode *codePtr,
unsigned int pcOffset)
{
register ForeachInfo *infoPtr = clientData;
register ForeachVarList *varsPtr;
int i, j;
|
| ︙ | |||
2920 2921 2922 2923 2924 2925 2926 | 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 | - + |
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
Tcl_Obj **objv, *formatObj, *tmpObj;
char *bytes, *start;
|
| ︙ | |||
2960 2961 2962 2963 2964 2965 2966 | 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 | - + |
/*
* Everything is a literal, so the result is constant too (or an error if
* the format is broken). Do the format now.
*/
tmpObj = Tcl_Format(interp, Tcl_GetString(formatObj),
parsePtr->numWords-2, objv);
|
| ︙ | |||
2990 2991 2992 2993 2994 2995 2996 | 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 | - + |
* requires that all the % sequences be %s or %%, as everything else is
* sufficiently complex that we don't bother.
*
* First, get the state of the system relatively sensible (cleaning up
* after our attempt to spot a literal).
*/
|
| ︙ |
Changes to generic/tclCompCmdsGR.c.
| ︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | */ static void CompileReturnInternal(CompileEnv *envPtr, unsigned char op, int code, int level, Tcl_Obj *returnOpts); static int IndexTailVarIfKnown(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr); |
| ︙ | |||
1075 1076 1077 1078 1079 1080 1081 | 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | - - + - - - + - - - - - - - - - - - - |
valTokenPtr = TokenAfter(parsePtr->tokenPtr);
if (numWords != 3) {
goto emitComplexLindex;
}
idxTokenPtr = TokenAfter(valTokenPtr);
if (idxTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
|
| ︙ | |||
1198 1199 1200 1201 1202 1203 1204 | 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | - + |
Tcl_DecrRefCount(objPtr);
Tcl_DecrRefCount(listObj);
listObj = NULL;
}
valueTokenPtr = TokenAfter(valueTokenPtr);
}
if (listObj != NULL) {
|
| ︙ | |||
1326 1327 1328 1329 1330 1331 1332 | 1346 1347 1348 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 | - - + - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + |
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
|
| ︙ | |||
1425 1426 1427 1428 1429 1430 1431 | 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 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 | - - + - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + |
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
|
| ︙ | |||
2185 2186 2187 2188 2189 2190 2191 | 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 | + - + |
*/
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr, *stringTokenPtr;
Tcl_Obj *patternObj = NULL, *replacementObj = NULL;
Tcl_DString pattern;
const char *bytes;
size_t len;
|
| ︙ | |||
2338 2339 2340 2341 2342 2343 2344 | 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 | - - + + |
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
* General syntax: [return ?-option value ...? ?result?]
* An even number of words means an explicit result argument is present.
*/
|
| ︙ | |||
2528 2529 2530 2531 2532 2533 2534 | 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 | - + |
void
TclCompileSyntaxError(
Tcl_Interp *interp,
CompileEnv *envPtr)
{
Tcl_Obj *msg = Tcl_GetObjResult(interp);
|
| ︙ | |||
2758 2759 2760 2761 2762 2763 2764 | 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 | - + - + |
IndexTailVarIfKnown(
Tcl_Interp *interp,
Tcl_Token *varTokenPtr, /* Token representing the variable name */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Obj *tailPtr;
const char *tailName, *p;
|
| ︙ |
Changes to generic/tclCompCmdsSZ.c.
| ︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + - + | static int CompileUnaryOpCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, int instruction, CompileEnv *envPtr); static void IssueSwitchChainedTests(Tcl_Interp *interp, CompileEnv *envPtr, int mode, int noCase, int valueIndex, int numWords, Tcl_Token **bodyToken, int *bodyLines, |
| ︙ | |||
375 376 377 378 379 380 381 | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | - + + |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
|
| ︙ | |||
498 499 500 501 502 503 504 | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | - + |
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *mapTokenPtr, *stringTokenPtr;
Tcl_Obj *mapObj, **objv;
char *bytes;
|
| ︙ | |||
560 561 562 563 564 565 566 | 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 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 | - + + - - + + + - + - - + + + - + |
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *stringTokenPtr, *fromTokenPtr, *toTokenPtr;
Tcl_Obj *tmpObj;
|
| ︙ | |||
708 709 710 711 712 713 714 | 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 | - + - + |
* stored in Tcl_Tokens to point back to the same original string.
*/
if (wordTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
code = TclSubstOptions(NULL, numOpts, objv, &flags);
}
cleanup:
|
| ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | - + - + |
enum {Switch_Exact, Switch_Glob, Switch_Regexp} mode;
/* What kind of switch are we doing? */
Tcl_Token *bodyTokenArray; /* Array of real pattern list items. */
Tcl_Token **bodyToken; /* Array of pointers to pattern list items. */
int *bodyLines; /* Array of line numbers for body list
* items. */
|
| ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | - + |
maxLen = TclMaxListLength(bytes, numBytes, NULL);
if (maxLen < 2) {
return TCL_ERROR;
}
bodyTokenArray = ckalloc(sizeof(Tcl_Token) * maxLen);
bodyToken = ckalloc(sizeof(Tcl_Token *) * maxLen);
bodyLines = ckalloc(sizeof(int) * maxLen);
|
| ︙ | |||
1332 1333 1334 1335 1336 1337 1338 | 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 | - + |
int valueIndex, /* The value to match against. */
int numBodyTokens, /* Number of tokens describing things the
* switch can match against and bodies to
* execute when the match succeeds. */
Tcl_Token **bodyToken, /* Array of pointers to pattern list items. */
int *bodyLines, /* Array of line numbers for body list
* items. */
|
| ︙ | |||
1581 1582 1583 1584 1585 1586 1587 | 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 | - + |
int valueIndex, /* The value to match against. */
int numBodyTokens, /* Number of tokens describing things the
* switch can match against and bodies to
* execute when the match succeeds. */
Tcl_Token **bodyToken, /* Array of pointers to pattern list items. */
int *bodyLines, /* Array of line numbers for body list
* items. */
|
| ︙ | |||
1813 1814 1815 1816 1817 1818 1819 | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | - + - + |
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
offset = PTR2INT(Tcl_GetHashValue(hPtr));
if (i++) {
|
| ︙ | |||
1898 1899 1900 1901 1902 1903 1904 | 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 | - + - + |
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
|
| ︙ | |||
2043 2044 2045 2046 2047 2048 2049 | 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 | - + |
memset(matchClauses, 0, sizeof(Tcl_Obj *) * numHandlers);
matchCodes = TclStackAlloc(interp, sizeof(int) * numHandlers);
resultVarIndices = TclStackAlloc(interp, sizeof(int) * numHandlers);
optionVarIndices = TclStackAlloc(interp, sizeof(int) * numHandlers);
for (i=0 ; i<numHandlers ; i++) {
Tcl_Obj *tmpObj, **objv;
|
| ︙ | |||
2108 2109 2110 2111 2112 2113 2114 | 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 | - + - + |
}
if (Tcl_ListObjGetElements(NULL, tmpObj, &objc, &objv) != TCL_OK
|| (objc > 2)) {
TclDecrRefCount(tmpObj);
goto failedToCompile;
}
if (objc > 0) {
|
| ︙ | |||
2238 2239 2240 2241 2242 2243 2244 | 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 | - + + |
Tcl_Obj **matchClauses,
int *resultVars,
int *optionVars,
Tcl_Token **handlerTokens)
{
DefineLineInformation; /* TIP #280 */
int range, resultVar, optionsVar;
|
| ︙ | |||
2447 2448 2449 2450 2451 2452 2453 | 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 | - + + |
Tcl_Obj **matchClauses,
int *resultVars,
int *optionVars,
Tcl_Token **handlerTokens,
Tcl_Token *finallyToken) /* Not NULL */
{
DefineLineInformation; /* TIP #280 */
|
| ︙ | |||
2860 2861 2862 2863 2864 2865 2866 | 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 | - + |
continue;
}
}
return TCL_ERROR;
}
if (i == 1) {
const char *bytes;
|
| ︙ | |||
3219 3220 3221 3222 3223 3224 3225 | 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 | - + |
/* TODO: Consider support for compiling expanded args. */
for (words=1 ; words<parsePtr->numWords ; words++) {
tokenPtr = TokenAfter(tokenPtr);
CompileWord(envPtr, tokenPtr, interp, words);
}
if (parsePtr->numWords <= 2) {
|
| ︙ |
Changes to generic/tclCompExpr.c.
| ︙ | |||
751 752 753 754 755 756 757 | 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 | - + + - + + - + + |
TclParseNumber(NULL, NULL, NULL, start, scanned,
&stop, TCL_PARSE_NO_WHITESPACE);
if (isdigit(UCHAR(*stop)) || (stop == start + 1)) {
switch (start[1]) {
case 'b':
Tcl_AppendToObj(post,
|
| ︙ | |||
1415 1416 1417 1418 1419 1420 1421 | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | - + |
(start + scanned + limit > parsePtr->end) ? "" : "...");
/*
* Next, append any postscript message.
*/
if (post != NULL) {
|
| ︙ | |||
1813 1814 1815 1816 1817 1818 1819 | 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 | - - + + - + |
*----------------------------------------------------------------------
*/
int
Tcl_ParseExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *start, /* Start of source string to parse. */
|
| ︙ | |||
2109 2110 2111 2112 2113 2114 2115 | 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 | - + - + |
*----------------------------------------------------------------------
*/
void
TclCompileExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *script, /* The source script to compile. */
|
| ︙ | |||
2260 2261 2262 2263 2264 2265 2266 | 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 | - + |
} else if (nodePtr->mark == MARK_RIGHT) {
next = nodePtr->right;
switch (nodePtr->lexeme) {
case FUNCTION: {
Tcl_DString cmdName;
const char *p;
|
| ︙ | |||
2419 2420 2421 2422 2423 2424 2425 | 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 | - + |
numWords = 1; /* No arguments, so just the command */
break;
case OT_LITERAL: {
Tcl_Obj *const *litObjv = *litObjvPtr;
Tcl_Obj *literal = *litObjv;
if (optimize) {
|
| ︙ | |||
2531 2532 2533 2534 2535 2536 2537 | 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 | - + |
*----------------------------------------------------------------------
*/
int
TclSingleOpCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2584 2585 2586 2587 2588 2589 2590 | 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 | - + |
*----------------------------------------------------------------------
*/
int
TclSortingOpCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2664 2665 2666 2667 2668 2669 2670 | 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 | - + |
*----------------------------------------------------------------------
*/
int
TclVariadicOpCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2783 2784 2785 2786 2787 2788 2789 | 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 | - + |
*----------------------------------------------------------------------
*/
int
TclNoIdentOpCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ |
Changes to generic/tclCompile.c.
| ︙ | |||
582 583 584 585 586 587 588 | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | - - + + | /* * TIP #280: Helper for building the per-word line information of all compiled * commands. */ static void EnterCmdWordData(ExtCmdLoc *eclPtr, int srcOffset, Tcl_Token *tokenPtr, const char *cmd, int len, |
| ︙ | |||
669 670 671 672 673 674 675 | 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | + - + |
Tcl_Obj *objPtr, /* The object to make a ByteCode object. */
CompileHookProc *hookProc, /* Procedure to invoke after compilation. */
ClientData clientData) /* Hook procedure private data. */
{
Interp *iPtr = (Interp *) interp;
CompileEnv compEnv; /* Compilation environment structure allocated
* in frame. */
size_t length;
|
| ︙ | |||
1202 1203 1204 1205 1206 1207 1208 | 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | - + |
|| (codePtr->localCachePtr !=
iPtr->varFramePtr->localCachePtr)) {
FreeSubstCodeInternalRep(objPtr);
}
}
if (objPtr->typePtr != &substCodeType) {
CompileEnv compEnv;
|
| ︙ | |||
1309 1310 1311 1312 1313 1314 1315 | 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 | - + |
void
TclInitCompileEnv(
Tcl_Interp *interp, /* The interpreter for which a CompileEnv
* structure is initialized. */
register CompileEnv *envPtr,/* Points to the CompileEnv structure to
* initialize. */
const char *stringPtr, /* The source string to be compiled. */
|
| ︙ | |||
1686 1687 1688 1689 1690 1691 1692 | 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 | - + |
static void
CompileCmdLiteral(
Tcl_Interp *interp,
Tcl_Obj *cmdObj,
CompileEnv *envPtr)
{
|
| ︙ | |||
1897 1898 1899 1900 1901 1902 1903 | 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 | - + |
ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr;
Tcl_Obj *cmdObj = Tcl_NewObj();
Command *cmdPtr = NULL;
int code = TCL_ERROR;
int cmdKnown, expand = -1;
int *wlines, wlineat;
int cmdLine = envPtr->line;
|
| ︙ | |||
2001 2002 2003 2004 2005 2006 2007 | 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 | - - - + + + |
void
TclCompileScript(
Tcl_Interp *interp, /* Used for error and status reporting. Also
* serves as context for finding and compiling
* commands. May not be NULL. */
const char *script, /* The source script to compile. */
|
| ︙ | |||
2229 2230 2231 2232 2233 2234 2235 | 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 | - + |
Tcl_DString textBuffer; /* Holds concatenated chars from adjacent
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
char buffer[TCL_UTF_MAX];
int i, numObjsToConcat, length, adjust;
unsigned char *entryCodeNext = envPtr->codeNext;
#define NUM_STATIC_POS 20
int isLiteral, maxNumCL, numCL;
|
| ︙ | |||
2259 2260 2261 2262 2263 2264 2265 | 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 | - + |
isLiteral = 0;
break;
}
}
if (isLiteral) {
maxNumCL = NUM_STATIC_POS;
|
| ︙ | |||
2294 2295 2296 2297 2298 2299 2300 | 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 | - + - + - + - + - | * where the adjustment we are tracking here is taken into * account. The good thing is that we do not need a table of * everything, just the number of lines we have to add as * correction. */ if ((length == 1) && (buffer[0] == ' ') && |
| ︙ | |||
2358 2359 2360 2361 2362 2363 2364 | 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 | - + |
numObjsToConcat++;
count -= tokenPtr->numComponents;
tokenPtr += tokenPtr->numComponents;
break;
default:
Tcl_Panic("Unexpected token type in TclCompileTokens: %d; %.*s",
|
| ︙ | |||
2680 2681 2682 2683 2684 2685 2686 | 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 | - - - - + + + + + - + |
p += TCL_ALIGN(codeBytes); /* align object array */
codePtr->objArrayPtr = (Tcl_Obj **) p;
for (i = 0; i < numLitObjects; i++) {
Tcl_Obj *fetched = TclFetchLiteral(envPtr, i);
if (objPtr == fetched) {
/*
|
| ︙ | |||
2794 2795 2796 2797 2798 2799 2800 | 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 | - + |
*/
int
TclFindCompiledLocal(
register const char *name, /* Points to first character of the name of a
* scalar or array variable. If NULL, a
* temporary var should be created. */
|
| ︙ | |||
2820 2821 2822 2823 2824 2825 2826 | 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 | - + | * Compiling a non-body script: give it read access to the LVT in the * current localCache */ LocalCache *cachePtr = envPtr->iPtr->varFramePtr->localCachePtr; const char *localName; Tcl_Obj **varNamePtr; |
| ︙ | |||
3099 3100 3101 3102 3103 3104 3105 | 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 | - + - + + |
* information. */
int srcOffset, /* Offset of first char of the command. */
Tcl_Token *tokenPtr,
const char *cmd,
int len,
int numWords,
int line,
|
| ︙ | |||
4448 4449 4450 4451 4452 4453 4454 | 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 | - + |
sprintf(ptrBuf1, "%p", codePtr);
sprintf(ptrBuf2, "%p", iPtr);
Tcl_AppendPrintfToObj(bufferObj,
"ByteCode 0x%s, refCt %u, epoch %u, interp 0x%s (epoch %u)\n",
ptrBuf1, codePtr->refCount, codePtr->compileEpoch, ptrBuf2,
iPtr->compileEpoch);
|
| ︙ | |||
4486 4487 4488 4489 4490 4491 4492 | 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 | - + - + |
if (codePtr->procPtr != NULL) {
Proc *procPtr = codePtr->procPtr;
int numCompiledLocals = procPtr->numCompiledLocals;
sprintf(ptrBuf1, "%p", procPtr);
Tcl_AppendPrintfToObj(bufferObj,
|
| ︙ | |||
4552 4553 4554 4555 4556 4557 4558 | 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 | - + |
* If there were no commands (e.g., an expression or an empty string was
* compiled), just print all instructions and return.
*/
if (numCmds == 0) {
pc = codeStart;
while (pc < codeLimit) {
|
| ︙ | |||
4614 4615 4616 4617 4618 4619 4620 | 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 | - + |
Tcl_AppendPrintfToObj(bufferObj, "%s%4d: pc %d-%d, src %d-%d",
((i % 2)? " " : "\n "),
(i+1), codeOffset, (codeOffset + codeLen - 1),
srcOffset, (srcOffset + srcLen - 1));
}
if (numCmds > 0) {
|
| ︙ | |||
4663 4664 4665 4666 4667 4668 4669 | 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 | - + - + - + |
}
/*
* Print instructions before command i.
*/
while ((pc-codeStart) < codeOffset) {
|
| ︙ | |||
4800 4801 4802 4803 4804 4805 4806 | 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 | - + - + - + - + - + |
case OPERAND_NONE:
default:
break;
}
}
if (suffixObj) {
const char *bytes;
|
| ︙ | |||
4907 4908 4909 4910 4911 4912 4913 | 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 | - + |
result = iPtr->innerContext;
if (Tcl_IsShared(result)) {
Tcl_DecrRefCount(result);
iPtr->innerContext = result = Tcl_NewListObj(objc + 1, NULL);
Tcl_IncrRefCount(result);
} else {
|
| ︙ | |||
5012 5013 5014 5015 5016 5017 5018 | 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 | - + - + - + - + - + - + - + - + - + |
const char *stringPtr, /* The string to print. */
int maxChars) /* Maximum number of chars to print. */
{
register const char *p;
register int i = 0;
if (stringPtr == NULL) {
|
| ︙ |
Changes to generic/tclCompile.h.
| ︙ | |||
171 172 173 174 175 176 177 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | - + - + |
* through the 'lineBCPtr' HashTable in Interp, keyed by the address of BC.
* Also recorded is information coming from the context, i.e. type of the
* frame and associated information, like the path of a sourced file.
*/
typedef struct {
int srcOffset; /* Command location to find the entry. */
|
| ︙ | |||
361 362 363 364 365 366 367 | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | - + |
* inefficient. If set to 2, that instruction
* should not be issued at all (by the generic
* part of the command compiler). */
int expandCount; /* Number of INST_EXPAND_START instructions
* encountered that have not yet been paired
* with a corresponding
* INST_INVOKE_EXPANDED. */
|
| ︙ | |||
986 987 988 989 990 991 992 | 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 | - + - + - + - + - + + | MODULE_SCOPE void TclCleanupByteCode(ByteCode *codePtr); MODULE_SCOPE void TclCleanupStackForBreakContinue(CompileEnv *envPtr, ExceptionAux *auxPtr); MODULE_SCOPE void TclCompileCmdWord(Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, CompileEnv *envPtr); MODULE_SCOPE void TclCompileExpr(Tcl_Interp *interp, const char *script, |
| ︙ | |||
1071 1072 1073 1074 1075 1076 1077 | 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 | - + - - - + - - - + - - - + - - - - - + + + | int flags, int *localIndexPtr, int *isScalarPtr); MODULE_SCOPE int TclRegisterLiteral(CompileEnv *envPtr, char *bytes, int length, int flags); MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr); MODULE_SCOPE void TclInvalidateCmdLiteral(Tcl_Interp *interp, const char *name, Namespace *nsPtr); |
| ︙ | |||
1122 1123 1124 1125 1126 1127 1128 | 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 | - + - + | #define LITERAL_CMD_NAME 0x02 /* * Form of TclRegisterLiteral with flags == 0. In that case, it is safe to * cast away constness, and it is cleanest to do that here, all in one place. * * int TclRegisterNewLiteral(CompileEnv *envPtr, const char *bytes, |
| ︙ |
Changes to generic/tclConfig.c.
| ︙ | |||
37 38 39 40 41 42 43 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - + - - |
char *encoding;
} QCCD;
/*
* Static functions in this file:
*/
|
| ︙ | |||
84 85 86 87 88 89 90 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - + |
cdPtr->interp = interp;
if (valEncoding) {
cdPtr->encoding = ckalloc(strlen(valEncoding)+1);
strcpy(cdPtr->encoding, valEncoding);
} else {
cdPtr->encoding = NULL;
}
|
| ︙ | |||
121 122 123 124 125 126 127 | 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 | - - + + - - + + + - + |
pkgDict = Tcl_NewDictObj();
} else if (Tcl_IsShared(pkgDict)) {
pkgDict = Tcl_DuplicateObj(pkgDict);
}
/*
* Extend the package configuration...
|
| ︙ | |||
192 193 194 195 196 197 198 | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | - + - + + |
*----------------------------------------------------------------------
*/
static int
QueryConfigObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
226 227 228 229 230 231 232 | 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 | - + + - + + + + - + |
if (Tcl_DictObjGet(interp, pDB, pkgName, &pkgDict) != TCL_OK
|| pkgDict == NULL) {
/*
* Maybe a Tcl_Panic is better, because the package data has to be
* present.
*/
|
| ︙ |
Changes to generic/tclDate.c.
| ︙ | |||
2499 2500 2501 2502 2503 2504 2505 | 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 | - - - + + + - + - + |
static void
TclDateerror(
YYLTYPE* location,
DateInfo* infoPtr,
const char *s)
{
Tcl_Obj* t;
|
| ︙ | |||
2747 2748 2749 2750 2751 2752 2753 | 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 | - + |
}
}
int
TclClockOldscanObjCmd(
ClientData clientData, /* Unused */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
2799 2800 2801 2802 2803 2804 2805 | 2799 2800 2801 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 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 | - + + - - - + + + - - - + + - - + + - - + + - - + + - - + + |
status = yyparse(&dateInfo);
if (status == 1) {
Tcl_SetObjResult(interp, dateInfo.messages);
Tcl_DecrRefCount(dateInfo.messages);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL);
return TCL_ERROR;
} else if (status == 2) {
|
| ︙ |
Changes to generic/tclDecls.h.
| ︙ | |||
31 32 33 34 35 36 37 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + - + - + - + | /* 1 */ TCLAPI const char * Tcl_PkgRequireEx(Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 2 */ TCLAPI void Tcl_Panic(const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 3 */ |
| ︙ | |||
75 76 77 78 79 80 81 | 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | - + - + - + - + - + - + - + + - + - + - + - - + + - + - + - + - + + - + - + - + - + | /* 14 */ TCLAPI int Tcl_AppendAllObjTypes(Tcl_Interp *interp, Tcl_Obj *objPtr); /* 15 */ TCLAPI void Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...); /* 16 */ TCLAPI void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes, |
| ︙ | |||
245 246 247 248 249 250 251 | 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 | - + - + - - + + - + - + | TCLAPI void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, ClientData clientData); /* 81 */ TCLAPI int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan); /* 82 */ TCLAPI int Tcl_CommandComplete(const char *cmd); /* 83 */ |
| ︙ | |||
350 351 352 353 354 355 356 | 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 | - + - + + | /* 115 */ TCLAPI int Tcl_DoOneEvent(int flags); /* 116 */ TCLAPI void Tcl_DoWhenIdle(Tcl_IdleProc *proc, ClientData clientData); /* 117 */ TCLAPI char * Tcl_DStringAppend(Tcl_DString *dsPtr, |
| ︙ | |||
425 426 427 428 429 430 431 | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | - + - + | TCLAPI int Tcl_Flush(Tcl_Channel chan); /* 147 */ TCLAPI void Tcl_FreeResult(Tcl_Interp *interp); /* 148 */ TCLAPI int Tcl_GetAlias(Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, |
| ︙ | |||
491 492 493 494 495 496 497 | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | - + - + | TCLAPI int Tcl_GetOpenFile(Tcl_Interp *interp, const char *chanID, int forWriting, int checkUsage, ClientData *filePtr); #endif /* MACOSX */ /* 168 */ TCLAPI Tcl_PathType Tcl_GetPathType(const char *path); /* 169 */ |
| ︙ | |||
527 528 529 530 531 532 533 | 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 | - + - + - - + + | /* 183 */ TCLAPI int Tcl_InputBuffered(Tcl_Channel chan); /* 184 */ TCLAPI int Tcl_InterpDeleted(Tcl_Interp *interp); /* 185 */ TCLAPI int Tcl_IsSafe(Tcl_Interp *interp); /* 186 */ |
| ︙ | |||
581 582 583 584 585 586 587 | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | - + + | TCLAPI int Tcl_PutEnv(const char *assignment); /* 204 */ TCLAPI const char * Tcl_PosixError(Tcl_Interp *interp); /* 205 */ TCLAPI void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position); /* 206 */ |
| ︙ | |||
612 613 614 615 616 617 618 | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | - + - - + + | TCLAPI void Tcl_RegExpRange(Tcl_RegExp regexp, int index, const char **startPtr, const char **endPtr); /* 216 */ TCLAPI void Tcl_Release(ClientData clientData); /* 217 */ TCLAPI void Tcl_ResetResult(Tcl_Interp *interp); /* 218 */ |
| ︙ | |||
670 671 672 673 674 675 676 | 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 707 708 709 710 711 712 | - + - + - - + + | TCLAPI const char * Tcl_SignalId(int sig); /* 240 */ TCLAPI const char * Tcl_SignalMsg(int sig); /* 241 */ TCLAPI void Tcl_SourceRCFile(Tcl_Interp *interp); /* 242 */ TCLAPI int Tcl_SplitList(Tcl_Interp *interp, |
| ︙ | |||
727 728 729 730 731 732 733 | 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | - + + - + | /* Slot 261 is reserved */ /* 262 */ TCLAPI ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 263 */ |
| ︙ | |||
795 796 797 798 799 800 801 | 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 | - + - + - + - - + + - + | ClientData clientData); /* 289 */ TCLAPI void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, ClientData clientData); /* Slot 290 is reserved */ /* 291 */ TCLAPI int Tcl_EvalEx(Tcl_Interp *interp, const char *script, |
| ︙ | |||
852 853 854 855 856 857 858 | 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 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | - + - - + + - + - + - + - + - + - - + + - + - - + + - + | TCLAPI void Tcl_MutexUnlock(Tcl_Mutex *mutexPtr); /* 310 */ TCLAPI void Tcl_ConditionNotify(Tcl_Condition *condPtr); /* 311 */ TCLAPI void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr, const Tcl_Time *timePtr); /* 312 */ |
| ︙ | |||
948 949 950 951 952 953 954 | 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 | - + - - + + - + - + - - + + - + - + - + | /* 352 */ TCLAPI int Tcl_UniCharLen(const Tcl_UniChar *uniStr); /* 353 */ TCLAPI int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, size_t numChars); /* 354 */ TCLAPI char * Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr, |
| ︙ | |||
1016 1017 1018 1019 1020 1021 1022 | 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 | - + - + - + - + - + + - + - + - + - - + + - - + + | Tcl_RegExp regexp, Tcl_Obj *textObj, int offset, int nmatches, int flags); /* 377 */ TCLAPI void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr); /* 378 */ TCLAPI Tcl_Obj * Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, |
| ︙ | |||
1155 1156 1157 1158 1159 1160 1161 | 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 | - + - - + + - + - + - + + - + | ClientData clientData); /* 427 */ TCLAPI void Tcl_UntraceCommand(Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 428 */ |
| ︙ | |||
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 | - + - + | TCLAPI int Tcl_FSChdir(Tcl_Obj *pathPtr); /* 459 */ TCLAPI int Tcl_FSConvertToPathType(Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 460 */ TCLAPI Tcl_Obj * Tcl_FSJoinPath(Tcl_Obj *listObj, int elements); /* 461 */ |
| ︙ | |||
1292 1293 1294 1295 1296 1297 1298 | 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 | - + | TCLAPI Tcl_PathType Tcl_FSGetPathType(Tcl_Obj *pathPtr); /* 479 */ TCLAPI int Tcl_OutputBuffered(Tcl_Channel chan); /* 480 */ TCLAPI void Tcl_FSMountsChanged(const Tcl_Filesystem *fsPtr); /* 481 */ TCLAPI int Tcl_EvalTokensStandard(Tcl_Interp *interp, |
| ︙ | |||
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 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | - + - + - + | TCLAPI int Tcl_DictObjGet(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj **valuePtrPtr); /* 496 */ TCLAPI int Tcl_DictObjRemove(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr); /* 497 */ TCLAPI int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, |
| ︙ | |||
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 | - + - - + + - + - + | /* 571 */ TCLAPI int Tcl_SetEncodingSearchPath(Tcl_Obj *searchPath); /* 572 */ TCLAPI const char * Tcl_GetEncodingNameFromEnvironment( Tcl_DString *bufPtr); /* 573 */ TCLAPI int Tcl_PkgRequireProc(Tcl_Interp *interp, |
| ︙ | |||
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 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 | - + - + + - + | Tcl_ObjCmdProc *nreProc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 584 */ TCLAPI int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 585 */ |
| ︙ | |||
1647 1648 1649 1650 1651 1652 1653 | 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 | - - + + + | TCLAPI int Tcl_SetEnsembleParameterList(Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *paramList); /* 603 */ TCLAPI int Tcl_GetEnsembleParameterList(Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **paramListPtr); /* 604 */ TCLAPI int Tcl_ParseArgsObjv(Tcl_Interp *interp, |
| ︙ | |||
1670 1671 1672 1673 1674 1675 1676 | 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 | - + - + - + | Tcl_Obj *gzipHeaderDictObj); /* 611 */ TCLAPI int Tcl_ZlibInflate(Tcl_Interp *interp, int format, Tcl_Obj *data, int buffersize, Tcl_Obj *gzipHeaderDictObj); /* 612 */ TCLAPI unsigned int Tcl_ZlibCRC32(unsigned int crc, |
| ︙ | |||
1736 1737 1738 1739 1740 1741 1742 | 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 | - + - - + + - + |
typedef struct TclStubs {
int magic;
const TclStubHooks *hooks;
int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 0 */
const char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */
void (*tcl_Panic) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 2 */
|
| ︙ | |||
1765 1766 1767 1768 1769 1770 1771 | 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 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 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 | - - + + - + - + - + - + - + - - - - + + + + - + - + - + - - + + - + - - + + - - - - - + + + + + |
void (*tcl_DeleteFileHandler) (int fd); /* 10 */
#endif /* MACOSX */
void (*tcl_SetTimer) (const Tcl_Time *timePtr); /* 11 */
void (*tcl_Sleep) (int ms); /* 12 */
int (*tcl_WaitForEvent) (const Tcl_Time *timePtr); /* 13 */
int (*tcl_AppendAllObjTypes) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 14 */
void (*tcl_AppendStringsToObj) (Tcl_Obj *objPtr, ...); /* 15 */
|
| ︙ | |||
1866 1867 1868 1869 1870 1871 1872 | 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 | - + - + |
void (*tcl_DeleteInterp) (Tcl_Interp *interp); /* 110 */
void (*tcl_DetachPids) (int numPids, Tcl_Pid *pidPtr); /* 111 */
void (*tcl_DeleteTimerHandler) (Tcl_TimerToken token); /* 112 */
void (*tcl_DeleteTrace) (Tcl_Interp *interp, Tcl_Trace trace); /* 113 */
void (*tcl_DontCallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 114 */
int (*tcl_DoOneEvent) (int flags); /* 115 */
void (*tcl_DoWhenIdle) (Tcl_IdleProc *proc, ClientData clientData); /* 116 */
|
| ︙ | |||
1897 1898 1899 1900 1901 1902 1903 | 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 | - - + + |
int (*tcl_ExprObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj **resultPtrPtr); /* 141 */
int (*tcl_ExprString) (Tcl_Interp *interp, const char *expr); /* 142 */
void (*tcl_Finalize) (void); /* 143 */
void (*reserved144)(void);
Tcl_HashEntry * (*tcl_FirstHashEntry) (Tcl_HashTable *tablePtr, Tcl_HashSearch *searchPtr); /* 145 */
int (*tcl_Flush) (Tcl_Channel chan); /* 146 */
void (*tcl_FreeResult) (Tcl_Interp *interp); /* 147 */
|
| ︙ | |||
1926 1927 1928 1929 1930 1931 1932 | 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 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 1991 1992 1993 1994 1995 1996 1997 1998 1999 | - - + + - + - + - + - + - - + + |
#if defined(__WIN32__) /* WIN */
void (*reserved167)(void);
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
int (*tcl_GetOpenFile) (Tcl_Interp *interp, const char *chanID, int forWriting, int checkUsage, ClientData *filePtr); /* 167 */
#endif /* MACOSX */
Tcl_PathType (*tcl_GetPathType) (const char *path); /* 168 */
|
| ︙ | |||
1999 2000 2001 2002 2003 2004 2005 | 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 | - - + + - + - - + + |
void (*tcl_SetObjResult) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr); /* 235 */
void (*tcl_SetStdChannel) (Tcl_Channel channel, int type); /* 236 */
void (*reserved237)(void);
const char * (*tcl_SetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, const char *newValue, int flags); /* 238 */
const char * (*tcl_SignalId) (int sig); /* 239 */
const char * (*tcl_SignalMsg) (int sig); /* 240 */
void (*tcl_SourceRCFile) (Tcl_Interp *interp); /* 241 */
|
| ︙ | |||
2048 2049 2050 2051 2052 2053 2054 | 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 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 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 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 | - - + + - - + + - - + + - + - - - + + + - - + + - - + + - - + + - - - - - - + + + + + + - - - - + + + + - - + + - + - - - + + + |
void (*tcl_SetMainLoop) (Tcl_MainLoopProc *proc); /* 284 */
void (*reserved285)(void);
void (*tcl_AppendObjToObj) (Tcl_Obj *objPtr, Tcl_Obj *appendObjPtr); /* 286 */
Tcl_Encoding (*tcl_CreateEncoding) (const Tcl_EncodingType *typePtr); /* 287 */
void (*tcl_CreateThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 288 */
void (*tcl_DeleteThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 289 */
void (*reserved290)(void);
|
| ︙ | |||
2185 2186 2187 2188 2189 2190 2191 | 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 | - - - - - + + + + + - + |
Tcl_HashEntry * (*tcl_FindHashEntry) (Tcl_HashTable *tablePtr, const void *key); /* 421 */
Tcl_HashEntry * (*tcl_CreateHashEntry) (Tcl_HashTable *tablePtr, const void *key, int *newPtr); /* 422 */
void (*tcl_InitCustomHashTable) (Tcl_HashTable *tablePtr, int keyType, const Tcl_HashKeyType *typePtr); /* 423 */
void (*tcl_InitObjHashTable) (Tcl_HashTable *tablePtr); /* 424 */
ClientData (*tcl_CommandTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *procPtr, ClientData prevClientData); /* 425 */
int (*tcl_TraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 426 */
void (*tcl_UntraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 427 */
|
| ︙ | |||
2218 2219 2220 2221 2222 2223 2224 | 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 | - + - + - + - + - - + + |
int (*tcl_FSStat) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf); /* 454 */
int (*tcl_FSAccess) (Tcl_Obj *pathPtr, int mode); /* 455 */
Tcl_Channel (*tcl_FSOpenFileChannel) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *modeString, int permissions); /* 456 */
Tcl_Obj * (*tcl_FSGetCwd) (Tcl_Interp *interp); /* 457 */
int (*tcl_FSChdir) (Tcl_Obj *pathPtr); /* 458 */
int (*tcl_FSConvertToPathType) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 459 */
Tcl_Obj * (*tcl_FSJoinPath) (Tcl_Obj *listObj, int elements); /* 460 */
|
| ︙ | |||
2330 2331 2332 2333 2334 2335 2336 | 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 | - + - - - + + + - - + + - + - + - - + + - + |
int (*tcl_InitBignumFromDouble) (Tcl_Interp *interp, double initval, mp_int *toInit); /* 566 */
Tcl_Obj * (*tcl_GetNamespaceUnknownHandler) (Tcl_Interp *interp, Tcl_Namespace *nsPtr); /* 567 */
int (*tcl_SetNamespaceUnknownHandler) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *handlerPtr); /* 568 */
int (*tcl_GetEncodingFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Encoding *encodingPtr); /* 569 */
Tcl_Obj * (*tcl_GetEncodingSearchPath) (void); /* 570 */
int (*tcl_SetEncodingSearchPath) (Tcl_Obj *searchPath); /* 571 */
const char * (*tcl_GetEncodingNameFromEnvironment) (Tcl_DString *bufPtr); /* 572 */
|
| ︙ |
Changes to generic/tclDictObj.c.
| ︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - + - - + - - + - - - + + - - - + + - - + - - + - - - - + + + - - + - - - + + - - - + - - + - - + - - + - - + - - - - - | struct Dict; /* * Prototypes for functions defined later in this file: */ static void DeleteDict(struct Dict *dict); |
| ︙ | |||
486 487 488 489 490 491 492 | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | - + + |
Tcl_Obj *dictPtr)
{
#define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
Dict *dict = dictPtr->internalRep.twoPtrValue.ptr1;
ChainEntry *cPtr;
Tcl_Obj *keyPtr, *valuePtr;
|
| ︙ | |||
605 606 607 608 609 610 611 | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | - + |
/*
* Since lists and dictionaries have very closely-related string
* representations (i.e. the same parsing code) we can safely special-case
* the conversion from lists to dictionaries.
*/
if (objPtr->typePtr == &tclListType) {
|
| ︙ | |||
635 636 637 638 639 640 641 | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | - + + - + |
TclDecrRefCount(discardedValue);
}
Tcl_SetHashValue(hPtr, objv[i+1]);
Tcl_IncrRefCount(objv[i+1]); /* Since hash now holds ref to it */
}
} else {
|
| ︙ | |||
713 714 715 716 717 718 719 | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | - + |
objPtr->internalRep.twoPtrValue.ptr1 = dict;
objPtr->typePtr = &tclDictType;
return TCL_OK;
missingValue:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
763 764 765 766 767 768 769 | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | - + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclTraceDictPath(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
|
| ︙ | |||
1051 1052 1053 1054 1055 1056 1057 | 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_DictObjSize(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
|
| ︙ | |||
1272 1273 1274 1275 1276 1277 1278 | 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_DictObjPutKeyList(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
|
| ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_DictObjRemoveKeyList(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
|
| ︙ | |||
1475 1476 1477 1478 1479 1480 1481 | 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 | - + |
*----------------------------------------------------------------------
*/
static int
DictCreateCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
1525 1526 1527 1528 1529 1530 1531 | 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 | - + |
*----------------------------------------------------------------------
*/
static int
DictGetCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
1618 1619 1620 1621 1622 1623 1624 | 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 | - + |
*----------------------------------------------------------------------
*/
static int
DictReplaceCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
1670 1671 1672 1673 1674 1675 1676 | 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 | - + |
*----------------------------------------------------------------------
*/
static int
DictRemoveCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
1722 1723 1724 1725 1726 1727 1728 | 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 | - + |
*----------------------------------------------------------------------
*/
static int
DictMergeCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
1811 1812 1813 1814 1815 1816 1817 | 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 | - + |
*----------------------------------------------------------------------
*/
static int
DictKeysCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
1894 1895 1896 1897 1898 1899 1900 | 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 | - + |
*----------------------------------------------------------------------
*/
static int
DictValuesCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
1954 1955 1956 1957 1958 1959 1960 | 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 | - + - + + |
*----------------------------------------------------------------------
*/
static int
DictSizeCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
1992 1993 1994 1995 1996 1997 1998 | 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 | - + |
*----------------------------------------------------------------------
*/
static int
DictExistsCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2036 2037 2038 2039 2040 2041 2042 | 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 | - + |
*----------------------------------------------------------------------
*/
static int
DictInfoCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2058 2059 2060 2061 2062 2063 2064 | 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 | - + |
if (result != TCL_OK) {
return result;
}
}
dict = dictPtr->internalRep.twoPtrValue.ptr1;
statsStr = Tcl_HashStats(&dict->table);
|
| ︙ | |||
2085 2086 2087 2088 2089 2090 2091 | 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 | - + |
*----------------------------------------------------------------------
*/
static int
DictIncrCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2206 2207 2208 2209 2210 2211 2212 | 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 | - + |
*----------------------------------------------------------------------
*/
static int
DictLappendCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2293 2294 2295 2296 2297 2298 2299 | 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 | - + |
*----------------------------------------------------------------------
*/
static int
DictAppendCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2365 2366 2367 2368 2369 2370 2371 | 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 | - + + - + - + |
*----------------------------------------------------------------------
*/
static int
DictForNRCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2557 2558 2559 2560 2561 2562 2563 | 2541 2542 2543 2544 2545 2546 2547 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 | - + + - + - + |
*----------------------------------------------------------------------
*/
static int
DictMapNRCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2768 2769 2770 2771 2772 2773 2774 | 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 | - + |
*----------------------------------------------------------------------
*/
static int
DictSetCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2828 2829 2830 2831 2832 2833 2834 | 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 | - + |
*----------------------------------------------------------------------
*/
static int
DictUnsetCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
2887 2888 2889 2890 2891 2892 2893 | 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 2898 2899 2900 2901 | - + - + + |
*----------------------------------------------------------------------
*/
static int
DictFilterCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
3018 3019 3020 3021 3022 3023 3024 | 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 | - + |
*/
if (TclListObjGetElements(interp, objv[3], &varc, &varv) != TCL_OK) {
return TCL_ERROR;
}
if (varc != 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3174 3175 3176 3177 3178 3179 3180 | 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 | - + - + + |
*----------------------------------------------------------------------
*/
static int
DictUpdateCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3232 3233 3234 3235 3236 3237 3238 | 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 | - + + |
FinalizeDictUpdate(
ClientData data[],
Tcl_Interp *interp,
int result)
{
Tcl_Obj *dictPtr, *objPtr, **objv;
Tcl_InterpState state;
|
| ︙ | |||
3333 3334 3335 3336 3337 3338 3339 | 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 | - + |
*----------------------------------------------------------------------
*/
static int
DictWithCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
3383 3384 3385 3386 3387 3388 3389 | 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 | - + |
static int
FinalizeDictWith(
ClientData data[],
Tcl_Interp *interp,
int result)
{
Tcl_Obj **pathv;
|
| ︙ | |||
3460 3461 3462 3463 3464 3465 3466 | 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 | - + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclDictWithInit(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
|
| ︙ | |||
3540 3541 3542 3543 3544 3545 3546 | 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 | - + - + + |
* the name of a variable. NULL if the 'index'
* parameter is >= 0 */
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
int index, /* Index into the local variable table of the
* variable, or -1. Only used when part1Ptr is
* NULL. */
|
| ︙ |
Changes to generic/tclEncoding.c.
| ︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - + |
Tcl_EncodingFreeProc *freeProc;
/* If non-NULL, function to call when this
* encoding is deleted. */
int nullSize; /* Number of 0x00 bytes that signify
* end-of-string in this encoding. This number
* is used to determine the source string
* length when the srcLen argument is
|
| ︙ | |||
190 191 192 193 194 195 196 | 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 | - - - + - - - - + + - - + - - - - - - - - - + + - - - - - - + - - - + - - - - - + - - - - - - - - - - + + + + + + + - - - - - + - - - - - + - - - - - + - - - - | static unsigned short emptyPage[256]; /* * Functions used only in this module. */ |
| ︙ | |||
387 388 389 390 391 392 393 | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_SetEncodingSearchPath(
Tcl_Obj *searchPath)
{
|
| ︙ | |||
435 436 437 438 439 440 441 | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | - + |
*----------------------------------------------------------------------
*/
void
TclSetLibraryPath(
Tcl_Obj *path)
{
|
| ︙ | |||
472 473 474 475 476 477 478 | 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 | - + - + - + |
*
*---------------------------------------------------------------------------
*/
static void
FillEncodingFileMap(void)
{
|
| ︙ | |||
857 858 859 860 861 862 863 | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | - + |
Tcl_MutexLock(&encodingMutex);
for (hPtr = Tcl_FirstHashEntry(&encodingTable, &search); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&search)) {
Encoding *encodingPtr = Tcl_GetHashValue(hPtr);
Tcl_CreateHashEntry(&table,
|
| ︙ | |||
1037 1038 1039 1040 1041 1042 1043 | 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 | - - + + + + - + - + |
*/
char *
Tcl_ExternalToUtfDString(
Tcl_Encoding encoding, /* The encoding for the source string, or NULL
* for the default system encoding. */
const char *src, /* Source string in specified encoding. */
|
| ︙ | |||
1110 1111 1112 1113 1114 1115 1116 | 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 | - - + + + - + - + - + - + + - + - + |
int
Tcl_ExternalToUtf(
Tcl_Interp *interp, /* Interp for error return, if not NULL. */
Tcl_Encoding encoding, /* The encoding for the source string, or NULL
* for the default system encoding. */
const char *src, /* Source string in specified encoding. */
|
| ︙ | |||
1203 1204 1205 1206 1207 1208 1209 | 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | - - + + + - + - + |
*/
char *
Tcl_UtfToExternalDString(
Tcl_Encoding encoding, /* The encoding for the converted string, or
* NULL for the default system encoding. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
1278 1279 1280 1281 1282 1283 1284 | 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 | - - + + - + - + - + - + + - + - + |
int
Tcl_UtfToExternal(
Tcl_Interp *interp, /* Interp for error return, if not NULL. */
Tcl_Encoding encoding, /* The encoding for the converted string, or
* NULL for the default system encoding. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
1395 1396 1397 1398 1399 1400 1401 | 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 | - + - + - + |
static Tcl_Channel
OpenEncodingFileChannel(
Tcl_Interp *interp, /* Interp for error reporting, if not NULL. */
const char *name) /* The name of the encoding file on disk and
* also the name for new encoding. */
{
|
| ︙ | |||
1897 1898 1899 1900 1901 1902 1903 | 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 | - + |
Tcl_EncodingType type;
init[0] = '\0';
final[0] = '\0';
Tcl_DStringInit(&escapeData);
while (1) {
|
| ︙ | |||
2009 2010 2011 2012 2013 2014 2015 | 1973 1974 1975 1976 1977 1978 1979 1980 1981 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 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 | - + - + - + - + - + - + |
*-------------------------------------------------------------------------
*/
static int
BinaryProc(
ClientData clientData, /* Not used. */
const char *src, /* Source string (unknown encoding). */
|
| ︙ | |||
2070 2071 2072 2073 2074 2075 2076 | 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 | - + - + - + - + - + |
*-------------------------------------------------------------------------
*/
static int
UtfIntToUtfExtProc(
ClientData clientData, /* Not used. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
2119 2120 2121 2122 2123 2124 2125 | 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 | - + - + - + - + - + |
*-------------------------------------------------------------------------
*/
static int
UtfExtToUtfIntProc(
ClientData clientData, /* Not used. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
2168 2169 2170 2171 2172 2173 2174 | 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 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 2175 | - + - + - + - + - + - + + |
*-------------------------------------------------------------------------
*/
static int
UtfToUtfProc(
ClientData clientData, /* Not used. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
2282 2283 2284 2285 2286 2287 2288 | 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 | - + - + - + - + - + - + + |
*-------------------------------------------------------------------------
*/
static int
UnicodeToUtfProc(
ClientData clientData, /* Not used. */
const char *src, /* Source string in Unicode. */
|
| ︙ | |||
2370 2371 2372 2373 2374 2375 2376 | 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 | - + - + - + - + - + - + + |
*/
static int
UtfToUnicodeProc(
ClientData clientData, /* TableEncodingData that specifies
* encoding. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
2466 2467 2468 2469 2470 2471 2472 | 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 | - + - + - + - + - + - + + |
*/
static int
TableToUtfProc(
ClientData clientData, /* TableEncodingData that specifies
* encoding. */
const char *src, /* Source string in specified encoding. */
|
| ︙ | |||
2576 2577 2578 2579 2580 2581 2582 | 2544 2545 2546 2547 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 2582 2583 2584 2585 | - + - + - + - + - + - + + |
*/
static int
TableFromUtfProc(
ClientData clientData, /* TableEncodingData that specifies
* encoding. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
2697 2698 2699 2700 2701 2702 2703 | 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 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 | - + - + - + - + - + - + + |
*-------------------------------------------------------------------------
*/
static int
Iso88591ToUtfProc(
ClientData clientData, /* Ignored. */
const char *src, /* Source string in specified encoding. */
|
| ︙ | |||
2778 2779 2780 2781 2782 2783 2784 | 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 | - + - + - + - + - + - + + - + |
*-------------------------------------------------------------------------
*/
static int
Iso88591FromUtfProc(
ClientData clientData, /* Ignored. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
2918 2919 2920 2921 2922 2923 2924 | 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 | - + - + - + - + - + - + + |
*/
static int
EscapeToUtfProc(
ClientData clientData, /* EscapeEncodingData that specifies
* encoding. */
const char *src, /* Source string in specified encoding. */
|
| ︙ | |||
2974 2975 2976 2977 2978 2979 2980 | 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 | - + |
if (dst > dstEnd) {
result = TCL_CONVERT_NOSPACE;
break;
}
byte = *((unsigned char *) src);
if (prefixBytes[byte]) {
|
| ︙ | |||
3129 3130 3131 3132 3133 3134 3135 | 3101 3102 3103 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 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 | - + - + - + - + - + - + + |
*/
static int
EscapeFromUtfProc(
ClientData clientData, /* EscapeEncodingData that specifies
* encoding. */
const char *src, /* Source string in UTF-8. */
|
| ︙ | |||
3198 3199 3200 3201 3202 3203 3204 | 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 | - + |
encodingPtr = GetTableEncoding(dataPtr, state);
tableDataPtr = encodingPtr->clientData;
tablePrefixBytes = tableDataPtr->prefixBytes;
tableFromUnicode = (const unsigned short *const *)
tableDataPtr->fromUnicode;
for (numChars = 0; src < srcEnd; numChars++) {
|
| ︙ | |||
3469 3470 3471 3472 3473 3474 3475 | 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 | - + + - + |
*
*-------------------------------------------------------------------------
*/
static void
InitializeEncodingSearchPath(
char **valuePtr,
|
| ︙ |
Changes to generic/tclEnsemble.c.
| ︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + - + - - + - | /* * Declarations for functions local to this file: */ static inline Tcl_Obj * NewNsObj(Tcl_Namespace *namespacePtr); static inline int EnsembleUnknownCallback(Tcl_Interp *interp, |
| ︙ | |||
91 92 93 94 95 96 97 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - + |
Tcl_Namespace *namespacePtr)
{
register Namespace *nsPtr = (Namespace *) namespacePtr;
if (namespacePtr == TclGetGlobalNamespace(nsPtr->interp)) {
return Tcl_NewStringObj("::", 2);
} else {
|
| ︙ | |||
121 122 123 124 125 126 127 | 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 | - + - + - + + |
*----------------------------------------------------------------------
*/
int
TclNamespaceEnsembleCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
255 256 257 258 259 260 261 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | - + |
Tcl_DecrRefCount(mapObj);
}
return TCL_ERROR;
}
if (len < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"ensemble subcommand implementations "
|
| ︙ | |||
418 419 420 421 422 423 424 | 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 | - - + + - - + + - - - + + - - + + - - + + - - + + + - + | Tcl_Obj *resultObj, *tmpObj = NULL; /* silence gcc 4 warning */ int flags = 0; /* silence gcc 4 warning */ TclNewObj(resultObj); /* -map option */ |
| ︙ | |||
534 535 536 537 538 539 540 | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | - + |
Tcl_DecrRefCount(patchedDict);
}
goto freeMapAndError;
}
if (len < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"ensemble subcommand implementations "
|
| ︙ | |||
573 574 575 576 577 578 579 | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | - + |
if (patchedDict) {
allocatedMapFlag = 1;
}
continue;
}
case CONF_NAMESPACE:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
723 724 725 726 727 728 729 | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | - + - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
795 796 797 798 799 800 801 | 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | - + - + |
Tcl_Interp *interp,
Tcl_Command token,
Tcl_Obj *paramList)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
|
| ︙ | |||
875 876 877 878 879 880 881 | 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 | - + + - + - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldDict;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
974 975 976 977 978 979 980 | 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | - + - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1040 1041 1042 1043 1044 1045 1046 | 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
int wasCompiled;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1117 1118 1119 1120 1121 1122 1123 | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1159 1160 1161 1162 1163 1164 1165 | 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1201 1202 1203 1204 1205 1206 1207 | 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 | - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1242 1243 1244 1245 1246 1247 1248 | 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1283 1284 1285 1286 1287 1288 1289 | 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1324 1325 1326 1327 1328 1329 1330 | 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 | - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1462 1463 1464 1465 1466 1467 1468 | 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 | - + + - + - + - + |
const EnsembleImplMap map[]) /* The subcommands to create */
{
Tcl_Command ensemble;
Tcl_Namespace *ns;
Tcl_DString buf, hiddenBuf;
const char **nameParts = NULL;
const char *cmdName = NULL;
|
| ︙ | |||
1541 1542 1543 1544 1545 1546 1547 | 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 | - + - + - + + |
if (ensemble != NULL) {
Tcl_Obj *mapDict, *fromObj, *toObj;
Command *cmdPtr;
TclDStringAppendLiteral(&buf, "::");
TclNewObj(mapDict);
for (i=0 ; map[i].name != NULL ; i++) {
|
| ︙ | |||
1615 1616 1617 1618 1619 1620 1621 | 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | - + - + |
*----------------------------------------------------------------------
*/
static int
NsEnsembleImplementationCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1653 1654 1655 1656 1657 1658 1659 | 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 | - + |
if (objc < 2 + ensemblePtr->numParameters) {
/*
* We don't have a subcommand argument. Make error message.
*/
Tcl_DString buf; /* Message being built */
Tcl_Obj **elemPtrs; /* Parameter names */
|
| ︙ | |||
1680 1681 1682 1683 1684 1685 1686 | 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 | - + |
if (ensemblePtr->nsPtr->flags & NS_DYING) {
/*
* Don't know how we got here, but make things give up quickly.
*/
if (!Tcl_InterpDeleted(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1751 1752 1753 1754 1755 1756 1757 | 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 | - - + + | * matches. */ const char *subcmdName; /* Name of the subcommand, or unique prefix of * it (will be an error for a non-unique * prefix). */ char *fullName = NULL; /* Full name of the subcommand. */ |
| ︙ | |||
1827 1828 1829 1830 1831 1832 1833 | 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 | - + |
*/
{
Tcl_Obj **prefixObjv; /* The list of objects to substitute in as the
* target command prefix. */
Tcl_Obj *copyPtr; /* The actual list of words to dispatch to.
* Will be freed by the dispatch engine. */
|
| ︙ | |||
1849 1850 1851 1852 1853 1854 1855 | 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | - + |
copyPtr = Tcl_NewListObj(copyObjc, NULL);
if (copyObjc > 0) {
register Tcl_Obj **copyObjv;
/* Space used to construct the list of
* arguments to pass to the command that
* implements the ensemble subcommand. */
register List *listRepPtr = copyPtr->internalRep.twoPtrValue.ptr1;
|
| ︙ | |||
1881 1882 1883 1884 1885 1886 1887 | 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 | - + |
iPtr->ensembleRewrite.numRemovedObjs =
2 + ensemblePtr->numParameters;
iPtr->ensembleRewrite.numInsertedObjs =
prefixObjc + ensemblePtr->numParameters;
TclNRAddCallback(interp, TclClearRootEnsemble, NULL, NULL, NULL,
NULL);
} else {
|
| ︙ | |||
1945 1946 1947 1948 1949 1950 1951 | 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | - + + - + - + + |
TclGetString(objv[1+ensemblePtr->numParameters]), NULL);
return TCL_ERROR;
}
errorObj = Tcl_ObjPrintf("unknown%s subcommand \"%s\": must be ",
(ensemblePtr->flags & TCL_ENSEMBLE_PREFIX ? " or ambiguous" : ""),
TclGetString(objv[1+ensemblePtr->numParameters]));
if (ensemblePtr->subcommandTable.numEntries == 1) {
|
| ︙ | |||
2005 2006 2007 2008 2009 2010 2011 | 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 | - + |
int isRootEnsemble = (iPtr->ensembleRewrite.sourceObjs == NULL);
if (isRootEnsemble) {
iPtr->ensembleRewrite.sourceObjs = objv;
iPtr->ensembleRewrite.numRemovedObjs = numRemoved;
iPtr->ensembleRewrite.numInsertedObjs = numInserted;
} else {
|
| ︙ | |||
2076 2077 2078 2079 2080 2081 2082 | 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 | - + - + + |
* ----------------------------------------------------------------------
*/
static inline int
EnsembleUnknownCallback(
Tcl_Interp *interp,
EnsembleConfig *ensemblePtr,
|
| ︙ | |||
2110 2111 2112 2113 2114 2115 2116 | 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 | - + + |
Tcl_Preserve(ensemblePtr);
TclSkipTailcall(interp);
result = Tcl_EvalObjv(interp, paramc, paramv, 0);
if ((result == TCL_OK) && (ensemblePtr->flags & ENSEMBLE_DEAD)) {
if (!Tcl_InterpDeleted(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2163 2164 2165 2166 2167 2168 2169 | 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 | - + + - + + - + + - + + |
* Oh no! An exceptional result. Convert to an error.
*/
if (!Tcl_InterpDeleted(interp)) {
if (result != TCL_ERROR) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2218 2219 2220 2221 2222 2223 2224 | 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 | - + |
MakeCachedEnsembleCommand(
Tcl_Obj *objPtr,
EnsembleConfig *ensemblePtr,
const char *subcommandName,
Tcl_Obj *prefixObjPtr)
{
register EnsembleCmdRep *ensembleCmd;
|
| ︙ | |||
2405 2406 2407 2408 2409 2410 2411 | 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 | - + |
* See if we've got an export list. If so, we will only export exactly
* those commands, which may be either implemented by the prefix in the
* subcommandDict or mapped directly onto the namespace's commands.
*/
if (ensemblePtr->subcmdList != NULL) {
Tcl_Obj **subcmdv, *target, *cmdObj, *cmdPrefixObj;
|
| ︙ | |||
2662 2663 2664 2665 2666 2667 2668 | 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 | - + |
static void
DupEnsembleCmdRep(
Tcl_Obj *objPtr,
Tcl_Obj *copyPtr)
{
EnsembleCmdRep *ensembleCmd = objPtr->internalRep.twoPtrValue.ptr1;
EnsembleCmdRep *ensembleCopy = ckalloc(sizeof(EnsembleCmdRep));
|
| ︙ | |||
2699 2700 2701 2702 2703 2704 2705 | 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 | - + |
*/
static void
StringOfEnsembleCmdRep(
Tcl_Obj *objPtr)
{
EnsembleCmdRep *ensembleCmd = objPtr->internalRep.twoPtrValue.ptr1;
|
| ︙ | |||
2741 2742 2743 2744 2745 2746 2747 | 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 | - - + + - |
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
Tcl_Obj *mapObj, *subcmdObj, *targetCmdObj, *listObj, **elems;
Tcl_Obj *replaced = Tcl_NewObj(), *replacement;
Tcl_Command ensemble = (Tcl_Command) cmdPtr;
Command *oldCmdPtr = cmdPtr, *newCmdPtr;
|
| ︙ | |||
2813 2814 2815 2816 2817 2818 2819 | 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 | - + |
* Check to see if there's also a subcommand list; must check to see if
* the subcommand we are calling is in that list if it exists, since that
* list filters the entries in the map.
*/
(void) Tcl_GetEnsembleSubcommandList(NULL, ensemble, &listObj);
if (listObj != NULL) {
|
| ︙ | |||
3123 3124 3125 3126 3127 3128 3129 | 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 | - + |
Tcl_Obj *replacements,
Command *cmdPtr,
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokPtr;
Tcl_Obj *objPtr, **words;
char *bytes;
|
| ︙ |
Changes to generic/tclEnv.c.
| ︙ | |||
105 106 107 108 109 110 111 | 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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | + - + + + + - + + - - - - + + + |
*/
TclNewLiteralStringObj(varNamePtr, "env");
Tcl_IncrRefCount(varNamePtr);
Tcl_InitObjHashTable(&namesHash);
varPtr = TclObjLookupVarEx(interp, varNamePtr, NULL, TCL_GLOBAL_ONLY,
/*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
if (varPtr != NULL) {
|
| ︙ | |||
204 205 206 207 208 209 210 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | - + + |
TclSetEnv(
const char *name, /* Name of variable whose value is to be set
* (UTF-8). */
const char *value) /* New value for variable (UTF-8). */
{
Tcl_DString envString;
unsigned nameLength, valueLength;
|
| ︙ | |||
251 252 253 254 255 256 257 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | - + + | * Compare the new value to the existing value. If they're the same * then quit immediately (e.g. don't rewrite the value or propagate it * to other interpreters). Otherwise, when there are N interpreters * there will be N! propagations of the same value among the * interpreters. */ |
| ︙ | |||
274 275 276 277 278 279 280 | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | - + |
*/
valueLength = strlen(value);
p = ckalloc(nameLength + valueLength + 2);
memcpy(p, name, nameLength);
p[nameLength] = '=';
memcpy(p+nameLength+1, value, valueLength+1);
|
| ︙ | |||
365 366 367 368 369 370 371 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | - + + |
}
/*
* First convert the native string to UTF. Then separate the string into
* name and value parts, and call TclSetEnv to do all of the real work.
*/
|
| ︙ | |||
401 402 403 404 405 406 407 | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | - + |
*/
void
TclUnsetEnv(
const char *name) /* Name of variable to remove (UTF-8). */
{
char *oldValue;
|
| ︙ | |||
451 452 453 454 455 456 457 | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | - + |
string[length+1] = '\0';
#else
string = ckalloc(length + 1);
memcpy(string, name, (size_t) length);
string[length] = '\0';
#endif /* WIN32 */
|
| ︙ | |||
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 | - + + - + + - + |
TclGetEnv(
const char *name, /* Name of environment variable to find
* (UTF-8). */
Tcl_DString *valuePtr) /* Uninitialized or free DString in which the
* value of the environment variable is
* stored. */
{
|
| ︙ |
Changes to generic/tclEvent.c.
| ︙ | |||
209 210 211 212 213 214 215 | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | - + + |
* Tcl_SaveInterpState call before calling something like Tcl_DoOneEvent()
* that could lead us here.
*/
Tcl_Preserve(assocPtr);
Tcl_Preserve(interp);
while (assocPtr->firstBgPtr != NULL) {
|
| ︙ | |||
266 267 268 269 270 271 272 | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | - + | TclNewLiteralStringObj(keyPtr, "-errorinfo"); Tcl_IncrRefCount(keyPtr); Tcl_DictObjGet(NULL, options, keyPtr, &valuePtr); Tcl_DecrRefCount(keyPtr); Tcl_WriteChars(errChannel, |
| ︙ | |||
305 306 307 308 309 310 311 | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | - + |
*----------------------------------------------------------------------
*/
int
TclDefaultBgErrorHandlerObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
328 329 330 331 332 333 334 | 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 | - + - + |
TclNewLiteralStringObj(keyPtr, "-level");
Tcl_IncrRefCount(keyPtr);
Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
Tcl_DecrRefCount(keyPtr);
if (valuePtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
459 460 461 462 463 464 465 | 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 | - + - - + + + + - - + + + - + |
Tcl_IncrRefCount(resultPtr);
if (Tcl_FindCommand(interp, "bgerror", NULL,
TCL_GLOBAL_ONLY) == NULL) {
Tcl_RestoreInterpState(interp, saved);
Tcl_WriteObj(errChannel, Tcl_GetVar2Ex(interp,
"errorInfo", NULL, TCL_GLOBAL_ONLY));
|
| ︙ | |||
1380 1381 1382 1383 1384 1385 1386 | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | - + |
*/
/* ARGSUSED */
int
Tcl_VwaitObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1405 1406 1407 1408 1409 1410 1411 | 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | - + + |
while (!done && foundEvent) {
foundEvent = Tcl_DoOneEvent(TCL_ALL_EVENTS);
if (Tcl_Canceled(interp, TCL_LEAVE_ERR_MSG) == TCL_ERROR) {
break;
}
if (Tcl_LimitExceeded(interp)) {
Tcl_ResetResult(interp);
|
| ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 | - + |
*/
/* ARGSUSED */
int
Tcl_UpdateObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1509 1510 1511 1512 1513 1514 1515 | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | - + + |
while (Tcl_DoOneEvent(flags) != 0) {
if (Tcl_Canceled(interp, TCL_LEAVE_ERR_MSG) == TCL_ERROR) {
return TCL_ERROR;
}
if (Tcl_LimitExceeded(interp)) {
Tcl_ResetResult(interp);
|
| ︙ | |||
1582 1583 1584 1585 1586 1587 1588 | 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 | - + |
*/
int
Tcl_CreateThread(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
ClientData clientData, /* The one argument to Main() */
|
| ︙ |
Changes to generic/tclExecute.c.
| ︙ | |||
103 104 105 106 107 108 109 110 111 112 113 114 115 116 | 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 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
#ifdef TCL_COMPILE_STATS
long tclObjsAlloced = 0;
long tclObjsFreed = 0;
long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS] = { 0, 0, 0, 0, 0 };
#endif /* TCL_COMPILE_STATS */
/*
* Support pre-8.5 bytecodes unless specifically requested otherwise.
*/
#ifndef TCL_SUPPORT_84_BYTECODE
#define TCL_SUPPORT_84_BYTECODE 1
#endif
#if TCL_SUPPORT_84_BYTECODE
/*
* We need to know the tclBuiltinFuncTable to support translation of pre-8.5
* math functions to the namespace-based ::tcl::mathfunc::op in 8.5+.
*/
typedef struct {
const char *name; /* Name of function. */
int numArgs; /* Number of arguments for function. */
} BuiltinFunc;
/*
* Table describing the built-in math functions. Entries in this table are
* indexed by the values of the INST_CALL_BUILTIN_FUNC instruction's
* operand byte.
*/
static BuiltinFunc const tclBuiltinFuncTable[] = {
{"acos", 1},
{"asin", 1},
{"atan", 1},
{"atan2", 2},
{"ceil", 1},
{"cos", 1},
{"cosh", 1},
{"exp", 1},
{"floor", 1},
{"fmod", 2},
{"hypot", 2},
{"log", 1},
{"log10", 1},
{"pow", 2},
{"sin", 1},
{"sinh", 1},
{"sqrt", 1},
{"tan", 1},
{"tanh", 1},
{"abs", 1},
{"double", 1},
{"int", 1},
{"rand", 0},
{"round", 1},
{"srand", 1},
{"wide", 1},
{NULL, 0},
};
#define LAST_BUILTIN_FUNC 25
#endif
/*
* NR_TEBC
* Helpers for NR - non-recursive calls to TEBC
* Minimal data required to fully reconstruct the execution state.
*/
|
| ︙ | |||
659 660 661 662 663 664 665 | 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 | - + - + - - + + + | Tcl_Obj *valuePtr, Tcl_Obj *value2Ptr); static Tcl_Obj * ExecuteExtendedUnaryMathOp(int opcode, Tcl_Obj *valuePtr); static void FreeExprCodeInternalRep(Tcl_Obj *objPtr); static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc, int catchOnly, ByteCode *codePtr); static const char * GetSrcInfoForPc(const unsigned char *pc, |
| ︙ | |||
987 988 989 990 991 992 993 | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 | - + - - + + - + |
*----------------------------------------------------------------------
*/
static Tcl_Obj **
GrowEvaluationStack(
ExecEnv *eePtr, /* Points to the ExecEnv with an evaluation
* stack to enlarge. */
|
| ︙ | |||
1138 1139 1140 1141 1142 1143 1144 | 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 | - + - + |
*
*--------------------------------------------------------------
*/
static Tcl_Obj **
StackAllocWords(
Tcl_Interp *interp,
|
| ︙ | |||
1235 1236 1237 1238 1239 1240 1241 | 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 | - + - + - + |
eePtr->execStackPtr = esPtr;
}
}
void *
TclStackAlloc(
Tcl_Interp *interp,
|
| ︙ | |||
1446 1447 1448 1449 1450 1451 1452 | 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 | - + |
}
}
if (objPtr->typePtr != &exprCodeType) {
/*
* TIP #280: No invoker (yet) - Expression compilation.
*/
|
| ︙ | |||
2042 2043 2044 2045 2046 2047 2048 | 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 | - - + + + |
* Locals - variables that are used within opcodes or bounded sections of
* the file (jumps between opcodes within a family).
* NOTE: These are now mostly defined locally where needed.
*/
Tcl_Obj *objPtr, *valuePtr, *value2Ptr, *part1Ptr, *part2Ptr, *tmpPtr;
Tcl_Obj **objv;
|
| ︙ | |||
2355 2356 2357 2358 2359 2360 2361 | 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 | - + |
case INST_YIELD: {
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
TRACE(("%.30s => ", O2S(OBJ_AT_TOS)));
if (!corPtr) {
TRACE_APPEND(("ERROR: yield outside coroutine\n"));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2401 2402 2403 2404 2405 2406 2407 | 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 | - + + |
Tcl_Obj *listPtr, *nsObjPtr;
opnd = TclGetUInt1AtPtr(pc+1);
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
TRACE(("%d => ERROR: tailcall in non-proc context\n", opnd));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2427 2428 2429 2430 2431 2432 2433 | 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 | - + + | /* * Push the evaluation of the called command into the NR callback * stack. */ listPtr = Tcl_NewListObj(opnd, &OBJ_AT_DEPTH(opnd-1)); |
| ︙ | |||
2846 2847 2848 2849 2850 2851 2852 | 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 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 | + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + |
DECACHE_STACK_INFO();
pc += pcAdjustment;
TEBC_YIELD();
return TclNREvalObjv(interp, objc, objv,
TCL_EVAL_NOERR | TCL_EVAL_SOURCE_IN_FRAME, NULL);
#if TCL_SUPPORT_84_BYTECODE
case INST_CALL_BUILTIN_FUNC1:
|
| ︙ | |||
4270 4271 4272 4273 4274 4275 4276 | 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 | - + |
CallContext *contextPtr;
if (framePtr == NULL ||
!(framePtr->isProcCallFrame & FRAME_IS_METHOD)) {
TRACE(("=> ERROR: no TclOO call context\n"));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"self may only be called from inside a method",
|
| ︙ | |||
4324 4325 4326 4327 4328 4329 4330 | 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 | - - + + + |
/*
* -----------------------------------------------------------------
* Start of INST_LIST and related instructions.
*/
{
|
| ︙ | |||
4904 4905 4906 4907 4908 4909 4910 | 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 | - + |
&toIdx) != TCL_OK) {
goto gotError;
}
if (fromIdx < 0) {
fromIdx = 0;
}
|
| ︙ | |||
4954 4955 4956 4957 4958 4959 4960 | 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 | - + |
TclNewObj(objResultPtr);
}
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
NEXT_INST_F(9, 1, 1);
{
Tcl_UniChar *ustring1, *ustring2, *ustring3, *end, *p;
|
| ︙ | |||
5365 5366 5367 5368 5369 5370 5371 | 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 | - + |
lResult = l1 - l2*lResult;
goto longResultOfArithmetic;
}
case INST_RSHIFT:
if (l2 < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
5413 5414 5415 5416 5417 5418 5419 | 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 | - + |
lResult = l1 >> ((int) l2);
goto longResultOfArithmetic;
}
case INST_LSHIFT:
if (l2 < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
5436 5437 5438 5439 5440 5441 5442 | 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 | - + + | * Technically, we could hold the value (1 << (INT_MAX+1)) * in an mp_int, but since we're using mp_mul_2d() to do * the work, and it takes only an int argument, that's a * good place to draw the line. */ Tcl_SetObjResult(interp, Tcl_NewStringObj( |
| ︙ | |||
5875 5876 5877 5878 5879 5880 5881 | 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 | - + + |
goto processExceptionReturn;
{
ForeachInfo *infoPtr;
Var *iterVarPtr, *listVarPtr;
Tcl_Obj *oldValuePtr, *listPtr, **elements;
ForeachVarList *varListPtr;
|
| ︙ | |||
6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 | 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 | + - + |
{
int opnd2, allocateDict, done, i, allocdict;
Tcl_Obj *dictPtr, *statePtr, *keyPtr, *listPtr, *varNamePtr, *keysPtr;
Tcl_Obj *emptyPtr, **keyPtrPtr;
Tcl_DictSearch *searchPtr;
DictUpdateInfo *duiPtr;
size_t size;
case INST_DICT_VERIFY:
dictPtr = OBJ_AT_TOS;
TRACE(("=> "));
|
| ︙ | |||
6794 6795 6796 6797 6798 6799 6800 | 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 | - + + - + |
/*
* Division by zero in an expression. Control only reaches this point
* by "goto divideByZero".
*/
divideByZero:
DECACHE_STACK_INFO();
|
| ︙ | |||
7220 7221 7222 7223 7224 7225 7226 | 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 | - + |
break;
default:
/* Unused, here to silence compiler warning */
invalid = 0;
}
if (invalid) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
7251 7252 7253 7254 7255 7256 7257 | 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 | - + | * Technically, we could hold the value (1 << (INT_MAX+1)) in * an mp_int, but since we're using mp_mul_2d() to do the * work, and it takes only an int argument, that's a good * place to draw the line. */ Tcl_SetObjResult(interp, Tcl_NewStringObj( |
| ︙ | |||
7653 7654 7655 7656 7657 7658 7659 | 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 | - + |
* range of the long int type. This means any numeric Tcl_Obj value
* not using TCL_NUMBER_LONG type must hold a value larger than we
* accept.
*/
if (type2 != TCL_NUMBER_LONG) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
7892 7893 7894 7895 7896 7897 7898 | 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 | - + |
#endif
overflowExpon:
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
if (big2.used > 1) {
mp_clear(&big2);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
8610 8611 8612 8613 8614 8615 8616 | 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 | - + |
*
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclGetSourceFromFrame(
CmdFrame *cfPtr,
|
| ︙ | |||
8698 8699 8700 8701 8702 8703 8704 | 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 | - + |
GetSrcInfoForPc(
const unsigned char *pc, /* The program counter value for which to
* return the closest command's source info.
* This points within a bytecode instruction
* in codePtr's code. */
ByteCode *codePtr, /* The bytecode sequence in which to look up
* the command source for the pc. */
|
| ︙ | |||
8946 8947 8948 8949 8950 8951 8952 | 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 | - + - + - + |
double value) /* Value returned after error; used to
* distinguish underflows from overflows. */
{
const char *s;
if ((errno == EDOM) || TclIsNaN(value)) {
s = "domain error: argument not in valid range";
|
| ︙ |
Changes to generic/tclFCmd.c.
| ︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - + - + | */ static int CopyRenameOneFile(Tcl_Interp *interp, Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr, int copyFlag, int force); static Tcl_Obj * FileBasename(Tcl_Interp *interp, Tcl_Obj *pathPtr); static int FileCopyRename(Tcl_Interp *interp, |
| ︙ | |||
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + |
*/
int
TclFileRenameCmd(
ClientData clientData, /* Unused */
Tcl_Interp *interp, /* Interp for error reporting or recursive
* calls in the case of a tricky rename. */
|
| ︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + |
*/
int
TclFileCopyCmd(
ClientData clientData, /* Unused */
Tcl_Interp *interp, /* Used for error reporting or recursive calls
* in the case of a tricky copy. */
|
| ︙ | |||
101 102 103 104 105 106 107 | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | - + |
*
*---------------------------------------------------------------------------
*/
static int
FileCopyRename(
Tcl_Interp *interp, /* Used for error reporting. */
|
| ︙ | |||
212 213 214 215 216 217 218 | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | - + - + + |
*----------------------------------------------------------------------
*/
int
TclFileMakeDirsCmd(
ClientData clientData, /* Unused */
Tcl_Interp *interp, /* Used for error reporting. */
|
| ︙ | |||
330 331 332 333 334 335 336 | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - + |
*----------------------------------------------------------------------
*/
int
TclFileDeleteCmd(
ClientData clientData, /* Unused */
Tcl_Interp *interp, /* Used for error reporting */
|
| ︙ | |||
808 809 810 811 812 813 814 | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | - + |
*
*---------------------------------------------------------------------------
*/
static int
FileForceOption(
Tcl_Interp *interp, /* Interp, for error return. */
|
| ︙ | |||
863 864 865 866 867 868 869 | 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | - + |
*/
static Tcl_Obj *
FileBasename(
Tcl_Interp *interp, /* Interp, for error return. */
Tcl_Obj *pathPtr) /* Path whose basename to extract. */
{
|
| ︙ | |||
938 939 940 941 942 943 944 | 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | - + - + |
*----------------------------------------------------------------------
*/
int
TclFileAttrsCmd(
ClientData clientData, /* Unused */
Tcl_Interp *interp, /* The interpreter for error reporting. */
|
| ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | - - + + |
*/
Tcl_ResetResult(interp);
}
res = Tcl_FSFileAttrsGet(interp, index, filePtr, &objPtrAttr);
if (res == TCL_OK) {
|
| ︙ | |||
1160 1161 1162 1163 1164 1165 1166 | 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | - + |
*----------------------------------------------------------------------
*/
int
TclFileLinkCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | - + |
*----------------------------------------------------------------------
*/
int
TclFileReadLinkCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1362 1363 1364 1365 1366 1367 1368 | 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | - + |
*---------------------------------------------------------------------------
*/
int
TclFileTemporaryCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1385 1386 1387 1388 1389 1390 1391 | 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | - + |
}
if (objc > 1) {
nameVarObj = objv[1];
TclNewObj(nameObj);
}
if (objc > 2) {
|
| ︙ | |||
1496 1497 1498 1499 1500 1501 1502 | 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 | - + + |
if (nameVarObj != NULL) {
if (Tcl_ObjSetVar2(interp, nameVarObj, NULL, nameObj,
TCL_LEAVE_ERR_MSG) == NULL) {
Tcl_UnregisterChannel(interp, chan);
return TCL_ERROR;
}
}
|
Changes to generic/tclFileName.c.
| ︙ | |||
347 348 349 350 351 352 353 | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | - + |
*/
Tcl_PathType
Tcl_GetPathType(
const char *path)
{
Tcl_PathType type;
|
| ︙ | |||
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 | - + - + |
*
*----------------------------------------------------------------------
*/
Tcl_PathType
TclpGetNativePathType(
Tcl_Obj *pathPtr, /* Native path of interest */
|
| ︙ | |||
499 500 501 502 503 504 505 | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | - + |
*
*---------------------------------------------------------------------------
*/
Tcl_Obj *
TclpNativeSplitPath(
Tcl_Obj *pathPtr, /* Path to split. */
|
| ︙ | |||
555 556 557 558 559 560 561 | 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 | - + - + - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_SplitPath(
const char *path, /* Pointer to string containing a path. */
|
| ︙ | |||
768 769 770 771 772 773 774 775 776 777 778 779 780 781 | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | + |
elementStart = p;
while ((*p != '\0') && (*p != '/') && (*p != '\\')) {
p++;
}
length = p - elementStart;
if (length > 0) {
Tcl_Obj *nextElt;
if ((elementStart != path) && ((elementStart[0] == '~')
|| (isalpha(UCHAR(elementStart[0]))
&& elementStart[1] == ':'))) {
TclNewLiteralStringObj(nextElt, "./");
Tcl_AppendToObj(nextElt, elementStart, length);
} else {
nextElt = Tcl_NewStringObj(elementStart, length);
|
| ︙ | |||
809 810 811 812 813 814 815 | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | - + |
*
*---------------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_FSJoinToPath(
Tcl_Obj *pathPtr, /* Valid path or NULL. */
|
| ︙ | |||
857 858 859 860 861 862 863 | 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | - + + |
*/
void
TclpNativeJoinPath(
Tcl_Obj *prefix,
const char *joining)
{
|
| ︙ | |||
977 978 979 980 981 982 983 | 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 | - + - + - + | * Modifies the Tcl_DString. * *---------------------------------------------------------------------- */ char * Tcl_JoinPath( |
| ︙ | |||
1056 1057 1058 1059 1060 1061 1062 | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | - + |
const char *name, /* File name, which may begin with "~" (to
* indicate current user's home directory) or
* "~<user>" (to indicate any user's home
* directory). */
Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with
* name after tilde substitution. */
{
|
| ︙ | |||
1186 1187 1188 1189 1190 1191 1192 | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 | - + |
Tcl_DString dirString;
dir = TclGetEnv("HOME", &dirString);
if (dir == NULL) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't find HOME environment "
|
| ︙ | |||
1227 1228 1229 1230 1231 1232 1233 | 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | - + - + + |
*/
/* ARGSUSED */
int
Tcl_GlobObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1283 1284 1285 1286 1287 1288 1289 | 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 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 | - + - + + - + - + + - + - + - + |
* Do nothing; This is normal operations in Tcl 9.
* Keep accepting as a no-op option to accommodate old scripts.
*/
break;
case GLOB_DIR: /* -dir */
if (i == (objc-1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1397 1398 1399 1400 1401 1402 1403 | 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 | - + | /* * The whole thing is a prefix. This means we must remove any * 'tails' flag too, since it is irrelevant now (the same * effect will happen without it), but in particular its use * in TclGlob requires a non-NULL pathOrDir. */ |
| ︙ | |||
1436 1437 1438 1439 1440 1441 1442 | 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 | - + |
Tcl_DStringAppend(&prefix, find, 1);
search = find+1;
if (*search == '\0') {
break;
}
}
if (*search != '\0') {
|
| ︙ | |||
1463 1464 1465 1466 1467 1468 1469 | 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | - - + + | } globTypes = TclStackAlloc(interp, sizeof(Tcl_GlobTypeData)); globTypes->type = 0; globTypes->perm = 0; globTypes->macType = NULL; globTypes->macCreator = NULL; |
| ︙ | |||
1565 1566 1567 1568 1569 1570 1571 | 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 | - + | result = TCL_ERROR; join = 0; goto endOfGlob; badMacTypesArg: Tcl_SetObjResult(interp, Tcl_NewStringObj( "only one MacOS type or creator argument" |
| ︙ | |||
1591 1592 1593 1594 1595 1596 1597 | 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 | - + |
if (join) {
if (dir != PATH_GENERAL) {
Tcl_DStringInit(&prefix);
}
for (i = 0; i < objc; i++) {
TclDStringAppendObj(&prefix, objv[i]);
|
| ︙ | |||
1744 1745 1746 1747 1748 1749 1750 | 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 | - + |
*tail = '\0';
head = DoTildeSubst(interp, start+1, &buffer);
*tail = c;
if (head == NULL) {
return TCL_ERROR;
}
if (head != Tcl_DStringValue(&buffer)) {
|
| ︙ | |||
1798 1799 1800 1801 1802 1803 1804 | 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 | - + - + |
}
p++;
}
tail = p;
Tcl_IncrRefCount(pathPrefix);
} else if (pathPrefix == NULL && (tail[0] == '/'
|| (tail[0] == '\\' && tail[1] == '\\'))) {
|
| ︙ | |||
1866 1867 1868 1869 1870 1871 1872 | 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 | - + + - + |
/*
* Finally if we still haven't managed to generate a path prefix, check if
* the path starts with a current volume.
*/
if (pathPrefix == NULL) {
|
| ︙ | |||
1951 1952 1953 1954 1955 1956 1957 | 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 | - - + |
* that would add a lot of complexity to the code. This way is a little
* slower (when the -tails flag is given), but much simpler to code.
*
* We do it by rewriting the result list in-place.
*/
if (globFlags & TCL_GLOBMODE_TAILS) {
|
| ︙ | |||
1981 1982 1983 1984 1985 1986 1987 | 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 | - + |
|| (pre[1] != ':')) {
prefixLen++;
}
}
Tcl_ListObjGetElements(NULL, filenamesObj, &objc, &objv);
for (i = 0; i< objc; i++) {
|
| ︙ | |||
2191 2192 2193 2194 2195 2196 2197 | 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 | - + - + | * Balanced braces. */ closeBrace = p; break; } Tcl_SetObjResult(interp, Tcl_NewStringObj( |
| ︙ | |||
2230 2231 2232 2233 2234 2235 2236 | 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 | - + |
*closeBrace = '\0';
for (p = openBrace; p != closeBrace; ) {
p++;
element = p;
SkipToChar(&p, ',');
Tcl_DStringSetLength(&newName, baseLength);
Tcl_DStringAppend(&newName, element, p-element);
|
| ︙ | |||
2305 2306 2307 2308 2309 2310 2311 | 2310 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 | - + + - + - + - + - + |
*p = '\0';
TclNewObj(subdirsPtr);
Tcl_IncrRefCount(subdirsPtr);
result = Tcl_FSMatchInDirectory(interp, subdirsPtr, pathPtr,
pattern, &dirOnly);
*p = save;
if (result == TCL_OK) {
|
| ︙ | |||
2417 2418 2419 2420 2421 2422 2423 | 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 | - + |
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, Tcl_DStringValue(&append)[0]) == NULL) {
/*
* The current prefix must end in a separator.
*/
|
| ︙ | |||
2454 2455 2456 2457 2458 2459 2460 | 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 | - + | * The current prefix must end in a separator, unless this is a * volume-relative path. In particular globbing in Windows shares, * when not using -dir or -path, e.g. 'glob [file join * //machine/share/subdir *]' requires adding a separator here. * This behaviour is not currently tested for in the test suite. */ |
| ︙ |
Changes to generic/tclFileSystem.h.
| ︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | - + - - + + - + | /* * Private shared functions for use by tclIOUtil.c, tclPathObj.c and * tclFileName.c, and any platform-specific filesystem code. */ MODULE_SCOPE Tcl_PathType TclFSGetPathType(Tcl_Obj *pathPtr, const Tcl_Filesystem **filesystemPtrPtr, |
| ︙ |
Changes to generic/tclGetDate.y.
| ︙ | |||
958 959 960 961 962 963 964 | 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | - + |
}
}
int
TclClockOldscanObjCmd(
ClientData clientData, /* Unused */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ |
Changes to generic/tclHash.c.
| ︙ | |||
671 672 673 674 675 676 677 | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | - + |
}
/*
* Print out the histogram and a few other pieces of information.
*/
result = ckalloc((NUM_COUNTERS * 60) + 300);
|
| ︙ |
Changes to generic/tclIO.c.
| ︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | - + - + - + - + |
Tcl_Encoding encoding; /* The encoding to use to convert raw bytes
* to UTF-8. */
ChannelBuffer *bufPtr; /* The current buffer of raw bytes being
* emptied. */
Tcl_EncodingState state; /* The encoding state just before the last
* external to UTF-8 conversion in
* FilterInputBytes(). */
|
| ︙ | |||
174 175 176 177 178 179 180 | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | - - - + + + + - - - - - + + + + + + + + - + - - - - + + + + + + - + + - + - - - - + + + + - + - + - + | Channel *chanPtr); static int CloseChannel(Tcl_Interp *interp, Channel *chanPtr, int errorCode); static int CloseChannelPart(Tcl_Interp *interp, Channel *chanPtr, int errorCode, int flags); static int CloseWrite(Tcl_Interp *interp, Channel *chanPtr); static void CommonGetsCleanup(Channel *chanPtr); |
| ︙ | |||
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 | - + - + - + |
Channel *chanPtr,
Tcl_Interp *interp,
int flags)
{
return chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, flags);
}
|
| ︙ | |||
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 | - + - + |
ChanWatch(
Channel *chanPtr,
int mask)
{
chanPtr->typePtr->watchProc(chanPtr->instanceData, mask);
}
|
| ︙ | |||
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 | - - + + - - - - + + + + + - - - + + + - + |
for (statePtr = tsdPtr->firstCSPtr;
statePtr != NULL;
statePtr = statePtr->nextCSPtr) {
chanPtr = statePtr->topChanPtr;
if (GotFlag(statePtr, CHANNEL_DEAD)) {
continue;
}
|
| ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | - + |
statePtr = ((Channel *) chan)->state->bottomChanPtr->state;
if (GotFlag(statePtr, CHANNEL_INCLOSE)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"illegal recursive call to close through close-handler"
|
| ︙ | |||
2440 2441 2442 2443 2444 2445 2446 | 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 | - + |
if (!GotFlag(statePtr, CHANNEL_DEAD)) {
return 0;
}
Tcl_SetErrno(EINVAL);
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2635 2636 2637 2638 2639 2640 2641 | 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 | - + + |
* regular message if nothing was found in the bypasses.
*/
Tcl_SetErrno(errorCode);
if (interp != NULL && !TclChanCaughtErrorBypass(interp,
(Tcl_Channel) chanPtr)) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
3174 3175 3176 3177 3178 3179 3180 | 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 | - + |
Tcl_Panic("called Tcl_Close on channel with refCount > 0");
}
if (GotFlag(statePtr, CHANNEL_INCLOSE)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"illegal recursive call to close through close-handler"
|
| ︙ | |||
3275 3276 3277 3278 3279 3280 3281 | 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 | - + |
result = EINVAL;
}
if (stickyError != 0) {
Tcl_SetErrno(stickyError);
if (interp != NULL) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
3344 3345 3346 3347 3348 3349 3350 | 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 | - + + |
/*
* Is the channel unstacked ? If not we fail.
*/
if (chanPtr != statePtr->topChanPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3377 3378 3379 3380 3381 3382 3383 | 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 | - + |
* handler. That won't do.
*/
if (statePtr->flags & CHANNEL_INCLOSE) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"illegal recursive call to close through close-handler"
|
| ︙ | |||
3750 3751 3752 3753 3754 3755 3756 | 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 | - + - + - + | * Side effects: * May buffer up output and may cause output to be produced on the * channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
3801 3802 3803 3804 3805 3806 3807 | 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 | - + - + - + | * Side effects: * May buffer up output and may cause output to be produced on the * channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
3857 3858 3859 3860 3861 3862 3863 | 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 | - + - - + + | * Side effects: * May buffer up output and may cause output to be produced on the * channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
3899 3900 3901 3902 3903 3904 3905 | 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 | - + - - + + - + | * Side effects: * May buffer up output and may cause output to be produced on the * channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
3968 3969 3970 3971 3972 3973 3974 | 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 | - + - + | * Side effects: * May buffer up output and may cause output to be produced on the * channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
4012 4013 4014 4015 4016 4017 4018 | 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 | - + - + |
int ignore;
DiscardInputQueued(chanPtr->state, 0);
ChanSeek(chanPtr, -inputBuffered, SEEK_CUR, &ignore);
}
}
|
| ︙ | |||
4050 4051 4052 4053 4054 4055 4056 | 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 | - + - + + - + | * Side effects: * May buffer up output and may cause output to be produced on the * channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
4151 4152 4153 4154 4155 4156 4157 | 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 | - + - + - - - + + + | * Side effects: * May buffer up output and may cause output to be produced on the * channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
4256 4257 4258 4259 4260 4261 4262 | 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 | - + - + |
if (saved != 0) {
/*
* Here's some translated bytes left over from the last buffer
* that we need to stick at the beginning of this buffer.
*/
|
| ︙ | |||
4314 4315 4316 4317 4318 4319 4320 | 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 | - + | * allowed the translation to produce a character that crossed * the end of the output buffer, so that we would get a * completely full buffer before flushing it. The extra bytes * will be moved to the beginning of the next buffer. */ saved = -SpaceLeft(bufPtr); |
| ︙ | |||
4399 4400 4401 4402 4403 4404 4405 | 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 | - + - + |
TranslateOutputEOL(
ChannelState *statePtr, /* Channel being read, for translation and
* buffering modes. */
char *dst, /* Output buffer filled with UTF-8 chars by
* applying appropriate EOL translation to
* source characters. */
const char *src, /* Source UTF-8 characters. */
|
| ︙ | |||
4548 4549 4550 4551 4552 4553 4554 | 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 | - + - + | * Side effects: * May flush output on the channel. May cause input to be consumed from * the channel. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
4591 4592 4593 4594 4595 4596 4597 | 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 | - + - + + | * * On reading EOF, leave channel pointing at EOF char. On reading EOL, * leave channel pointing after EOL, but don't return EOL in dst buffer. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
4778 4779 4780 4781 4782 4783 4784 | 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 | - + |
ResetFlag(statePtr, INPUT_SAW_CR);
if ((eol < dstEnd) && (*eol == '\n')) {
/*
* Skip the raw bytes that make up the '\n'.
*/
char tmp[1 + TCL_UTF_MAX];
|
| ︙ | |||
4977 4978 4979 4980 4981 4982 4983 | 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 | - + - - + + | * * On reading EOF, leave channel pointing at EOF char. On reading EOL, * leave channel pointing after EOL, but don't return EOL in dst buffer. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
5119 5120 5121 5122 5123 5124 5125 | 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 | - + - + | /* * Copy bytes from the channel buffer to the ByteArray. * This may realloc space, so keep track of result. */ rawLen = dstEnd - dst; byteArray = Tcl_SetByteArrayLength(objPtr, byteLen + rawLen); |
| ︙ | |||
5261 5262 5263 5264 5265 5266 5267 | 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 | + - + |
Channel *chanPtr, /* Channel to read. */
GetsState *gsPtr) /* Current state of gets operation. */
{
ChannelState *statePtr = chanPtr->state;
/* State info for channel */
ChannelBuffer *bufPtr;
char *raw, *rawStart, *dst;
int result;
|
| ︙ | |||
5330 5331 5332 5333 5334 5335 5336 | 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 | - + |
toRead = ENCODING_LINESIZE;
if (toRead > rawLen) {
toRead = rawLen;
}
dstNeeded = toRead * TCL_UTF_MAX;
spaceLeft = objPtr->length - offset;
if (dstNeeded > spaceLeft) {
|
| ︙ | |||
5365 5366 5367 5368 5369 5370 5371 | 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 | - + | /* * The last few bytes in this channel buffer were the start of a * multibyte sequence. If this buffer was full, then move them to the * next buffer so the bytes will be contiguous. */ ChannelBuffer *nextPtr; |
| ︙ | |||
5398 5399 5400 5401 5402 5403 5404 | 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 | - + |
if (nextPtr == NULL) {
nextPtr = AllocChannelBuffer(statePtr->bufSize);
bufPtr->nextPtr = nextPtr;
statePtr->inQueueTail = nextPtr;
}
extra = rawLen - gsPtr->rawRead;
memcpy(nextPtr->buf + (BUFFER_PADDING - extra),
|
| ︙ | |||
5541 5542 5543 5544 5545 5546 5547 | 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 | - + - + - |
* buffer because the caller could change the channel's encoding which
* could change the interpretation of whether those bytes really made
* up multi-byte characters after all.
*/
nextPtr = bufPtr->nextPtr;
for ( ; nextPtr != NULL; nextPtr = bufPtr->nextPtr) {
|
| ︙ | |||
5578 5579 5580 5581 5582 5583 5584 | 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 | - + - + | * * Side effects: * May cause input to be buffered. * *---------------------------------------------------------------------- */ |
| ︙ | |||
5623 5624 5625 5626 5627 5628 5629 | 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 | - + - + + - + + | * * Side effects: * May cause input to be buffered. * *---------------------------------------------------------------------- */ |
| ︙ | |||
5712 5713 5714 5715 5716 5717 5718 | 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 | - + | /* * If we get a short read, signal up that we may be BLOCKED. * We should avoid calling the driver because on some * platforms we will block in the low level reading code even * though the channel is set into nonblocking mode. */ |
| ︙ | |||
5779 5780 5781 5782 5783 5784 5785 | 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 | - + - - - + + + | * * Side effects: * May cause input to be buffered. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
5835 5836 5837 5838 5839 5840 5841 | 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 | - + - - - + + + + - + + | * * Side effects: * May cause input to be buffered. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
5885 5886 5887 5888 5889 5890 5891 | 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 | - + |
if (encoding == NULL) {
Tcl_GetByteArrayFromObj(objPtr, &offset);
} else {
TclGetStringFromObj(objPtr, &offset);
}
}
|
| ︙ | |||
5911 5912 5913 5914 5915 5916 5917 | 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 | - + + - + + |
statePtr->inQueueHead = nextPtr;
if (nextPtr == NULL) {
statePtr->inQueueTail = NULL;
}
}
}
|
| ︙ | |||
5984 5985 5986 5987 5988 5989 5990 | 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 | - + - - - - - - - - + + + + + + + + - + - + - + | * * Side effects: * None. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
6050 6051 6052 6053 6054 6055 6056 | 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 | - + |
src++;
srcLen--;
toRead--;
}
srcRead = srcLen;
dstWrote = toRead;
|
| ︙ | |||
6087 6088 6089 6090 6091 6092 6093 | 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 | - + - - + + - + - + - - + + - + | * * Side effects: * None. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
6296 6297 6298 6299 6300 6301 6302 | 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 | - + - + - + | * * Note that the BUFFER_PADDING (See AllocChannelBuffer) is used to * prevent exactly this situation. I.e. it should never happen. * Therefore it is ok to panic should it happen despite the * precautions. */ |
| ︙ | |||
6334 6335 6336 6337 6338 6339 6340 | 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 | - + |
* The number of characters that we got may be less than the number that
* we started with because "\r\n" sequences may have been turned into just
* '\n' in dst.
*/
numChars -= dstRead - dstWrote;
|
| ︙ | |||
6385 6386 6387 6388 6389 6390 6391 | 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 | - + - + - + |
TranslateInputEOL(
ChannelState *statePtr, /* Channel being read, for EOL translation and
* EOF character. */
char *dstStart, /* Output buffer filled with chars by applying
* appropriate EOL translation to source
* characters. */
const char *srcStart, /* Source characters. */
|
| ︙ | |||
6425 6426 6427 6428 6429 6430 6431 | 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 | - + - + |
break;
}
}
}
switch (statePtr->inputTranslation) {
case TCL_TRANSLATE_LF:
if (dstStart != srcStart) {
|
| ︙ | |||
6545 6546 6547 6548 6549 6550 6551 | 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 | - + - + + | * * Side effects: * Adds input to the input queue of a channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
6737 6738 6739 6740 6741 6742 6743 | 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 | - + - + |
*---------------------------------------------------------------------------
*/
static int
GetInput(
Channel *chanPtr) /* Channel to read input from. */
{
|
| ︙ | |||
7223 7224 7225 7226 7227 7228 7229 | 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 | - + |
/*
* Seek first to force a total flush of all pending buffers and ditch any
* pre-read input data.
*/
WillWrite(chanPtr);
|
| ︙ | |||
7623 7624 7625 7626 7627 7628 7629 | 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 | - - - + + + + - + - + - + |
Tcl_BadChannelOption(
Tcl_Interp *interp, /* Current interpreter (can be NULL).*/
const char *optionName, /* 'bad option' name */
const char *optionList) /* Specific options list to append to the
* standard generic options. Can be NULL for
* generic options only. */
{
|
| ︙ | |||
7918 7919 7920 7921 7922 7923 7924 | 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 | - + - + |
const char *newValue) /* New value for option. */
{
Channel *chanPtr = (Channel *) chan;
/* The real IO channel. */
ChannelState *statePtr = chanPtr->state;
/* State info for channel */
size_t len; /* Length of optionName string. */
|
| ︙ | |||
7980 7981 7982 7983 7984 7985 7986 | 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 | - + |
} else if ((newValue[0] == 'n') &&
(strncmp(newValue, "none", len) == 0)) {
ResetFlag(statePtr, CHANNEL_LINEBUFFERED);
SetFlag(statePtr, CHANNEL_UNBUFFERED);
} else if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -buffering: must be one of"
|
| ︙ | |||
8037 8038 8039 8040 8041 8042 8043 | 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 | - + - + |
int inValue = (int) argv[0][0];
int outValue = (int) argv[outIndex][0];
if (inValue & 0x80 || outValue & 0x80) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -eofchar: must be non-NUL ASCII"
|
| ︙ | |||
8086 8087 8088 8089 8090 8091 8092 | 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 | - + |
} else if (argc == 2) {
readMode = GotFlag(statePtr, TCL_READABLE) ? argv[0] : NULL;
writeMode = GotFlag(statePtr, TCL_WRITABLE) ? argv[1] : NULL;
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -translation: must be a one or two"
|
| ︙ | |||
8116 8117 8118 8119 8120 8121 8122 | 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 | - + + |
translation = TCL_TRANSLATE_CRLF;
} else if (strcmp(readMode, "platform") == 0) {
translation = TCL_PLATFORM_TRANSLATION;
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -translation: must be one of "
|
| ︙ | |||
8166 8167 8168 8169 8170 8171 8172 | 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 | - + + |
statePtr->outputTranslation = TCL_TRANSLATE_CRLF;
} else if (strcmp(writeMode, "platform") == 0) {
statePtr->outputTranslation = TCL_PLATFORM_TRANSLATION;
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -translation: must be one of "
|
| ︙ | |||
8956 8957 8958 8959 8960 8961 8962 | 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 | - + |
/* ARGSUSED */
int
Tcl_FileEventObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Interpreter in which the channel for which
* to create the handler is found. */
|
| ︙ | |||
9206 9207 9208 9209 9210 9211 9212 | 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 | - + + + |
CopyState *csPtr, /* State of copy operation. */
int mask) /* Current channel event flags. */
{
Tcl_Interp *interp;
Tcl_Obj *cmdPtr, *errObj = NULL, *bufObj = NULL, *msg = NULL;
Tcl_Channel inChan, outChan;
ChannelState *inStatePtr, *outStatePtr;
|
| ︙ | |||
9272 9273 9274 9275 9276 9277 9278 | 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 | - + - + |
* Read up to bufSize bytes.
*/
if ((csPtr->toRead == (Tcl_WideInt) -1)
|| (csPtr->toRead > (Tcl_WideInt) csPtr->bufSize)) {
sizeb = csPtr->bufSize;
} else {
|
| ︙ | |||
9314 9315 9316 9317 9318 9319 9320 | 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 | - + |
* when the channel becomes readable again.
*/
if ((size == 0) && Tcl_Eof(inChan) && !(cmdPtr && (mask == 0))) {
break;
}
if (cmdPtr && (!Tcl_Eof(inChan) || (mask == 0)) &&
|
| ︙ | |||
9336 9337 9338 9339 9340 9341 9342 | 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 | - + - + - + - + |
/*
* Now write the buffer out.
*/
if (inBinary || sameEncoding) {
buffer = csPtr->buffer;
|
| ︙ | |||
9512 9513 9514 9515 9516 9517 9518 | 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 | - + - + - + - + | * * Side effects: * May cause input to be buffered. * *---------------------------------------------------------------------- */ |
| ︙ | |||
9595 9596 9597 9598 9599 9600 9601 | 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 | - + - + - + - + - + | * * Side effects: * Consumes buffered input. May deallocate one buffer. * *---------------------------------------------------------------------- */ |
| ︙ | |||
9637 9638 9639 9640 9641 9642 9643 | 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 | - + - + |
/*
* Copy the current chunk into the result buffer.
*/
if (bytesInBuffer < space) {
space = bytesInBuffer;
}
|
| ︙ | |||
9693 9694 9695 9696 9697 9698 9699 | 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 | - + |
* Copy the current chunk and replace "\r\n" with "\n" (but not
* standalone "\r"!).
*/
if (bytesInBuffer < space) {
space = bytesInBuffer;
}
|
| ︙ | |||
9733 9734 9735 9736 9737 9738 9739 | 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 | - + |
/*
* Loop over the current buffer, converting "\r" and "\r\n" to "\n".
*/
if (bytesInBuffer < space) {
space = bytesInBuffer;
}
|
| ︙ | |||
9820 9821 9822 9823 9824 9825 9826 | 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 | - + - + - + - + | * * Side effects: * Consumes buffered input. May deallocate one buffer. * *---------------------------------------------------------------------- */ |
| ︙ | |||
9864 9865 9866 9867 9868 9869 9870 | 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 | - + |
* Copy the current chunk into the result buffer.
*/
if (bytesInBuffer < space) {
space = bytesInBuffer;
}
|
| ︙ | |||
9914 9915 9916 9917 9918 9919 9920 | 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 | - + - + - - + + - + - + | * Side effects: * May buffer up output and may cause output to be produced on the * channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
9973 9974 9975 9976 9977 9978 9979 | 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 | - + - + |
destCopied = srcLen;
}
destPtr = InsertPoint(outBufPtr);
switch (statePtr->outputTranslation) {
case TCL_TRANSLATE_LF:
srcCopied = destCopied;
|
| ︙ | |||
10324 10325 10326 10327 10328 10329 10330 | 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 | - + |
hTblPtr = GetChannelTable(interp);
TclNewObj(resultPtr);
if ((pattern != NULL) && TclMatchIsTrivial(pattern)
&& !((pattern[0] == 's') && (pattern[1] == 't')
&& (pattern[2] == 'd'))) {
if ((Tcl_FindHashEntry(hTblPtr, pattern) != NULL)
&& (Tcl_ListObjAppendElement(interp, resultPtr,
|
| ︙ | |||
10351 10352 10353 10354 10355 10356 10357 | 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 | - + | */ name = statePtr->channelName; } if (((pattern == NULL) || Tcl_StringMatch(name, pattern)) && (Tcl_ListObjAppendElement(interp, resultPtr, |
| ︙ | |||
11028 11029 11030 11031 11032 11033 11034 | 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 | - + - - + - + |
*----------------------------------------------------------------------
*/
static Tcl_Obj *
FixLevelCode(
Tcl_Obj *msg)
{
|
| ︙ | |||
11469 11470 11471 11472 11473 11474 11475 | 11492 11493 11494 11495 11496 11497 11498 11499 11500 | - | /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * tab-width: 8 |
Changes to generic/tclIO.h.
| ︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + - + - + |
/*
* struct ChannelBuffer:
*
* Buffers data being sent to or from a channel.
*/
typedef struct ChannelBuffer {
|
| ︙ | |||
202 203 204 205 206 207 208 | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | - - + + |
/*
* TIP #219 ... Info for the I/O system ...
* Error message set by channel drivers, for the propagation of arbitrary
* Tcl errors. This information, if present (chanMsg not NULL), takes
* precedence over a posix error code returned by a channel operation.
*/
|
| ︙ |
Changes to generic/tclIOCmd.c.
| ︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + - - - + - - | /* * Static functions for this file: */ static void FinalizeIOCmdTSD(ClientData clientData); static void AcceptCallbackProc(ClientData callbackData, Tcl_Channel chan, char *address, int port); |
| ︙ | |||
101 102 103 104 105 106 107 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - + - |
*/
/* ARGSUSED */
int
Tcl_PutsObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
164 165 166 167 168 169 170 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | - + - - + - |
if (!(mode & TCL_WRITABLE)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"channel \"%s\" wasn't opened for writing",
TclGetString(chanObjPtr)));
return TCL_ERROR;
}
|
| ︙ | |||
213 214 215 216 217 218 219 | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | - + |
*/
/* ARGSUSED */
int
Tcl_FlushObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
275 276 277 278 279 280 281 | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | - + |
*/
/* ARGSUSED */
int
Tcl_GetsObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
354 355 356 357 358 359 360 | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | - + + + - + |
*/
/* ARGSUSED */
int
Tcl_ReadObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
408 409 410 411 412 413 414 | 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 | - + - + - - - - - + + + + + + - + |
}
i++; /* Consumed channel name. */
/*
* Compute how many bytes to read.
*/
|
| ︙ | |||
446 447 448 449 450 451 452 | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | - + |
/*
* If requested, remove the last newline in the channel if at EOF.
*/
if ((charactersRead > 0) && (newline != 0)) {
const char *result;
|
| ︙ | |||
481 482 483 484 485 486 487 | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | - + |
*/
/* ARGSUSED */
int
Tcl_SeekObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
554 555 556 557 558 559 560 | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | - + |
*/
/* ARGSUSED */
int
Tcl_TellObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
612 613 614 615 616 617 618 | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | - + |
*/
/* ARGSUSED */
int
Tcl_CloseObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
683 684 685 686 687 688 689 | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | - + | * messages produced by drivers during the closing of a channel, * because the Tcl convention is that such error messages do not have * a terminating newline. */ Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); const char *string; |
| ︙ | |||
721 722 723 724 725 726 727 | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | - + |
*/
/* ARGSUSED */
int
Tcl_FconfigureObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
797 798 799 800 801 802 803 | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | - + |
*/
/* ARGSUSED */
int
Tcl_EofObjCmd(
ClientData unused, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
837 838 839 840 841 842 843 | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 | - + - - + + |
*/
/* ARGSUSED */
int
Tcl_ExecObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
939 940 941 942 943 944 945 | 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | - + |
return TCL_ERROR;
}
return TCL_OK;
}
resultPtr = Tcl_NewObj();
if (Tcl_GetChannelHandle(chan, TCL_READABLE, NULL) == TCL_OK) {
|
| ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | - + |
*/
/* ARGSUSED */
int
Tcl_FblockedObjCmd(
ClientData unused, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1052 1053 1054 1055 1056 1057 1058 | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | - + |
*/
/* ARGSUSED */
int
Tcl_OpenObjCmd(
ClientData notUsed, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1083 1084 1085 1086 1087 1088 1089 | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | - + |
if ((permString[scanned] == '0')
&& (permString[scanned+1] >= '0')
&& (permString[scanned+1] <= '7')) {
Tcl_Obj *permObj;
TclNewLiteralStringObj(permObj, "0o");
|
| ︙ | |||
1108 1109 1110 1111 1112 1113 1114 | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | - + + |
/*
* Open the file or create a process pipeline.
*/
if (!pipeline) {
chan = Tcl_FSOpenFileChannel(interp, objv[1], modeString, prot);
} else {
|
| ︙ | |||
1146 1147 1148 1149 1150 1151 1152 | 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | - + + |
}
ckfree(cmdArgv);
}
if (chan == NULL) {
return TCL_ERROR;
}
Tcl_RegisterChannel(interp, chan);
|
| ︙ | |||
1425 1426 1427 1428 1429 1430 1431 | 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_SocketObjCmd(
ClientData notUsed, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1456 1457 1458 1459 1460 1461 1462 | 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 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 | - + + - + - + - + + - + - + |
TCL_EXACT, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum socketOptions) optionIndex) {
case SKT_ASYNC:
if (server == 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1537 1538 1539 1540 1541 1542 1543 | 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 | - + - |
return TCL_ERROR;
}
} else {
goto wrongNumArgs;
}
if (server) {
|
| ︙ | |||
1577 1578 1579 1580 1581 1582 1583 | 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 | - + + |
chan = Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async);
if (chan == NULL) {
return TCL_ERROR;
}
}
Tcl_RegisterChannel(interp, chan);
|
| ︙ | |||
1603 1604 1605 1606 1607 1608 1609 | 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_FcopyObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1699 1700 1701 1702 1703 1704 1705 | 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 | - + |
*/
/* ARGSUSED */
static int
ChanPendingObjCmd(
ClientData unused, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1761 1762 1763 1764 1765 1766 1767 | 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 | - + |
*----------------------------------------------------------------------
*/
static int
ChanTruncateObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1785 1786 1787 1788 1789 1790 1791 | 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 | - + + |
*/
if (Tcl_GetWideIntFromObj(interp, objv[2], &length) != TCL_OK) {
return TCL_ERROR;
}
if (length < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1834 1835 1836 1837 1838 1839 1840 | 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 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
ChanPipeObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1885 1886 1887 1888 1889 1890 1891 | 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 | - - + + |
*----------------------------------------------------------------------
*/
int
TclChannelNamesCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1961 1962 1963 1964 1965 1966 1967 | 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 | - - + + |
ensemble = TclMakeEnsemble(interp, "chan", initMap);
Tcl_GetEnsembleMappingDict(NULL, ensemble, &mapObj);
for (i=0 ; extras[i] ; i+=2) {
/*
* Can assume that reference counts are all incremented.
*/
|
Changes to generic/tclIOGT.c.
| ︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + - - + - - + - - + - - + - - + - - - + - - - - + + - - - + + - - + | #include "tclIO.h" /* * Forward declarations of internal procedures. First the driver procedures of * the transformation. */ |
| ︙ | |||
195 196 197 198 199 200 201 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | - + |
* sitting in an internal buffer. Required for
* full fileevent support. */
/*
* Transformation specific data.
*/
|
| ︙ | |||
333 334 335 336 337 338 339 | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - + - + + - + |
static int
ExecuteCallback(
TransformChannelData *dataPtr,
/* Transformation with the callback. */
Tcl_Interp *interp, /* Current interpreter, possibly NULL. */
unsigned char *op, /* Operation invoking the callback. */
unsigned char *buf, /* Buffer to give to the script. */
|
| ︙ | |||
431 432 433 434 435 436 437 | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | - + + |
case TRANSMIT_NUM:
/*
* Interpret result as integer number.
*/
resObj = Tcl_GetObjResult(dataPtr->interp);
|
| ︙ | |||
577 578 579 580 581 582 583 | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | - + - + - + | * * Result: * A transformed buffer. * *---------------------------------------------------------------------- */ |
| ︙ | |||
737 738 739 740 741 742 743 | 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | - + - + | * * Result: * A transformed buffer. * *---------------------------------------------------------------------- */ |
| ︙ |
Changes to generic/tclIORChan.c.
| ︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | - + - - + - - + - - - + + - + - + - - + - - + - - - + - - | #define EOK 0 #endif /* * Signatures of all functions used in the C layer of the reflection. */ |
| ︙ | |||
89 90 91 92 93 94 95 | 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 112 113 | - + - - - + + + + - + |
typedef struct {
Tcl_Channel chan; /* Back reference to generic channel
* structure. */
Tcl_Interp *interp; /* Reference to the interpreter containing the
* Tcl level part of the channel. NULL here
* signals the channel is dead because the
* interpreter/thread containing its Tcl
|
| ︙ | |||
268 269 270 271 272 273 274 | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + - + |
* ForwardParamBase. Where an operation does not need any special types, it
* has no "subtype" and just uses ForwardParamBase, as listed above.)
*/
struct ForwardParamInput {
ForwardParamBase base; /* "Supertype". MUST COME FIRST. */
char *buf; /* O: Where to store the read bytes */
|
| ︙ | |||
400 401 402 403 404 405 406 | 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 438 439 440 441 442 443 444 | - - - + + + + - - - - - + + + + + + + + - - + + + + - - - + + + + + - + + - + | static void ForwardOpToHandlerThread(ReflectedChannel *rcPtr, ForwardedOperation op, const void *param); static int ForwardProc(Tcl_Event *evPtr, int mask); static void SrcExitProc(ClientData clientData); #define FreeReceivedError(p) \ |
| ︙ | |||
501 502 503 504 505 506 507 | 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 | - + - + |
*----------------------------------------------------------------------
*/
int
TclChanCreateObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
626 627 628 629 630 631 632 | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | - + |
methods = 0;
while (listc > 0) {
if (Tcl_GetIndexFromObj(interp, listv[listc-1], methodNames,
"method", TCL_EXACT, &methIndex) != TCL_OK) {
TclNewLiteralStringObj(err, "chan handler \"");
Tcl_AppendObjToObj(err, cmdObj);
|
| ︙ | |||
736 737 738 739 740 741 742 | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | - + |
#endif
/*
* Return handle as result of command.
*/
Tcl_SetObjResult(interp,
|
| ︙ | |||
818 819 820 821 822 823 824 | 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | - + |
return 1;
}
int
TclChanPostEventObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 | - + - - |
}
static void
UnmarshallErrorResult(
Tcl_Interp *interp,
Tcl_Obj *msgObj)
{
|
| ︙ | |||
1272 1273 1274 1275 1276 1277 1278 | 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | - + - + - + | * * Side effects: * Allocates memory. Arbitrary, as it calls upon a script. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1388 1389 1390 1391 1392 1393 1394 | 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 | - + - + | * * Side effects: * Allocates memory. Arbitrary, as it calls upon a script. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 | - + |
* The handler claims to have written nothing of what it was
* given. That is bad.
*/
SetChannelErrorStr(rcPtr->chan, msg_write_nothing);
goto invalid;
}
|
| ︙ | |||
1560 1561 1562 1563 1564 1565 1566 | 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 | - + |
/* ASSERT: rcPtr->method & FLAG(METH_SEEK) */
Tcl_Preserve(rcPtr);
offObj = Tcl_NewWideIntObj(offset);
baseObj = Tcl_NewStringObj(
(seekMode == SEEK_SET) ? "start" :
|
| ︙ | |||
1832 1833 1834 1835 1836 1837 1838 | 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 | - + - - + + |
p.setOpt.name = optionName;
p.setOpt.value = newValue;
ForwardOpToHandlerThread(rcPtr, ForwardedSetOpt, &p);
if (p.base.code != TCL_OK) {
|
| ︙ | |||
1893 1894 1895 1896 1897 1898 1899 | 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 | - + + |
* This code is special. It has regular passing of Tcl result, and errors.
* The bypass functions are not required.
*/
ReflectedChannel *rcPtr = clientData;
Tcl_Obj *optionObj;
Tcl_Obj *resObj; /* Result data for 'configure' */
|
| ︙ | |||
1918 1919 1920 1921 1922 1923 1924 | 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 | - + |
} else {
opcode = ForwardedGetOpt;
}
ForwardOpToHandlerThread(rcPtr, opcode, &p);
if (p.base.code != TCL_OK) {
|
| ︙ | |||
1942 1943 1944 1945 1946 1947 1948 | 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 | - + |
optionObj = NULL;
} else {
/*
* Retrieve the value of one option.
*/
method = "cget";
|
| ︙ | |||
1986 1987 1988 1989 1990 1991 1992 | 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 | - + - + | /* * Odd number of elements is wrong. */ Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Expected list with even number of " |
| ︙ | |||
2048 2049 2050 2051 2052 2053 2054 | 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 | - + |
EncodeEventMask(
Tcl_Interp *interp,
const char *objName,
Tcl_Obj *obj,
int *mask)
{
int events; /* Mask of events to post */
|
| ︙ | |||
2077 2078 2079 2080 2081 2082 2083 | 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 | - + | case EVENT_READ: events |= TCL_READABLE; break; case EVENT_WRITE: events |= TCL_WRITABLE; break; } |
| ︙ | |||
2124 2125 2126 2127 2128 2129 2130 | 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 | - + |
eventStr = "write";
break;
default:
eventStr = "";
break;
}
|
| ︙ | |||
2155 2156 2157 2158 2159 2160 2161 | 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 | - + |
NewReflectedChannel(
Tcl_Interp *interp,
Tcl_Obj *cmdpfxObj,
int mode,
Tcl_Obj *handleObj)
{
ReflectedChannel *rcPtr;
|
| ︙ | |||
2354 2355 2356 2357 2358 2359 2360 | 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 | - + |
if (rcPtr->dead) {
/*
* The channel is marked as dead. Bail out immediately, with an
* appropriate error.
*/
if (resultObjPtr != NULL) {
|
| ︙ | |||
2378 2379 2380 2381 2382 2383 2384 | 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 | - + |
*/
/*
* Insert method into the pre-allocated area, after the command prefix,
* before the channel id.
*/
|
| ︙ | |||
2434 2435 2436 2437 2438 2439 2440 | 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 | - + |
*
* This is complex and ugly, and would be completely unnecessary
* if we only added support for a TCL_FORBID_EXCEPTIONS flag.
*/
if (result != TCL_ERROR) {
Tcl_Obj *cmd = Tcl_NewListObj(cmdc, rcPtr->argv);
|
| ︙ | |||
3065 3066 3067 3068 3069 3070 3071 | 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 | - + |
}
paramPtr->input.toRead = -1;
} else {
/*
* Process a regular result.
*/
|
| ︙ | |||
3128 3129 3130 3131 3132 3133 3134 | 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 | - + + |
break;
}
case ForwardedSeek: {
Tcl_Obj *offObj = Tcl_NewWideIntObj(paramPtr->seek.offset);
Tcl_Obj *baseObj = Tcl_NewStringObj(
(paramPtr->seek.seekMode==SEEK_SET) ? "start" :
|
| ︙ | |||
3191 3192 3193 3194 3195 3196 3197 | 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 | - - + + + + - + + |
}
Tcl_Release(rcPtr);
Tcl_DecrRefCount(blockObj);
break;
}
case ForwardedSetOpt: {
|
| ︙ | |||
3240 3241 3242 3243 3244 3245 3246 | 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 | - + + - + - + |
ForwardSetObjError(paramPtr, resObj);
} else {
/*
* Extract list, validate that it is a list, and #elements. See
* NOTE (4) as well.
*/
|
| ︙ | |||
3359 3360 3361 3362 3363 3364 3365 | 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 | - + |
}
static void
ForwardSetObjError(
ForwardParam *paramPtr,
Tcl_Obj *obj)
{
|
| ︙ |
Changes to generic/tclIORTrans.c.
| ︙ | |||
31 32 33 34 35 36 37 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - + - - + - - + - - - - + + + - - + - - + - - - + - - - + - - + | static int HaveVersion(const Tcl_ChannelType *typePtr, Tcl_ChannelTypeVersion minimumVersion); /* * Signatures of all functions used in the C layer of the reflection. */ |
| ︙ | |||
140 141 142 143 144 145 146 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - + |
* argv [0] ... [.] | [argc-2] [argc-1] | [argc] [argc+2]
* cmd ... pfx | method chan | detail1 detail2
* ~~~~ CT ~~~ ~~ CT ~~
*
* CT = Belongs to the 'Command handler Thread'.
*/
|
| ︙ | |||
265 266 267 268 269 270 271 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - + - + |
* has no "subtype" and just uses ForwardParamBase, as listed above.)
*/
struct ForwardParamTransform {
ForwardParamBase base; /* "Supertype". MUST COME FIRST. */
char *buf; /* I: Bytes to transform,
* O: Bytes in transform result */
|
| ︙ | |||
359 360 361 362 363 364 365 | 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 | - - - - - + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - + - - + | static void ForwardOpToOwnerThread(ReflectedTransform *rtPtr, ForwardedOperation op, const void *param); static int ForwardProc(Tcl_Event *evPtr, int mask); static void SrcExitProc(ClientData clientData); #define FreeReceivedError(p) \ |
| ︙ | |||
452 453 454 455 456 457 458 | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | - + - - + + - + | * Helper functions encapsulating some of the thread forwarding to make the * control flow in callers easier. */ static void TimerKill(ReflectedTransform *rtPtr); static void TimerSetup(ReflectedTransform *rtPtr); static void TimerRun(ClientData clientData); |
| ︙ | |||
499 500 501 502 503 504 505 | 488 489 490 491 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 | - + - + |
*----------------------------------------------------------------------
*/
int
TclChanPushObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
706 707 708 709 710 711 712 | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | - + |
#endif /* TCL_THREADS */
/*
* Return the channel as the result of the command.
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
744 745 746 747 748 749 750 | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | - + |
*----------------------------------------------------------------------
*/
int
TclChanPopObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
822 823 824 825 826 827 828 | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | - + |
}
static void
UnmarshallErrorResult(
Tcl_Interp *interp,
Tcl_Obj *msgObj)
{
|
| ︙ | |||
1050 1051 1052 1053 1054 1055 1056 | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | - + - + | * * Side effects: * Allocates memory. Arbitrary, as it calls upon a script. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1239 1240 1241 1242 1243 1244 1245 | 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | - + - + | * * Side effects: * Allocates memory. Arbitrary, as it calls upon a script. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1717 1718 1719 1720 1721 1722 1723 | 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 | - + |
eventStr = "write";
break;
default:
eventStr = "";
break;
}
|
| ︙ | |||
1748 1749 1750 1751 1752 1753 1754 | 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | - + |
Tcl_Interp *interp,
Tcl_Obj *cmdpfxObj,
int mode,
Tcl_Obj *handleObj,
Tcl_Channel parentChan)
{
ReflectedTransform *rtPtr;
|
| ︙ | |||
1958 1959 1960 1961 1962 1963 1964 | 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 | - + - + |
if (rtPtr->dead) {
/*
* The transform is marked as dead. Bail out immediately, with an
* appropriate error.
*/
if (resultObjPtr != NULL) {
|
| ︙ | |||
2032 2033 2034 2035 2036 2037 2038 | 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 | - + |
* the full state of the result, including additional options.
*
* This is complex and ugly, and would be completely unnecessary
* if we only added support for a TCL_FORBID_EXCEPTIONS flag.
*/
if (result != TCL_ERROR) {
Tcl_Obj *cmd = Tcl_NewListObj(cmdc, rtPtr->argv);
|
| ︙ | |||
2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 | 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 | + + |
Tcl_Interp *interp = rtPtr->interp;
ForwardParam *paramPtr = evPtr->param;
Tcl_Obj *resObj = NULL; /* Interp result of InvokeTclMethod */
ReflectedTransformMap *rtmPtr;
/* Map of reflected channels with handlers in
* this interp. */
Tcl_HashEntry *hPtr; /* Entry in the above map */
size_t bytec; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
/*
* Ignore the event if no one is waiting for its result anymore.
*/
if (!resultPtr) {
return 1;
|
| ︙ | |||
2581 2582 2583 2584 2585 2586 2587 | 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 | - - - - - + |
paramPtr->transform.size = -1;
} else {
/*
* Process a regular return. Contains the transformation result.
* Sent it back to the request originator.
*/
|
| ︙ | |||
2615 2616 2617 2618 2619 2620 2621 | 2602 2603 2604 2605 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 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 | - - - - - - + - - - - - + - - - - - - + + + + - - - - + + + + + + |
paramPtr->transform.size = -1;
} else {
/*
* Process a regular return. Contains the transformation result.
* Sent it back to the request originator.
*/
|
| ︙ | |||
2789 2790 2791 2792 2793 2794 2795 | 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 | - + |
}
static void
ForwardSetObjError(
ForwardParam *paramPtr,
Tcl_Obj *obj)
{
|
| ︙ | |||
3057 3058 3059 3060 3061 3062 3063 | 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 | - + - + - + |
}
/* -- common postwork code ------- */
return copied;
}
|
| ︙ | |||
3117 3118 3119 3120 3121 3122 3123 | 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 | - + - + - - - - |
ResultAdd(&rtPtr->result, bytev, bytec);
Tcl_DecrRefCount(bufObj);
Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */
return 1;
}
|
| ︙ | |||
3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 | 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 | + + + + + |
*errorCodePtr = EOK;
res = Tcl_WriteRaw(rtPtr->parent, (char *) p.transform.buf,
p.transform.size);
ckfree(p.transform.buf);
} else
#endif /* TCL_THREADS */
{
Tcl_Obj *bufObj;
Tcl_Obj *resObj;
size_t bytec; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
/* ASSERT: rtPtr->method & FLAG(METH_WRITE) */
/* ASSERT: rtPtr->mode & TCL_WRITABLE */
bufObj = Tcl_NewByteArrayObj((unsigned char *) buf, toWrite);
Tcl_IncrRefCount(bufObj);
if (InvokeTclMethod(rtPtr, "write", bufObj, NULL, &resObj) != TCL_OK) {
*errorCodePtr = EINVAL;
|
| ︙ | |||
3192 3193 3194 3195 3196 3197 3198 | 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 | - - - - |
}
static int
TransformDrain(
ReflectedTransform *rtPtr,
int *errorCodePtr)
{
|
| ︙ | |||
3218 3219 3220 3221 3222 3223 3224 | 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 | + + + + - + |
*errorCodePtr = EOK;
ResultAdd(&rtPtr->result, UCHARP(p.transform.buf), p.transform.size);
ckfree(p.transform.buf);
} else
#endif /* TCL_THREADS */
{
Tcl_Obj *resObj;
size_t bytec; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
|
| ︙ | |||
3241 3242 3243 3244 3245 3246 3247 | 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 | - - - |
static int
TransformFlush(
ReflectedTransform *rtPtr,
int *errorCodePtr,
int op)
{
|
| ︙ | |||
3273 3274 3275 3276 3277 3278 3279 | 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 | + + + + - + |
} else {
res = 0;
}
ckfree(p.transform.buf);
} else
#endif /* TCL_THREADS */
{
Tcl_Obj *resObj;
size_t bytec; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
|
| ︙ |
Changes to generic/tclIOSock.c.
| ︙ | |||
48 49 50 51 52 53 54 | 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 | - + - + |
const char *native;
if (Tcl_GetInt(NULL, string, portPtr) != TCL_OK) {
/*
* Don't bother translating 'proto' to native.
*/
|
| ︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | - + |
struct addrinfo *v6head = NULL, *v6ptr = NULL;
char *native = NULL, portbuf[TCL_INTEGER_SPACE], *portstring;
const char *family = NULL;
Tcl_DString ds;
int result, i;
if (host != NULL) {
|
| ︙ |
Changes to generic/tclIOUtil.c.
| ︙ | |||
257 258 259 260 261 262 263 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | - + |
int
Tcl_Stat(
const char *path, /* Path of file to stat (in current CP). */
struct stat *oldStyleBuf) /* Filled with results of stat call. */
{
int ret;
Tcl_StatBuf buf;
|
| ︙ | |||
343 344 345 346 347 348 349 | 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 | - + - + - + + |
/* Obsolete */
int
Tcl_Access(
const char *path, /* Path of file to access (in current CP). */
int mode) /* Permission setting. */
{
int ret;
|
| ︙ | |||
516 517 518 519 520 521 522 | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | - + |
if (pathPtrPtr == NULL) {
return (tsdPtr->cwdPathPtr == NULL);
}
if (tsdPtr->cwdPathPtr == *pathPtrPtr) {
return 1;
} else {
|
| ︙ | |||
658 659 660 661 662 663 664 | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | - + |
*/
static void
FsUpdateCwd(
Tcl_Obj *cwdObj,
ClientData clientData)
{
|
| ︙ | |||
1015 1016 1017 1018 1019 1020 1021 | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | + - + |
const char *pattern, /* Pattern to match against. */
Tcl_GlobTypeData *types) /* Object containing list of acceptable types.
* May be NULL. In particular the directory
* flag is very important. */
{
const Tcl_Filesystem *fsPtr;
Tcl_Obj *cwd, *tmpResultPtr, **elemsPtr;
int ret = -1;
|
| ︙ | |||
1077 1078 1079 1080 1081 1082 1083 | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | - + |
*/
cwd = Tcl_FSGetCwd(NULL);
if (cwd == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"glob couldn't determine the current working directory",
|
| ︙ | |||
1137 1138 1139 1140 1141 1142 1143 | 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | - + |
* not be shared! */
Tcl_Obj *pathPtr, /* The directory in question. */
const char *pattern, /* Pattern to match against. */
Tcl_GlobTypeData *types) /* Object containing list of acceptable types.
* May be NULL. In particular the directory
* flag is very important. */
{
|
| ︙ | |||
1177 1178 1179 1180 1181 1182 1183 | 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 | - + + |
gLength--;
}
break; /* Break out of for loop. */
}
}
if (!found && dir) {
Tcl_Obj *norm;
|
| ︙ | |||
1483 1484 1485 1486 1487 1488 1489 | 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 | - + + |
const char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */
int *seekFlagPtr, /* Set this to 1 if the caller should seek to
* EOF during the opening of the file. */
int *binaryPtr) /* Set this to 1 if the caller should
* configure the opened channel for binary
* operations. */
{
|
| ︙ | |||
1648 1649 1650 1651 1652 1653 1654 | 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 | - + |
ckfree(modeArgv);
if (!gotRW) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"access mode must include either RDONLY, WRONLY, or RDWR",
|
| ︙ | |||
1693 1694 1695 1696 1697 1698 1699 | 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 | - + + |
Tcl_FSEvalFileEx(
Tcl_Interp *interp, /* Interpreter in which to process file. */
Tcl_Obj *pathPtr, /* Path of file to process. Tilde-substitution
* will be performed on this name. */
const char *encodingName) /* If non-NULL, then use this encoding for the
* file. NULL means use the system encoding. */
{
|
| ︙ | |||
1762 1763 1764 1765 1766 1767 1768 | 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 | - + |
string = Tcl_GetString(objPtr);
/*
* If first character is not a BOM, append the remaining characters,
* otherwise replace them. [Bug 3466099]
*/
|
| ︙ | |||
1812 1813 1814 1815 1816 1817 1818 | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | - + | const char *pathString = Tcl_GetStringFromObj(pathPtr, &length); int limit = 150; int overflow = (length > limit); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (file \"%.*s%s\" line %d)", |
| ︙ | |||
1897 1898 1899 1900 1901 1902 1903 | 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 | - + |
string = Tcl_GetString(objPtr);
/*
* If first character is not a BOM, append the remaining characters,
* otherwise replace them. [Bug 3466099]
*/
|
| ︙ | |||
1956 1957 1958 1959 1960 1961 1962 | 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 | - + - + |
if (result == TCL_RETURN) {
result = TclUpdateReturnInfo(iPtr);
} else if (result == TCL_ERROR) {
/*
* Record information telling where the error occurred.
*/
|
| ︙ | |||
2465 2466 2467 2468 2469 2470 2471 | 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 | - + - + |
}
if (attrTable != NULL) {
/*
* It's a constant attribute table, so use T_GIFO.
*/
|
| ︙ | |||
2806 2807 2808 2809 2810 2811 2812 | 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 | - + | /* * Note that both 'norm' and 'tsdPtr->cwdPathPtr' are normalized * paths. Therefore we can be more efficient than calling * 'Tcl_FSEqualPaths', and in addition avoid a nasty infinite loop * bug when trying to normalize tsdPtr->cwdPathPtr. */ |
| ︙ | |||
3221 3222 3223 3224 3225 3226 3227 | 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 | - + | * and we must avoid a possible infinite loop. Try to delete the file * we probably created, and then exit. */ Tcl_FSDeleteFile(copyToPtr); Tcl_DecrRefCount(copyToPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj( |
| ︙ | |||
3540 3541 3542 3543 3544 3545 3546 | 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 | - + |
Tcl_Interp *interp, /* Tcl interpreter */
Tcl_LoadHandle handle) /* Handle of the file to unload */
{
if (handle->unloadFileProcPtr == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot unload: filesystem does not support unloading",
|
| ︙ | |||
3855 3856 3857 3858 3859 3860 3861 | 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 | - + - + |
*
*---------------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_FSSplitPath(
Tcl_Obj *pathPtr, /* Path to split. */
|
| ︙ | |||
3965 3966 3967 3968 3969 3970 3971 | 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 | - + - + |
Tcl_PathType
TclGetPathType(
Tcl_Obj *pathPtr, /* Path to determine type for. */
const Tcl_Filesystem **filesystemPtrPtr,
/* If absolute path and this is not NULL, then
* set to the filesystem which claims this
* path. */
|
| ︙ | |||
4016 4017 4018 4019 4020 4021 4022 | 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 | - + - + |
*
*----------------------------------------------------------------------
*/
Tcl_PathType
TclFSNonnativePathType(
const char *path, /* Path to determine type for. */
|
| ︙ | |||
4062 4063 4064 4065 4066 4067 4068 | 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 | - + - + |
* that effort here, and this function is actually called quite often,
* so if we can save the overhead of the native filesystem returning
* us a list of volumes all the time, it is better.
*/
if ((fsRecPtr->fsPtr != &tclNativeFilesystem)
&& (fsRecPtr->fsPtr->listVolumesProc != NULL)) {
|
| ︙ | |||
4258 4259 4260 4261 4262 4263 4264 | 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 | - + |
}
/*
* Copy it synchronously. We might wish to add an asynchronous option to
* support vfs's which are slow (e.g. network sockets).
*/
|
| ︙ | |||
4430 4431 4432 4433 4434 4435 4436 | 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 | - + |
*/
if (recursive) {
Tcl_Obj *cwdPtr = Tcl_FSGetCwd(NULL);
if (cwdPtr != NULL) {
const char *cwdStr, *normPathStr;
|
| ︙ | |||
4635 4636 4637 4638 4639 4640 4641 | 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 | - + |
if (fsPtr == NULL) {
return NULL;
}
resPtr = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(NULL, resPtr,
|
| ︙ | |||
4722 4723 4724 4725 4726 4727 4728 | 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 | - + |
case TCL_PLATFORM_UNIX:
separator = "/";
break;
case TCL_PLATFORM_WINDOWS:
separator = "\\";
break;
}
|
Changes to generic/tclIndexObj.c.
| ︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | - + - - - + - - - + - - | static int GetIndexFromObjList(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj *tableObjPtr, const char *msg, int flags, int *indexPtr); static int SetIndexFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void UpdateStringOfIndex(Tcl_Obj *objPtr); static void DupIndex(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr); static void FreeIndex(Tcl_Obj *objPtr); |
| ︙ | |||
108 109 110 111 112 113 114 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - - + + |
Tcl_Obj *tableObjPtr, /* List of strings to compare against the
* value of objPtr. */
const char *msg, /* Identifying word to use in error
* messages. */
int flags, /* 0 or TCL_EXACT */
int *indexPtr) /* Place to store resulting integer index. */
{
|
| ︙ | |||
355 356 357 358 359 360 361 | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | - + |
SetIndexFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr) /* The object to convert. */
{
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't convert value to index except via Tcl_GetIndexFromObj API",
|
| ︙ | |||
504 505 506 507 508 509 510 | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | - + - + |
*----------------------------------------------------------------------
*/
static int
PrefixMatchObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
536 537 538 539 540 541 542 | 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 | - + - + - + |
switch ((enum matchOptions) index) {
case PRFMATCH_EXACT:
flags |= TCL_EXACT;
break;
case PRFMATCH_MESSAGE:
if (i > objc-4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
628 629 630 631 632 633 634 | 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 | - + - + + - |
*----------------------------------------------------------------------
*/
static int
PrefixAllObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
685 686 687 688 689 690 691 | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | - + - + + |
*----------------------------------------------------------------------
*/
static int
PrefixLongestObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
803 804 805 806 807 808 809 | 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 | - + - + + |
*
*----------------------------------------------------------------------
*/
void
Tcl_WrongNumArgs(
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
843 844 845 846 847 848 849 | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | - + - + |
# define AFTER_FIRST_WORD (void) 0
#endif /* AVOID_HACKS_FOR_ITCL */
TclNewObj(objPtr);
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
Tcl_AppendObjToObj(objPtr, Tcl_GetObjResult(interp));
|
| ︙ | |||
1028 1029 1030 1031 1032 1033 1034 | 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | - + |
*/
int
Tcl_ParseArgsObjv(
Tcl_Interp *interp, /* Place to store error message. */
const Tcl_ArgvInfo *argTable,
/* Array of option descriptions. */
|
| ︙ | |||
1055 1056 1057 1058 1059 1060 1061 | 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 | - - + + |
* because first char. will almost always be
* '-'). */
int srcIndex; /* Location from which to read next argument
* from objv. */
int dstIndex; /* Used to keep track of current arguments
* being processed, primarily for error
* reporting. */
|
| ︙ | |||
1323 1324 1325 1326 1327 1328 1329 | 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 | - + - + |
}
}
/*
* Now add the option information, with pretty-printing.
*/
|
| ︙ |
Changes to generic/tclInt.decls.
| ︙ | |||
38 39 40 41 42 43 44 | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | - - + + - + - + |
void TclAllocateFreeObjects(void)
}
# Replaced by TclpChdir in 8.1:
# declare 4 {
# int TclChdir(Tcl_Interp *interp, char *dirName)
# }
declare 5 {
|
| ︙ | |||
104 105 106 107 108 109 110 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - - + + - + |
# int TclFileMakeDirsCmd(Tcl_Interp *interp, int argc, char **argv)
#}
#declare 21 {
# int TclFileRenameCmd(Tcl_Interp *interp, int argc, char **argv)
#}
declare 22 {
int TclFindElement(Tcl_Interp *interp, const char *listStr,
|
| ︙ | |||
151 152 153 154 155 156 157 | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | - + |
}
# Removed in Tcl 8.5
#declare 33 {
# TclCmdProcType TclGetInterpProc(void)
#}
declare 34 {
int TclGetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
| ︙ | |||
225 226 227 228 229 230 231 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | - + - + |
# Removed in Tcl 8.5a2
#declare 52 {
# int TclInvoke(Tcl_Interp *interp, int argc, const char **argv,
# int flags)
#}
declare 53 {
int TclInvokeObjectCommand(ClientData clientData, Tcl_Interp *interp,
|
| ︙ | |||
265 266 267 268 269 270 271 | 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 | - + - + - + |
Tcl_Obj *TclNewProcBodyObj(Proc *procPtr)
}
declare 62 {
int TclObjCommandComplete(Tcl_Obj *cmdPtr)
}
declare 63 {
int TclObjInterpProc(ClientData clientData, Tcl_Interp *interp,
|
| ︙ | |||
330 331 332 333 334 335 336 | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | - + |
#}
# Replaced by Tcl_FSOpenFileChannel in 8.4:
#declare 80 {
# Tcl_Channel TclpOpenFileChannel(Tcl_Interp *interp, char *fileName,
# char *modeString, int permissions)
#}
declare 81 {
|
| ︙ | |||
685 686 687 688 689 690 691 | 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 | - + - - + + - - + + - - + + |
declare 165 {
void TclpSetInitialEncodings(void)
}
# New function due to TIP #33
declare 166 {
int TclListObjSetElement(Tcl_Interp *interp, Tcl_Obj *listPtr,
|
| ︙ | |||
882 883 884 885 886 887 888 | 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 | - + - + - + |
declare 213 {
Tcl_Obj *TclGetObjNameOfExecutable(void)
}
declare 214 {
void TclSetObjNameOfExecutable(Tcl_Obj *name, Tcl_Encoding encoding)
}
declare 215 {
|
| ︙ | |||
965 966 967 968 969 970 971 | 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 | - + - + - + - - + + |
int TclResetCancellation(Tcl_Interp *interp, int force)
}
# NRE functions for "rogue" extensions to exploit NRE; they will need to
# include NRE.h too.
declare 238 {
int TclNRInterpProc(ClientData clientData, Tcl_Interp *interp,
|
| ︙ | |||
1011 1012 1013 1014 1015 1016 1017 | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 | - + |
declare 248 {
int TclCopyChannel(Tcl_Interp *interp, Tcl_Channel inChan,
Tcl_Channel outChan, Tcl_WideInt toRead, Tcl_Obj *cmdPtr)
}
declare 249 {
char *TclDoubleDigits(double dv, int ndigits, int flags,
|
| ︙ | |||
1041 1042 1043 1044 1045 1046 1047 | 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 | - + - + |
#}
declare 2 win {
struct servent *TclWinGetServByName(const char *nm,
const char *proto)
}
declare 3 win {
int TclWinGetSockOpt(SOCKET s, int level, int optname,
|
| ︙ | |||
1093 1094 1095 1096 1097 1098 1099 | 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 | - + |
Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)
}
declare 14 win {
int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe)
}
declare 15 win {
|
| ︙ | |||
1181 1182 1183 1184 1185 1186 1187 | 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | - + |
Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)
}
declare 3 unix {
int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe)
}
declare 4 unix {
|
| ︙ |
Changes to generic/tclInt.h.
| ︙ | |||
142 143 144 145 146 147 148 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | - + |
typedef struct Tcl_ResolvedVarInfo {
Tcl_ResolveRuntimeVarProc *fetchProc;
Tcl_ResolveVarDeleteProc *deleteProc;
} Tcl_ResolvedVarInfo;
typedef int (Tcl_ResolveCompiledVarProc)(Tcl_Interp *interp,
|
| ︙ | |||
309 310 311 312 313 314 315 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | - + |
* validated efficiently. */
Tcl_Ensemble *ensembles; /* List of structures that contain the details
* of the ensembles that are implemented on
* top of this namespace. */
Tcl_Obj *unknownHandlerPtr; /* A script fragment to be used when command
* resolution in this namespace fails. TIP
* 181. */
|
| ︙ | |||
477 478 479 480 481 482 483 | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | - + |
* results passed directly back to the caller
* (including the error code) unless the code
* is TCL_CONTINUE in which case the
* subcommand will be reparsed by the ensemble
* core, presumably because the ensemble
* itself has been updated. */
Tcl_Obj *parameterList; /* List of ensemble parameter names. */
|
| ︙ | |||
903 904 905 906 907 908 909 | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | - + - + |
*/
typedef struct CompiledLocal {
struct CompiledLocal *nextPtr;
/* Next compiler-recognized local variable for
* this procedure, or NULL if this is the last
* local. */
|
| ︙ | |||
949 950 951 952 953 954 955 | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | - - + + |
* becomes zero. */
struct Command *cmdPtr; /* Points to the Command structure for this
* procedure. This is used to get the
* namespace in which to execute the
* procedure. */
Tcl_Obj *bodyPtr; /* Points to the ByteCode object for
* procedure's body command. */
|
| ︙ | |||
1056 1057 1058 1059 1060 1061 1062 | 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 | - + - + |
/*
* Will be grown to contain: pointers to the varnames (allocated at the end),
* plus the init values for each variable (suitable to be memcopied on init)
*/
typedef struct LocalCache {
int refCount;
|
| ︙ | |||
1104 1105 1106 1107 1108 1109 1110 | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 | - + |
* (local variables assigned entries ["slots"]
* in the compiledLocals array below). */
TclVarHashTable *varTablePtr;
/* Hash table containing local variables not
* recognized by the compiler, or created at
* execution time through, e.g., upvar.
* Initially NULL and created if needed. */
|
| ︙ | |||
1206 1207 1208 1209 1210 1211 1212 | 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 | - + - + |
struct {
const void *codePtr;/* Byte code currently executed... */
const char *pc; /* ... and instruction pointer. */
} tebc;
} data;
Tcl_Obj *cmdObj;
const char *cmd; /* The executed command, if possible... */
|
| ︙ | |||
1256 1257 1258 1259 1260 1261 1262 | 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 | - + |
*/
#define CLL_END (-1)
typedef struct ContLineLoc {
int num; /* Number of entries in loc, not counting the
* final -1 marker entry. */
|
| ︙ | |||
1297 1298 1299 1300 1301 1302 1303 | 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 | - + + - + |
* procedures (e.g. a lambda) so that their details can be reported correctly
* by [info frame]. Contains a sub-structure for each extra field.
*/
typedef Tcl_Obj * (GetFrameInfoValueProc)(ClientData clientData);
typedef struct {
const char *name; /* Name of this field. */
|
| ︙ | |||
1439 1440 1441 1442 1443 1444 1445 | 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | - + |
CorContext running;
Tcl_HashTable *lineLABCPtr; /* See Interp.lineLABCPtr */
void *stackLevel;
int auxNumLevels; /* While the coroutine is running the
* numLevels of the create/resume command is
* stored here; for suspended coroutines it
* holds the nesting numLevels at yield. */
|
| ︙ | |||
1498 1499 1500 1501 1502 1503 1504 | 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 | - + - + - + |
typedef struct LiteralTable {
LiteralEntry **buckets; /* Pointer to bucket array. Each element
* points to first entry in bucket's hash
* chain, or NULL. */
LiteralEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
/* Bucket array used for small tables to avoid
* mallocs and frees. */
|
| ︙ | |||
1744 1745 1746 1747 1748 1749 1750 | 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 | - + |
*----------------------------------------------------------------
*/
typedef struct AllocCache {
struct Cache *nextPtr; /* Linked list of cache entries. */
Tcl_ThreadId owner; /* Which thread's cache is this? */
Tcl_Obj *firstObjPtr; /* List of free objects for thread. */
|
| ︙ | |||
2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 | 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 | + |
* structs for this interp's thread; see
* tclObj.c and tclThreadAlloc.c */
int *asyncReadyPtr; /* Pointer to the asyncReady indicator for
* this interp's thread; see tclAsync.c */
/*
* The pointer to the object system root ekeko. c.f. TIP #257.
*/
void *objectFoundation; /* Pointer to the Foundation structure of the
* object system, which contains things like
* references to key namespaces. See
* tclOOInt.h and tclOO.c for real definition
* and setup. */
struct NRE_callback *deferredCallbacks;
|
| ︙ | |||
2088 2089 2090 2091 2092 2093 2094 | 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 | - - - + + + + |
Tcl_Obj *asyncCancelMsg; /* Error message set by async cancel handler
* for the propagation of arbitrary Tcl
* errors. This information, if present
* (asyncCancelMsg not NULL), takes precedence
* over the default error messages returned by
* a script cancellation operation. */
|
| ︙ | |||
2326 2327 2328 2329 2330 2331 2332 | 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 | - - + + |
* list's element pointers. The struct might contain more slots than currently
* used to hold all element pointers. This is done to make append operations
* faster.
*/
typedef struct List {
int refCount;
|
| ︙ | |||
2516 2517 2518 2519 2520 2521 2522 | 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 2545 2546 2547 | - - + + - + | /* *---------------------------------------------------------------- * Data structures for process-global values. *---------------------------------------------------------------- */ |
| ︙ | |||
2764 2765 2766 2767 2768 2769 2770 | 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 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 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 | - + - + - + - + - + - - + + - + - + - + - - + + | /* *---------------------------------------------------------------- * Procedures shared among Tcl modules but not used by the outside world: *---------------------------------------------------------------- */ MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr, |
| ︙ | |||
2857 2858 2859 2860 2861 2862 2863 | 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 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 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 | - + - + - + - + - + - + - + - + - + - + - - + + + - + - + - + - + - - - + + + - + + - - + + + - + - - + + - + - + + - + | const char *encodingName); MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle); MODULE_SCOPE int * TclGetAsyncReadyPtr(void); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp); MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Channel *chanPtr, int *modePtr, int flags); |
| ︙ | |||
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 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 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 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 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 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 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 | - - + + + - - - + + + - + - + - + - - - - - - + + + + + + - + + + - + - + + - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - + - - + - - - + - - - + - - - + - - - + - - - + - - + + - - - + - - - + - - - - + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - + - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - + + - - - + + - - - + + - - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + - + - - - + - - - + - - - + - - - + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - - - - - - - - - - - - - + + + + + - - - + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - - - - - - - - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - - - - + - - - + - - - + - - - + - - - - - - + - - - + - - - + - - - + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - + - - - + - - - + - - - + - - - + - - - - - - + - - - + - - - + - - - + - - - - - - - - - - - - - - - - - - + - - - + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - + + - - | void *data); MODULE_SCOPE void TclpThreadExit(int status); MODULE_SCOPE void TclRememberCondition(Tcl_Condition *mutex); MODULE_SCOPE void TclRememberJoinableThread(Tcl_ThreadId id); MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex); MODULE_SCOPE void TclRemoveScriptLimitCallbacks(Tcl_Interp *interp); MODULE_SCOPE int TclReToGlob(Tcl_Interp *interp, const char *reStr, |
| ︙ | |||
3805 3806 3807 3808 3809 3810 3811 | 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 | - + - | Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, const int flags, int index); MODULE_SCOPE int TclPtrObjMakeUpvar(Tcl_Interp *interp, Var *otherPtr, Tcl_Obj *myNamePtr, int myFlags, int index); MODULE_SCOPE int TclPtrUnsetVar(Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr, |
| ︙ | |||
3877 3878 3879 3880 3881 3882 3883 | 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 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 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 | - + - + + - - - - - - - + + + + + + + + - + - - - + + + - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + |
tclObjsFreed++
#else
# define TclIncrObjsAllocated()
# define TclIncrObjsFreed()
#endif /* TCL_COMPILE_STATS */
# define TclAllocObjStorage(objPtr) \
|
| ︙ | |||
4035 4036 4037 4038 4039 4040 4041 | 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 | - + | #endif #else /* TCL_MEM_DEBUG */ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, int line); # define TclDbNewObj(objPtr, file, line) \ |
| ︙ | |||
4063 4064 4065 4066 4067 4068 4069 | 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 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 | - + - - - - - - - - + + + + + + + + - - + + - - - - - + + + + + - - - - - + + + + + - - + + - + | *---------------------------------------------------------------- * Macro used by the Tcl core to set a Tcl_Obj's string representation to a * copy of the "len" bytes starting at "bytePtr". This code works even if the * byte array contains NULLs as long as the length is correct. Because "len" * is referenced multiple times, it should be as simple an expression as * possible. The ANSI C "prototype" for this macro is: * |
| ︙ | |||
4168 4169 4170 4171 4172 4173 4174 | 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 | - + - + |
#ifndef TCL_MIN_TOKEN_GROWTH
#define TCL_MIN_TOKEN_GROWTH TCL_MIN_GROWTH/sizeof(Tcl_Token)
#endif
#define TCL_MAX_TOKENS (int)(UINT_MAX / sizeof(Tcl_Token))
#define TclGrowTokenArray(tokenPtr, used, available, append, staticPtr) \
do { \
|
| ︙ | |||
4220 4221 4222 4223 4224 4225 4226 | 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 | - + - - + + - - - - - - - - - - + + + + + + + + + + + + + - + | * the result of Tcl_UtfToUniChar. The ANSI C "prototype" for this macro is: * * MODULE_SCOPE int TclUtfToUniChar(const char *string, Tcl_UniChar *ch); *---------------------------------------------------------------- */ #define TclUtfToUniChar(str, chPtr) \ |
| ︙ | |||
4294 4295 4296 4297 4298 4299 4300 | 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 | + - - - - - - + + + + + + + |
* counter. The ANSI C "prototype" for this macro is:
*
* MODULE_SCOPE void TclInvalidateNsCmdLookup(Namespace *nsPtr);
*----------------------------------------------------------------
*/
#define TclInvalidateNsCmdLookup(nsPtr) \
do { \
|
| ︙ | |||
4358 4359 4360 4361 4362 4363 4364 | 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 | - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + | * MODULE_SCOPE void TclSetLongObj(Tcl_Obj *objPtr, long longValue); * MODULE_SCOPE void TclSetWideIntObj(Tcl_Obj *objPtr, Tcl_WideInt w); * MODULE_SCOPE void TclSetDoubleObj(Tcl_Obj *objPtr, double d); *---------------------------------------------------------------- */ #define TclSetLongObj(objPtr, i) \ |
| ︙ | |||
4522 4523 4524 4525 4526 4527 4528 | 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 | - - + + | /* *---------------------------------------------------------------- * Inline version of TclCleanupCommand; still need the function as it is in * the internal stubs, but the core can use the macro instead. */ #define TclCleanupCommandMacro(cmdPtr) \ |
| ︙ |
Changes to generic/tclIntDecls.h.
| ︙ | |||
37 38 39 40 41 42 43 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - + - + | /* Slot 4 is reserved */ /* 5 */ TCLAPI int TclCleanupChildren(Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 6 */ TCLAPI void TclCleanupCommand(Command *cmdPtr); /* 7 */ |
| ︙ | |||
68 69 70 71 72 73 74 | 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 106 107 | - + - + - + - + + | /* Slot 17 is reserved */ /* Slot 18 is reserved */ /* Slot 19 is reserved */ /* Slot 20 is reserved */ /* Slot 21 is reserved */ /* 22 */ TCLAPI int TclFindElement(Tcl_Interp *interp, |
| ︙ | |||
134 135 136 137 138 139 140 | 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 | - + - + - + - + - + - + | TCLAPI void TclInitCompiledLocals(Tcl_Interp *interp, CallFrame *framePtr, Namespace *nsPtr); /* 51 */ TCLAPI int TclInterpInit(Tcl_Interp *interp); /* Slot 52 is reserved */ /* 53 */ TCLAPI int TclInvokeObjectCommand(ClientData clientData, |
| ︙ | |||
351 352 353 354 355 356 357 | 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 | - + - + - + - + - + - - + + | TCLAPI const void * TclGetInstructionTable(void); /* 164 */ TCLAPI void TclExpandCodeArray(void *envPtr); /* 165 */ TCLAPI void TclpSetInitialEncodings(void); /* 166 */ TCLAPI int TclListObjSetElement(Tcl_Interp *interp, |
| ︙ | |||
444 445 446 447 448 449 450 | 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 | - + - + - + | TCLAPI void TclpFindExecutable(const char *argv0); /* 213 */ TCLAPI Tcl_Obj * TclGetObjNameOfExecutable(void); /* 214 */ TCLAPI void TclSetObjNameOfExecutable(Tcl_Obj *name, Tcl_Encoding encoding); /* 215 */ |
| ︙ | |||
499 500 501 502 503 504 505 | 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 | - + - + | TCLAPI void TclInitVarHashTable(TclVarHashTable *tablePtr, Namespace *nsPtr); /* Slot 236 is reserved */ /* 237 */ TCLAPI int TclResetCancellation(Tcl_Interp *interp, int force); /* 238 */ TCLAPI int TclNRInterpProc(ClientData clientData, |
| ︙ | |||
550 551 552 553 554 555 556 | 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 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 | - + - + - + - + - + - - + + - - + + - + - + |
void (*reserved0)(void);
void (*reserved1)(void);
void (*reserved2)(void);
void (*tclAllocateFreeObjects) (void); /* 3 */
void (*reserved4)(void);
int (*tclCleanupChildren) (Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 5 */
void (*tclCleanupCommand) (Command *cmdPtr); /* 6 */
|
| ︙ | |||
709 710 711 712 713 714 715 | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | - + - - + + - + |
void (*reserved159)(void);
void (*reserved160)(void);
int (*tclChannelTransform) (Tcl_Interp *interp, Tcl_Channel chan, Tcl_Obj *cmdObjPtr); /* 161 */
void (*tclChannelEventScriptInvoker) (ClientData clientData, int flags); /* 162 */
const void * (*tclGetInstructionTable) (void); /* 163 */
void (*tclExpandCodeArray) (void *envPtr); /* 164 */
void (*tclpSetInitialEncodings) (void); /* 165 */
|
| ︙ | |||
758 759 760 761 762 763 764 | 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 793 794 795 796 797 798 799 800 | - + - + - + - + - + |
Tcl_Channel (*tclpOpenFileChannel) (Tcl_Interp *interp, Tcl_Obj *pathPtr, int mode, int permissions); /* 208 */
void (*reserved209)(void);
void (*reserved210)(void);
void (*reserved211)(void);
void (*tclpFindExecutable) (const char *argv0); /* 212 */
Tcl_Obj * (*tclGetObjNameOfExecutable) (void); /* 213 */
void (*tclSetObjNameOfExecutable) (Tcl_Obj *name, Tcl_Encoding encoding); /* 214 */
|
| ︙ |
Changes to generic/tclIntPlatDecls.h.
| ︙ | |||
34 35 36 37 38 39 40 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + | /* 2 */ TCLAPI Tcl_Channel TclpCreateCommandChannel(TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 3 */ TCLAPI int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); /* 4 */ |
| ︙ | |||
85 86 87 88 89 90 91 | 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - + - + - + | TCLAPI void TclWinConvertError(DWORD errCode); /* Slot 1 is reserved */ /* 2 */ TCLAPI struct servent * TclWinGetServByName(const char *nm, const char *proto); /* 3 */ TCLAPI int TclWinGetSockOpt(SOCKET s, int level, int optname, |
| ︙ | |||
160 161 162 163 164 165 166 | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | - + | /* 2 */ TCLAPI Tcl_Channel TclpCreateCommandChannel(TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 3 */ TCLAPI int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); /* 4 */ |
| ︙ | |||
227 228 229 230 231 232 233 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - + |
void *hooks;
#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */
int (*tclpCloseFile) (TclFile file); /* 1 */
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
|
| ︙ | |||
259 260 261 262 263 264 265 | 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 | - + - + - + |
int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
#endif /* UNIX */
#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
void (*tclWinConvertError) (DWORD errCode); /* 0 */
void (*reserved1)(void);
struct servent * (*tclWinGetServByName) (const char *nm, const char *proto); /* 2 */
|
| ︙ | |||
293 294 295 296 297 298 299 | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | - + |
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */
int (*tclpCloseFile) (TclFile file); /* 1 */
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
|
| ︙ |
Changes to generic/tclInterp.c.
| ︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + |
* This is used by alias deletion to remove
* the alias from the slave interpreter alias
* table. */
struct Target *targetPtr; /* Entry for target command in master. This is
* used in the master interpreter to map back
* from the target command to aliases
* redirecting to it. */
|
| ︙ | |||
211 212 213 214 215 216 217 | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | - + - + - - - + - - - + - + - + - + - + - + - + - + - - + - - + + - - + + | /* * Prototypes for local static functions: */ static int AliasCreate(Tcl_Interp *interp, Tcl_Interp *slaveInterp, Tcl_Interp *masterInterp, |
| ︙ | |||
588 589 590 591 592 593 594 | 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 | - - - - + + + + - + | * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_InterpObjCmd( |
| ︙ | |||
812 813 814 815 816 817 818 | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | - + |
Tcl_CmdInfo cmdInfo;
sprintf(buf, "interp%d", i);
if (Tcl_GetCommandInfo(interp, buf, &cmdInfo) == 0) {
break;
}
}
|
| ︙ | |||
847 848 849 850 851 852 853 | 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 | - + |
for (i = 2; i < objc; i++) {
slaveInterp = GetInterp(interp, objv[i]);
if (slaveInterp == NULL) {
return TCL_ERROR;
} else if (slaveInterp == interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1025 1026 1027 1028 1029 1030 1031 | 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | - + |
}
iiPtr = (InterpInfo *) ((Interp *) slaveInterp)->interpInfo;
resultPtr = Tcl_NewObj();
hPtr = Tcl_FirstHashEntry(&iiPtr->master.slaveTable, &hashSearch);
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) {
string = Tcl_GetHashKey(&iiPtr->master.slaveTable, hPtr);
Tcl_ListObjAppendElement(NULL, resultPtr,
|
| ︙ | |||
1134 1135 1136 1137 1138 1139 1140 | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | - + |
*---------------------------------------------------------------------------
*/
static Tcl_Interp *
GetInterp2(
Tcl_Interp *interp, /* Default interp if no interp was specified
* on the command line. */
|
| ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | - + - + - + - + - + |
int
Tcl_CreateAlias(
Tcl_Interp *slaveInterp, /* Interpreter for source command. */
const char *slaveCmd, /* Command to install in slave. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
|
| ︙ | |||
1224 1225 1226 1227 1228 1229 1230 | 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | - + - + - + |
int
Tcl_CreateAliasObj(
Tcl_Interp *slaveInterp, /* Interpreter for source command. */
const char *slaveCmd, /* Command to install in slave. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
|
| ︙ | |||
1267 1268 1269 1270 1271 1272 1273 | 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | - + - + |
int
Tcl_GetAlias(
Tcl_Interp *interp, /* Interp to start search from. */
const char *aliasName, /* Name of alias to find. */
Tcl_Interp **targetInterpPtr,
/* (Return) target interpreter. */
const char **targetNamePtr, /* (Return) name of target command. */
|
| ︙ | |||
1329 1330 1331 1332 1333 1334 1335 | 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 | - + - + |
int
Tcl_GetAliasObj(
Tcl_Interp *interp, /* Interp to start search from. */
const char *aliasName, /* Name of alias to find. */
Tcl_Interp **targetInterpPtr,
/* (Return) target interpreter. */
const char **targetNamePtr, /* (Return) name of target command. */
|
| ︙ | |||
1493 1494 1495 1496 1497 1498 1499 | 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 | - + |
Tcl_Interp *interp, /* Interp for error reporting. */
Tcl_Interp *slaveInterp, /* Interp where alias cmd will live or from
* which alias will be deleted. */
Tcl_Interp *masterInterp, /* Interp in which target command will be
* invoked. */
Tcl_Obj *namePtr, /* Name of alias cmd. */
Tcl_Obj *targetNamePtr, /* Name of target cmd. */
|
| ︙ | |||
1788 1789 1790 1791 1792 1793 1794 | 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 | - + |
*----------------------------------------------------------------------
*/
static int
AliasNRCmd(
ClientData clientData, /* Alias record. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1852 1853 1854 1855 1856 1857 1858 | 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 | - + |
return Tcl_NREvalObj(interp, listPtr, flags);
}
static int
AliasObjCmd(
ClientData clientData, /* Alias record. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2035 2036 2037 2038 2039 2040 2041 | 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 | - + |
Tcl_Interp *interp, /* Interpreter to start search at. */
const char *slavePath, /* Name of slave to create. */
int isSafe) /* Should new slave be "safe" ? */
{
Tcl_Obj *pathPtr;
Tcl_Interp *slaveInterp;
|
| ︙ | |||
2066 2067 2068 2069 2070 2071 2072 | 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 | - + |
Tcl_GetSlave(
Tcl_Interp *interp, /* Interpreter to start search from. */
const char *slavePath) /* Path of slave to find. */
{
Tcl_Obj *pathPtr;
Tcl_Interp *slaveInterp;
|
| ︙ | |||
2212 2213 2214 2215 2216 2217 2218 | 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 | - + |
}
iiPtr = (InterpInfo *) ((Interp *) targetInterp)->interpInfo;
if (Tcl_GetInterpPath(askingInterp, iiPtr->slave.masterInterp) != TCL_OK){
return TCL_ERROR;
}
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(askingInterp),
Tcl_NewStringObj(Tcl_GetHashKey(&iiPtr->master.slaveTable,
|
| ︙ | |||
2242 2243 2244 2245 2246 2247 2248 | 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 | - + |
Tcl_Interp *interp, /* Interp. to start search from. */
Tcl_Obj *pathPtr) /* List object containing name of interp. to
* be found. */
{
Tcl_HashEntry *hPtr; /* Search element. */
Slave *slavePtr; /* Interim slave record. */
Tcl_Obj **objv;
|
| ︙ | |||
2296 2297 2298 2299 2300 2301 2302 | 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
SlaveBgerror(
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *slaveInterp, /* Interp in which limit is set/queried. */
|
| ︙ | |||
2346 2347 2348 2349 2350 2351 2352 | 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 | - + + |
int safe) /* Should we make it "safe"? */
{
Tcl_Interp *masterInterp, *slaveInterp;
Slave *slavePtr;
InterpInfo *masterInfoPtr;
Tcl_HashEntry *hPtr;
const char *path;
|
| ︙ | |||
2472 2473 2474 2475 2476 2477 2478 | 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 | - + - + |
*----------------------------------------------------------------------
*/
static int
SlaveObjCmd(
ClientData clientData, /* Slave interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2733 2734 2735 2736 2737 2738 2739 | 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 | - + - + |
*/
static int
SlaveDebugCmd(
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *slaveInterp, /* The slave interpreter in which command
* will be evaluated. */
|
| ︙ | |||
2804 2805 2806 2807 2808 2809 2810 | 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 | - + |
*/
static int
SlaveEval(
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *slaveInterp, /* The slave interpreter in which command
* will be evaluated. */
|
| ︙ | |||
2867 2868 2869 2870 2871 2872 2873 | 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 | - + - + |
*----------------------------------------------------------------------
*/
static int
SlaveExpose(
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *slaveInterp, /* Interp in which command will be exposed. */
|
| ︙ | |||
2911 2912 2913 2914 2915 2916 2917 | 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 | - + - + + - + - + |
*----------------------------------------------------------------------
*/
static int
SlaveRecursionLimit(
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *slaveInterp, /* Interp in which limit is set/queried. */
|
| ︙ | |||
2973 2974 2975 2976 2977 2978 2979 | 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 | - + - + |
*----------------------------------------------------------------------
*/
static int
SlaveHide(
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *slaveInterp, /* Interp in which command will be exposed. */
|
| ︙ | |||
3027 3028 3029 3030 3031 3032 3033 | 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 | - - + + |
Tcl_HashSearch hSearch; /* For local searches. */
hTblPtr = ((Interp *) slaveInterp)->hiddenCmdTablePtr;
if (hTblPtr != NULL) {
for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch);
hPtr != NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
|
| ︙ | |||
3057 3058 3059 3060 3061 3062 3063 | 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 | - + - + |
static int
SlaveInvokeHidden(
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *slaveInterp, /* The slave interpreter in which command will
* be invoked. */
const char *namespaceName, /* The namespace to use, if any. */
|
| ︙ | |||
3142 3143 3144 3145 3146 3147 3148 | 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 | - + |
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *slaveInterp) /* The slave interpreter which will be marked
* trusted. */
{
if (Tcl_IsSafe(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"permission denied: safe interpreter cannot mark trusted",
|
| ︙ | |||
3401 3402 3403 3404 3405 3406 3407 | 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 | - + |
iPtr->limit.exceeded |= TCL_LIMIT_COMMANDS;
Tcl_Preserve(interp);
RunLimitHandlers(iPtr->limit.cmdHandlers, interp);
if (iPtr->limit.cmdCount >= iPtr->cmdCount) {
iPtr->limit.exceeded &= ~TCL_LIMIT_COMMANDS;
} else if (iPtr->limit.exceeded & TCL_LIMIT_COMMANDS) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3427 3428 3429 3430 3431 3432 3433 | 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 | - + |
RunLimitHandlers(iPtr->limit.timeHandlers, interp);
if (iPtr->limit.time.sec > now.sec ||
(iPtr->limit.time.sec == now.sec &&
iPtr->limit.time.usec >= now.usec)) {
iPtr->limit.exceeded &= ~TCL_LIMIT_TIME;
} else if (iPtr->limit.exceeded & TCL_LIMIT_TIME) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
4409 4410 4411 4412 4413 4414 4415 | 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 | - - + + |
*----------------------------------------------------------------------
*/
static int
SlaveCommandLimitCmd(
Tcl_Interp *interp, /* Current interpreter. */
Tcl_Interp *slaveInterp, /* Interpreter being adjusted. */
|
| ︙ | |||
4434 4435 4436 4437 4438 4439 4440 | 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 | - + - + + - + - + + - + - + + - + |
* interpreter's limits; it may only manipulate its children. Note that
* the low level API enforces this with Tcl_Panic, which we want to
* avoid. [Bug 3398794]
*/
if (interp == slaveInterp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
4511 4512 4513 4514 4515 4516 4517 | 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 | - + - + - + + |
break;
}
return TCL_OK;
} else if ((objc-consumedObjc) & 1 /* isOdd(objc-consumedObjc) */) {
Tcl_WrongNumArgs(interp, consumedObjc, objv, "?-option value ...?");
return TCL_ERROR;
} else {
|
| ︙ | |||
4595 4596 4597 4598 4599 4600 4601 | 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 | - - - - - + + + + + | * Depends on the arguments. * *---------------------------------------------------------------------- */ static int SlaveTimeLimitCmd( |
| ︙ | |||
4622 4623 4624 4625 4626 4627 4628 | 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 | - + - + + - + - + + - + - + + - + + - + - + |
* interpreter's limits; it may only manipulate its children. Note that
* the low level API enforces this with Tcl_Panic, which we want to
* avoid. [Bug 3398794]
*/
if (interp == slaveInterp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
4716 4717 4718 4719 4720 4721 4722 | 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 | - + |
break;
}
return TCL_OK;
} else if ((objc-consumedObjc) & 1 /* isOdd(objc-consumedObjc) */) {
Tcl_WrongNumArgs(interp, consumedObjc, objv, "?-option value ...?");
return TCL_ERROR;
} else {
|
| ︙ | |||
4741 4742 4743 4744 4745 4746 4747 | 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 | - + - + - + - + - + |
case OPT_GRAN:
granObj = objv[i+1];
if (TclGetIntFromObj(interp, objv[i+1], &gran) != TCL_OK) {
return TCL_ERROR;
}
if (gran < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ |
Changes to generic/tclLink.c.
| ︙ | |||
118 119 120 121 122 123 124 | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | - + |
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"variable '%s' is already linked", varName));
return TCL_ERROR;
}
linkPtr = ckalloc(sizeof(Link));
linkPtr->interp = interp;
|
| ︙ | |||
255 256 257 258 259 260 261 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | - + + |
ClientData clientData, /* Contains information about the link. */
Tcl_Interp *interp, /* Interpreter containing Tcl variable. */
const char *name1, /* First part of variable name. */
const char *name2, /* Second part of variable name. */
int flags) /* Miscellaneous additional information. */
{
Link *linkPtr = clientData;
|
| ︙ | |||
610 611 612 613 614 615 616 | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | - + |
return Tcl_NewWideIntObj((Tcl_WideInt) linkPtr->lastValue.uw);
case TCL_LINK_STRING:
p = LinkedVar(char *);
if (p == NULL) {
TclNewLiteralStringObj(resultObj, "NULL");
return resultObj;
}
|
| ︙ |
Changes to generic/tclListObj.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + - + + | #include "tclInt.h" /* * Prototypes for functions defined later in this file: */ |
| ︙ | |||
71 72 73 74 75 76 77 | 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 | - + - + - + | * resulting list now refers to them. * *---------------------------------------------------------------------- */ static List * NewListIntRep( |
| ︙ | |||
111 112 113 114 115 116 117 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - + |
listRepPtr->canonicalFlag = 0;
listRepPtr->refCount = 0;
listRepPtr->maxElemCount = objc;
if (objv) {
Tcl_Obj **elemPtrs;
|
| ︙ | |||
150 151 152 153 154 155 156 | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | - + |
*
*----------------------------------------------------------------------
*/
static List *
AttemptNewList(
Tcl_Interp *interp,
|
| ︙ | |||
201 202 203 204 205 206 207 | 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 | - + - + | */ #ifdef TCL_MEM_DEBUG #undef Tcl_NewListObj Tcl_Obj * Tcl_NewListObj( |
| ︙ | |||
272 273 274 275 276 277 278 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | - + | *---------------------------------------------------------------------- */ #ifdef TCL_MEM_DEBUG Tcl_Obj * Tcl_DbNewListObj( |
| ︙ | |||
308 309 310 311 312 313 314 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | - + |
return listPtr;
}
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_DbNewListObj(
|
| ︙ | |||
344 345 346 347 348 349 350 | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_SetListObj(
Tcl_Obj *objPtr, /* Object whose internal rep to init. */
|
| ︙ | |||
451 452 453 454 455 456 457 | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | - + |
*/
int
Tcl_ListObjGetElements(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
register Tcl_Obj *listPtr, /* List object for which an element array is
* to be returned. */
|
| ︙ | |||
506 507 508 509 510 511 512 | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | - + |
int
Tcl_ListObjAppendList(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
register Tcl_Obj *listPtr, /* List object to append elements to. */
Tcl_Obj *elemListPtr) /* List obj with elements to append. */
{
|
| ︙ | |||
563 564 565 566 567 568 569 | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | - + + - - |
int
Tcl_ListObjAppendElement(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *listPtr, /* List object to append objPtr to. */
Tcl_Obj *objPtr) /* Object to append to listPtr's list. */
{
register List *listRepPtr, *newPtr = NULL;
|
| ︙ | |||
727 728 729 730 731 732 733 | 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 | - + - - - + + - + |
*----------------------------------------------------------------------
*/
int
Tcl_ListObjIndex(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
register Tcl_Obj *listPtr, /* List object to index into. */
|
| ︙ | |||
781 782 783 784 785 786 787 | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | - + - - - + + |
*----------------------------------------------------------------------
*/
int
Tcl_ListObjLength(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
register Tcl_Obj *listPtr, /* List object whose #elements to return. */
|
| ︙ | |||
845 846 847 848 849 850 851 | 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | - - - + + + - + + |
*----------------------------------------------------------------------
*/
int
Tcl_ListObjReplace(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
Tcl_Obj *listPtr, /* List object whose elements to replace. */
|
| ︙ | |||
910 911 912 913 914 915 916 | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | - + - + - + - - + + - - + |
numRequired = numElems - count + objc;
for (i = 0; i < objc; i++) {
Tcl_IncrRefCount(objv[i]);
}
if ((numRequired <= listRepPtr->maxElemCount) && !isShared) {
|
| ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | - + |
oldListRepPtr->refCount--;
} else {
/*
* The old struct will be removed; use its inherited refCounts.
*/
if (first > 0) {
|
| ︙ | |||
1023 1024 1025 1026 1027 1028 1029 | 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | - + |
* new locations.
*/
start = first + count;
numAfterLast = numElems - start;
if (numAfterLast > 0) {
memcpy(elemPtrs + first + objc, oldPtrs + start,
|
| ︙ | |||
1084 1085 1086 1087 1088 1089 1090 | 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 | - - + - + |
Tcl_Obj *
TclLindexList(
Tcl_Interp *interp, /* Tcl interpreter. */
Tcl_Obj *listPtr, /* List being unpacked. */
Tcl_Obj *argPtr) /* Index or index list. */
{
|
| ︙ | |||
1131 1132 1133 1134 1135 1136 1137 | 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 | - + |
if (indexListCopy->typePtr == &tclListType) {
List *listRepPtr = ListRepPtr(indexListCopy);
listPtr = TclLindexFlat(interp, listPtr, listRepPtr->elemCount,
&listRepPtr->elements);
} else {
|
| ︙ | |||
1172 1173 1174 1175 1176 1177 1178 | 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | - + + - + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclLindexFlat(
Tcl_Interp *interp, /* Tcl interpreter. */
Tcl_Obj *listPtr, /* Tcl object representing the list. */
|
| ︙ | |||
1267 1268 1269 1270 1271 1272 1273 | 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | - + - + |
Tcl_Obj *
TclLsetList(
Tcl_Interp *interp, /* Tcl interpreter. */
Tcl_Obj *listPtr, /* Pointer to the list being modified. */
Tcl_Obj *indexArgPtr, /* Index or index-list arg to 'lset'. */
Tcl_Obj *valuePtr) /* Value arg to 'lset'. */
{
|
| ︙ | |||
1357 1358 1359 1360 1361 1362 1363 | 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | - + + - + + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclLsetFlat(
Tcl_Interp *interp, /* Tcl interpreter. */
Tcl_Obj *listPtr, /* Pointer to the list being modified. */
|
| ︙ | |||
1403 1404 1405 1406 1407 1408 1409 | 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | - + |
/*
* Loop through all the index arguments, and for each one dive into the
* appropriate sublist.
*/
do {
|
| ︙ | |||
1435 1436 1437 1438 1439 1440 1441 | 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | - + + |
}
indexArray++;
if (index < 0 || index > elemCount) {
/* ...the index points outside the sublist. */
if (interp != NULL) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
1544 1545 1546 1547 1548 1549 1550 | 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 | - + |
/*
* Store valuePtr in proper sublist and return. The -1 is to avoid a
* compiler warning (not a problem because we checked that we have a
* proper list - or something convertible to one - above).
*/
|
| ︙ | |||
1591 1592 1593 1594 1595 1596 1597 | 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 | - + |
int
TclListObjSetElement(
Tcl_Interp *interp, /* Tcl interpreter; used for error reporting
* if not NULL. */
Tcl_Obj *listPtr, /* List object in which element should be
* stored. */
|
| ︙ | |||
1613 1614 1615 1616 1617 1618 1619 | 1614 1615 1616 1617 1618 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 1646 1647 1648 1649 1650 1651 | - + + - + - + |
}
if (listPtr->typePtr != &tclListType) {
int result;
if (listPtr->bytes == tclEmptyStringRep) {
if (interp != NULL) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
1720 1721 1722 1723 1724 1725 1726 | 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 | - + |
FreeListInternalRep(
Tcl_Obj *listPtr) /* List object with internal rep to free. */
{
List *listRepPtr = ListRepPtr(listPtr);
if (--listRepPtr->refCount <= 0) {
Tcl_Obj **elemPtrs = &listRepPtr->elements;
|
| ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 | - + + |
* there is, it is the string rep that's authoritative (because it could
* describe duplicate keys).
*/
if (objPtr->typePtr == &tclDictType && !objPtr->bytes) {
Tcl_Obj *keyPtr, *valuePtr;
Tcl_DictSearch search;
|
| ︙ | |||
1828 1829 1830 1831 1832 1833 1834 | 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 | - + |
*elemPtrs++ = keyPtr;
*elemPtrs++ = valuePtr;
Tcl_IncrRefCount(keyPtr);
Tcl_IncrRefCount(valuePtr);
Tcl_DictObjNext(&search, &keyPtr, &valuePtr, &done);
}
} else {
|
| ︙ | |||
1851 1852 1853 1854 1855 1856 1857 | 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 | + - + |
/*
* Each iteration, parse and store a list element.
*/
while (nextElem < limit) {
const char *elemStart;
size_t elemSize;
|
| ︙ | |||
1920 1921 1922 1923 1924 1925 1926 | 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 | - - + + |
static void
UpdateStringOfList(
Tcl_Obj *listPtr) /* List object with string rep to update. */
{
# define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
List *listRepPtr = ListRepPtr(listPtr);
|
| ︙ |
Changes to generic/tclLiteral.c.
| ︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | /* * Function prototypes for static functions in this file: */ static int AddLocalLiteralEntry(CompileEnv *envPtr, Tcl_Obj *objPtr, int localHash); static void ExpandLocalLiteralArray(CompileEnv *envPtr); |
| ︙ | |||
172 173 174 175 176 177 178 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | - - - + + + |
*/
Tcl_Obj *
TclCreateLiteral(
Interp *iPtr,
char *bytes, /* The start of the string. Note that this is
* not a NUL-terminated string. */
|
| ︙ | |||
471 472 473 474 475 476 477 | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | + - + |
* that was previously created by a call to
* TclRegisterLiteral. */
{
Interp *iPtr = (Interp *) interp;
LiteralTable *globalTablePtr = &iPtr->literalTable;
register LiteralEntry *entryPtr;
const char *bytes;
size_t length;
|
| ︙ | |||
516 517 518 519 520 521 522 | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | - + + |
register CompileEnv *envPtr,/* Points to CompileEnv whose literal array
* contains the entry being hidden. */
int index) /* The index of the entry in the literal
* array. */
{
LiteralEntry **nextPtrPtr, *entryPtr, *lPtr;
LiteralTable *localTablePtr = &envPtr->localLitTable;
|
| ︙ | |||
653 654 655 656 657 658 659 | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | + - + |
RebuildLiteralTable(localTablePtr);
}
#ifdef TCL_COMPILE_DEBUG
TclVerifyLocalLiteralTable(envPtr);
{
char *bytes;
size_t length;
|
| ︙ | |||
782 783 784 785 786 787 788 | 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 | - + + - - + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - + - + - - + + - |
* previously created by a call to
* TclRegisterLiteral. */
{
Interp *iPtr = (Interp *) interp;
LiteralTable *globalTablePtr;
register LiteralEntry *entryPtr, *prevPtr;
const char *bytes;
|
| ︙ | |||
855 856 857 858 859 860 861 | 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | - - + + | * None. * *---------------------------------------------------------------------- */ static unsigned HashString( |
| ︙ | |||
927 928 929 930 931 932 933 | 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | - + + |
/* Local or global table to enlarge. */
{
LiteralEntry **oldBuckets;
register LiteralEntry **oldChainPtr, **newChainPtr;
register LiteralEntry *entryPtr;
LiteralEntry **bucketPtr;
const char *bytes;
|
| ︙ |
Changes to generic/tclLoad.c.
| ︙ | |||
113 114 115 116 117 118 119 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_LoadObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
179 180 181 182 183 184 185 | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | - + |
packageName = Tcl_GetString(objv[2]);
if (packageName[0] == '\0') {
packageName = NULL;
}
}
if ((fullFileName[0] == 0) && (packageName == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
219 220 221 222 223 224 225 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - + - + |
defaultPtr = NULL;
for (pkgPtr = firstPackagePtr; pkgPtr != NULL; pkgPtr = pkgPtr->nextPtr) {
if (packageName == NULL) {
namesMatch = 0;
} else {
TclDStringClear(&pkgName);
|
| ︙ | |||
296 297 298 299 300 301 302 | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | - + - + - + |
}
/*
* Figure out the module name if it wasn't provided explicitly.
*/
if (packageName != NULL) {
|
| ︙ | |||
466 467 468 469 470 471 472 473 474 475 476 477 478 | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | + + - + + |
/*
* Test for whether the initialization failed. If so, transfer the error
* from the target interpreter to the originating one.
*/
if (code != TCL_OK) {
Interp *iPtr = (Interp *) target;
if (iPtr->legacyResult && !iPtr->legacyFreeProc) {
/*
* A call to Tcl_InitStubs() determined the caller extension and
* this interp are incompatible in their stubs mechanisms, and
* recorded the error in the oldest legacy place we have to do so.
*/
|
| ︙ | |||
537 538 539 540 541 542 543 | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_UnloadObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
612 613 614 615 616 617 618 | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | - + |
packageName = Tcl_GetString(objv[i+1]);
if (packageName[0] == '\0') {
packageName = NULL;
}
}
if ((fullFileName[0] == 0) && (packageName == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
653 654 655 656 657 658 659 | 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | - + - + |
for (pkgPtr = firstPackagePtr; pkgPtr != NULL; pkgPtr = pkgPtr->nextPtr) {
int namesMatch, filesMatch;
if (packageName == NULL) {
namesMatch = 0;
} else {
TclDStringClear(&pkgName);
|
| ︙ | |||
1059 1060 1061 1062 1063 1064 1065 | 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 | - - + + |
* Return information about all of the available packages.
*/
resultObj = Tcl_NewObj();
Tcl_MutexLock(&packageMutex);
for (pkgPtr = firstPackagePtr; pkgPtr != NULL;
pkgPtr = pkgPtr->nextPtr) {
|
| ︙ | |||
1082 1083 1084 1085 1086 1087 1088 | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | - - + + |
if (target == NULL) {
return TCL_ERROR;
}
ipPtr = Tcl_GetAssocData(target, "tclLoad", NULL);
resultObj = Tcl_NewObj();
for (; ipPtr != NULL; ipPtr = ipPtr->nextPtr) {
pkgPtr = ipPtr->pkgPtr;
|
| ︙ |
Changes to generic/tclLoadNone.c.
| ︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + |
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
int flags)
{
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"dynamic loading is not currently available on this system",
|
| ︙ |
Changes to generic/tclMain.c.
| ︙ | |||
61 62 63 64 65 66 67 | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | - + |
#ifdef UNICODE
# define NewNativeObj Tcl_NewUnicodeObj
#else /* !UNICODE */
static inline Tcl_Obj *
NewNativeObj(
char *string,
|
| ︙ | |||
155 156 157 158 159 160 161 | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | - + |
Tcl_Obj *path, /* Filesystem path of startup script file */
const char *encoding) /* Encoding of the data in that file */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
Tcl_Obj *newEncoding = NULL;
if (encoding != NULL) {
|
| ︙ | |||
338 339 340 341 342 343 344 | 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 | - - + + - + - + - + + - + + |
* -encoding ENCODING FILENAME
* or like
* FILENAME
*/
if ((argc > 3) && (0 == _tcscmp(TEXT("-encoding"), argv[1]))
&& ('-' != argv[3][0])) {
|
| ︙ | |||
464 465 466 467 468 469 470 | 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 | + - + - - + + |
*/
Tcl_LinkVar(interp, "tcl_interactive", (char *) &is.tty, TCL_LINK_BOOLEAN);
is.input = Tcl_GetStdChannel(TCL_STDIN);
while ((is.input != NULL) && !Tcl_InterpDeleted(interp)) {
mainLoopProc = TclGetMainLoop();
if (mainLoopProc == NULL) {
ssize_t inputLength;
|
| ︙ | |||
529 530 531 532 533 534 535 | 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 | - - + + - + - + | is.prompt = PROMPT_START; /* * The final newline is syntactically redundant, and causes some * error messages troubles deeper in, so lop it back off. */ |
| ︙ | |||
750 751 752 753 754 755 756 | 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 | - + + + - - + + |
/* ARGSUSED */
static void
StdinProc(
ClientData clientData, /* The state of interactive cmd line */
int mask) /* Not used. */
{
|
| ︙ | |||
790 791 792 793 794 795 796 | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | - - + + |
}
Tcl_AppendToObj(commandPtr, "\n", 1);
if (!TclObjCommandComplete(commandPtr)) {
isPtr->prompt = PROMPT_CONTINUE;
goto prompt;
}
isPtr->prompt = PROMPT_START;
|
| ︙ | |||
821 822 823 824 825 826 827 | 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | - - + + |
Tcl_WriteChars(chan, "\n", 1);
}
} else if (isPtr->tty) {
Tcl_Obj *resultPtr = Tcl_GetObjResult(interp);
chan = Tcl_GetStdChannel(TCL_STDOUT);
Tcl_IncrRefCount(resultPtr);
|
| ︙ |
Changes to generic/tclNamesp.c.
| ︙ | |||
85 86 87 88 89 90 91 | 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 112 113 114 115 116 117 118 119 120 121 | - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - | const char *name2, int flags); static char * EstablishErrorInfoTraces(ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void FreeNsNameInternalRep(Tcl_Obj *objPtr); static int GetNamespaceFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr); |
| ︙ | |||
667 668 669 670 671 672 673 | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | - + + |
register Namespace *nsPtr, *ancestorPtr;
Namespace *parentPtr, *dummy1Ptr, *dummy2Ptr;
Namespace *globalNsPtr = iPtr->globalNsPtr;
const char *simpleName;
Tcl_HashEntry *entryPtr;
Tcl_DString buffer1, buffer2;
Tcl_DString *namePtr, *buffPtr;
|
| ︙ | |||
697 698 699 700 701 702 703 | 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 707 708 | - + - + + |
* Ensure that there are no trailing colons as that causes chaos when a
* deleteProc is specified. [Bug d614d63989]
*/
if (deleteProc != NULL) {
nameStr = name + strlen(name) - 2;
if (nameStr >= name && nameStr[1] == ':' && nameStr[0] == ':') {
|
| ︙ | |||
832 833 834 835 836 837 838 | 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | - + |
buffPtr = &buffer2;
for (ancestorPtr = nsPtr; ancestorPtr != NULL;
ancestorPtr = ancestorPtr->parentPtr) {
if (ancestorPtr != globalNsPtr) {
register Tcl_DString *tempPtr = namePtr;
TclDStringAppendLiteral(buffPtr, "::");
|
| ︙ | |||
1471 1472 1473 1474 1475 1476 1477 | 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 | - + |
/*
* Append the export pattern list onto objPtr.
*/
for (i = 0; i < nsPtr->numExportPatterns; i++) {
result = Tcl_ListObjAppendElement(interp, objPtr,
|
| ︙ | |||
1550 1551 1552 1553 1554 1555 1556 | 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 | - + - + + |
*/
if (Tcl_FindCommand(interp,"auto_import",NULL,TCL_GLOBAL_ONLY) != NULL) {
Tcl_Obj *objv[2];
int result;
TclNewLiteralStringObj(objv[0], "auto_import");
|
| ︙ | |||
1691 1692 1693 1694 1695 1696 1697 | 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 | - + - + | Tcl_DString ds; Tcl_Command importedCmd; ImportedCmdData *dataPtr; Command *cmdPtr; ImportRef *refPtr; Tcl_DStringInit(&ds); |
| ︙ | |||
1966 1967 1968 1969 1970 1971 1972 | 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 | - + - + |
*/
static int
InvokeImportedNRCmd(
ClientData clientData, /* Points to the imported command's
* ImportedCmdData structure. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2901 2902 2903 2904 2905 2906 2907 | 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceChildrenCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2940 2941 2942 2943 2944 2945 2946 | 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 | - + - + |
Tcl_DStringInit(&buffer);
if (objc == 3) {
const char *name = TclGetString(objv[2]);
if ((*name == ':') && (*(name+1) == ':')) {
pattern = name;
} else {
|
| ︙ | |||
2970 2971 2972 2973 2974 2975 2976 | 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 | - + - + |
Tcl_FindHashEntry(&nsPtr->childTable, pattern+length) != NULL
#else
nsPtr->childTablePtr != NULL &&
Tcl_FindHashEntry(nsPtr->childTablePtr, pattern+length) != NULL
#endif
) {
Tcl_ListObjAppendElement(interp, listPtr,
|
| ︙ | |||
3030 3031 3032 3033 3034 3035 3036 | 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 | - - + + - + |
*----------------------------------------------------------------------
*/
static int
NamespaceCodeCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3076 3077 3078 3079 3080 3081 3082 | 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 | - + |
TclNewLiteralStringObj(objPtr, "inscope");
Tcl_ListObjAppendElement(interp, listPtr, objPtr);
currNsPtr = (Namespace *) TclGetCurrentNamespace(interp);
if (currNsPtr == (Namespace *) TclGetGlobalNamespace(interp)) {
TclNewLiteralStringObj(objPtr, "::");
} else {
|
| ︙ | |||
3111 3112 3113 3114 3115 3116 3117 | 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceCurrentCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3134 3135 3136 3137 3138 3139 3140 | 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 | - + + |
* namespace [namespace current]::bar { ... }
*/
currNsPtr = (Namespace *) TclGetCurrentNamespace(interp);
if (currNsPtr == (Namespace *) TclGetGlobalNamespace(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("::", 2));
} else {
|
| ︙ | |||
3174 3175 3176 3177 3178 3179 3180 | 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceDeleteCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3251 3252 3253 3254 3255 3256 3257 | 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 | - - + + - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceEvalCmd(
ClientData clientData, /* Arbitrary value passed to cmd. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3404 3405 3406 3407 3408 3409 3410 | 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceExistsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3459 3460 3461 3462 3463 3464 3465 | 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceExportCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3540 3541 3542 3543 3544 3545 3546 | 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceForgetCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3605 3606 3607 3608 3609 3610 3611 | 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceImportCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3647 3648 3649 3650 3651 3652 3653 | 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 | - + |
TclNewObj(listPtr);
for (hPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Command *cmdPtr = Tcl_GetHashValue(hPtr);
if (cmdPtr->deleteProc == DeleteImportedCmd) {
Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj(
|
| ︙ | |||
3709 3710 3711 3712 3713 3714 3715 | 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 | - - + + - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceInscopeCmd(
ClientData clientData, /* Arbitrary value passed to cmd. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3828 3829 3830 3831 3832 3833 3834 | 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceOriginCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3889 3890 3891 3892 3893 3894 3895 | 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 | - - + + - + |
*----------------------------------------------------------------------
*/
static int
NamespaceParentCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3947 3948 3949 3950 3951 3952 3953 | 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 | - - + + - + + - + + |
*----------------------------------------------------------------------
*/
static int
NamespacePathCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4033 4034 4035 4036 4037 4038 4039 | 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 | - + |
*
*----------------------------------------------------------------------
*/
void
TclSetNsPath(
Namespace *nsPtr, /* Namespace whose path is to be set. */
|
| ︙ | |||
4172 4173 4174 4175 4176 4177 4178 | 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceQualifiersCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4240 4241 4242 4243 4244 4245 4246 | 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceUnknownCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4341 4342 4343 4344 4345 4346 4347 | 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 | - + |
int
Tcl_SetNamespaceUnknownHandler(
Tcl_Interp *interp, /* Interpreter in which the namespace
* exists. */
Tcl_Namespace *nsPtr, /* Namespace which is being updated. */
Tcl_Obj *handlerPtr) /* The new handler, or NULL to reset. */
{
|
| ︙ | |||
4427 4428 4429 4430 4431 4432 4433 | 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceTailCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4454 4455 4456 4457 4458 4459 4460 | 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 | - + |
if ((*p == ':') && (*(p-1) == ':')) {
p++; /* Just after the last "::" */
break;
}
}
if (p >= name) {
|
| ︙ | |||
4485 4486 4487 4488 4489 4490 4491 | 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceUpvarCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4559 4560 4561 4562 4563 4564 4565 | 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 | - - + + |
*----------------------------------------------------------------------
*/
static int
NamespaceWhichCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4847 4848 4849 4850 4851 4852 4853 | 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 | - - + + + |
void
TclLogCommandInfo(
Tcl_Interp *interp, /* Interpreter in which to log information. */
const char *script, /* First character in script containing
* command (must be <= command). */
const char *command, /* First character in command that generated
* the error. */
|
| ︙ | |||
4879 4880 4881 4882 4883 4884 4885 | 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 | - + - + |
iPtr->errorLine = 1;
for (p = script; p != command; p++) {
if (*p == '\n') {
iPtr->errorLine++;
}
}
|
| ︙ | |||
4932 4933 4934 4935 4936 4937 4938 | 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 | - + |
newObj = Tcl_DuplicateObj(iPtr->errorStack);
Tcl_DecrRefCount(iPtr->errorStack);
Tcl_IncrRefCount(newObj);
iPtr->errorStack = newObj;
}
if (iPtr->resetErrorStack) {
|
| ︙ | |||
5004 5005 5006 5007 5008 5009 5010 | 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 | - + - + |
*----------------------------------------------------------------------
*/
void
TclErrorStackResetIf(
Tcl_Interp *interp,
const char *msg,
|
| ︙ | |||
5059 5060 5061 5062 5063 5064 5065 | 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 | - - + + + - |
void
Tcl_LogCommandInfo(
Tcl_Interp *interp, /* Interpreter in which to log information. */
const char *script, /* First character in script containing
* command (must be <= command). */
const char *command, /* First character in command that generated
* the error. */
|
Changes to generic/tclOO.c.
| ︙ | |||
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 100 101 102 103 104 | - + - + - + - + | Tcl_Interp *interp, const char *oldName, const char *newName, int flags); static void ReleaseClassContents(Tcl_Interp *interp,Object *oPtr); static inline void SquelchCachedName(Object *oPtr); static void SquelchedNsFirst(ClientData clientData); static int PublicObjectCmd(ClientData clientData, |
| ︙ | |||
355 356 357 358 359 360 361 | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | - + - + |
/*
* Create the subcommands in the oo::define and oo::objdefine spaces.
*/
Tcl_DStringInit(&buffer);
for (i=0 ; defineCmds[i].name ; i++) {
TclDStringAppendLiteral(&buffer, "::oo::define::");
|
| ︙ | |||
411 412 413 414 415 416 417 | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | - + |
/*
* Create the default <cloned> method implementation, used when 'oo::copy'
* is called to finish the copying of one object to another.
*/
TclNewLiteralStringObj(argsPtr, "originObject");
Tcl_IncrRefCount(argsPtr);
|
| ︙ | |||
655 656 657 658 659 660 661 | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | - + - + |
oPtr->command = Tcl_CreateObjCommand(interp, nameStr,
PublicObjectCmd, oPtr, NULL);
} else {
Tcl_DString buffer;
Tcl_DStringInit(&buffer);
Tcl_DStringAppend(&buffer,
|
| ︙ | |||
1563 1564 1565 1566 1567 1568 1569 | 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 | - - + + - + |
Tcl_Interp *interp, /* Interpreter context. */
Tcl_Class cls, /* Class to create an instance of. */
const char *nameStr, /* Name of object to create, or NULL to ask
* the code to pick its own unique name. */
const char *nsNameStr, /* Name of namespace to create inside object,
* or NULL to ask the code to pick its own
* unique name. */
|
| ︙ | |||
1614 1615 1616 1617 1618 1619 1620 | 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 | - - + + - + |
AllocClass(interp, oPtr);
oPtr->selfCls = classPtr;
TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls);
}
/*
|
| ︙ | |||
1649 1650 1651 1652 1653 1654 1655 | 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 | - + |
* It's an error if the object was whacked in the constructor.
* Force this if it isn't already an error (don't want to lose
* errors by accident...) [Bug 2903011]
*/
if (result != TCL_ERROR && Deleted(oPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1683 1684 1685 1686 1687 1688 1689 | 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 | - - + + - + |
Tcl_Interp *interp, /* Interpreter context. */
Tcl_Class cls, /* Class to create an instance of. */
const char *nameStr, /* Name of object to create, or NULL to ask
* the code to pick its own unique name. */
const char *nsNameStr, /* Name of namespace to create inside object,
* or NULL to ask the code to pick its own
* unique name. */
|
| ︙ | |||
1738 1739 1740 1741 1742 1743 1744 | 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 | - - + + + - + |
AllocClass(interp, oPtr);
oPtr->selfCls = classPtr;
TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls);
}
/*
|
| ︙ | |||
1795 1796 1797 1798 1799 1800 1801 | 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 | - + |
* It's an error if the object was whacked in the constructor. Force this
* if it isn't already an error (don't want to lose errors by accident...)
* [Bug 2903011]
*/
if (result != TCL_ERROR && Deleted(oPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1853 1854 1855 1856 1857 1858 1859 | 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 | - + - - + + |
/*
* Sanity check.
*/
if (IsRootClass(oPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2378 2379 2380 2381 2382 2383 2384 | 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 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 | - + - + - + - + - + |
* ----------------------------------------------------------------------
*/
static int
PublicObjectCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
2462 2463 2464 2465 2466 2467 2468 | 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 | - + |
* ----------------------------------------------------------------------
*/
int
TclOOObjectCmdCore(
Object *oPtr, /* The object being invoked. */
Tcl_Interp *interp, /* The interpreter containing the object. */
|
| ︙ | |||
2561 2562 2563 2564 2565 2566 2567 | 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 | - + |
}
if (miPtr->mPtr->declaringClassPtr == startCls) {
break;
}
}
if (contextPtr->index >= contextPtr->callPtr->numChain) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2611 2612 2613 2614 2615 2616 2617 | 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 | - + - + |
* ----------------------------------------------------------------------
*/
int
Tcl_ObjectContextInvokeNext(
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2683 2684 2685 2686 2687 2688 2689 | 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 | - + - + |
return result;
}
int
TclNRObjectContextInvokeNext(
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2905 2906 2907 2908 2909 2910 2911 | 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 | - + |
Tcl_Object
Tcl_ObjectContextObject(
Tcl_ObjectContext context)
{
return (Tcl_Object) ((CallContext *)context)->oPtr;
}
|
| ︙ |
Changes to generic/tclOO.decls.
| ︙ | |||
52 53 54 55 56 57 58 | 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 | - - + + - + - - + + |
declare 12 {
Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
Tcl_Obj *nameObj, int isPublic, const Tcl_MethodType *typePtr,
ClientData clientData)
}
declare 13 {
Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp, Tcl_Class cls,
|
| ︙ | |||
143 144 145 146 147 148 149 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | - + |
}
declare 4 {
Method *TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
ProcedureMethod **pmPtrPtr)
}
declare 5 {
|
| ︙ | |||
173 174 175 176 177 178 179 | 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 | - + - + - + - + - + |
TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr,
ProcErrorProc *errProc, ClientData clientData, Tcl_Obj *nameObj,
Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags,
void **internalTokenPtr)
}
declare 11 {
int TclOOInvokeObject(Tcl_Interp *interp, Tcl_Object object,
|
Changes to generic/tclOO.h.
| ︙ | |||
54 55 56 57 58 59 60 | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - + | /* * Public datatypes for callbacks and structures used in the TIP#257 (OO) * implementation. These are used to implement custom types of method calls * and to allow the attachment of arbitrary data to objects and classes. */ typedef int (Tcl_MethodCallProc)(ClientData clientData, Tcl_Interp *interp, |
| ︙ |
Changes to generic/tclOOBasic.c.
| ︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - + |
*/
int
TclOO_Class_Constructor(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - + - + |
int
TclOO_Class_Create(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
|
| ︙ | |||
187 188 189 190 191 192 193 | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | - + |
"objectName ?arg ...?");
return TCL_ERROR;
}
objName = Tcl_GetStringFromObj(
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
218 219 220 221 222 223 224 | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | - + - + |
int
TclOO_Class_CreateNs(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
|
| ︙ | |||
252 253 254 255 256 257 258 | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - + - + |
"objectName namespaceName ?arg ...?");
return TCL_ERROR;
}
objName = Tcl_GetStringFromObj(
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
291 292 293 294 295 296 297 | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | - + |
int
TclOO_Class_New(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
|
| ︙ | |||
335 336 337 338 339 340 341 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | - + |
int
TclOO_Object_Destroy(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
|
| ︙ | |||
395 396 397 398 399 400 401 | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | - + |
int
TclOO_Object_Eval(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
|
| ︙ | |||
500 501 502 503 504 505 506 | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | - + - + |
int
TclOO_Object_Unknown(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
|
| ︙ | |||
551 552 553 554 555 556 557 | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | - + - + - + - + |
return TCL_ERROR;
}
errorMsg = Tcl_ObjPrintf("unknown method \"%s\": must be ",
TclGetString(objv[skip]));
for (i=0 ; i<numMethodNames-1 ; i++) {
if (i) {
|
| ︙ | |||
582 583 584 585 586 587 588 | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | - + - + |
int
TclOO_Object_LinkVar(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
|
| ︙ | |||
684 685 686 687 688 689 690 | 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | - + |
int
TclOO_Object_VarName(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
|
| ︙ | |||
747 748 749 750 751 752 753 | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | - + - + |
* WARNING! This code pokes inside the implementation of hash tables!
*/
hPtr = Tcl_FirstHashEntry((Tcl_HashTable *) aryVar->value.tablePtr,
&search);
while (hPtr != NULL) {
if (varPtr == Tcl_GetHashValue(hPtr)) {
|
| ︙ | |||
777 778 779 780 781 782 783 | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | - + |
* ----------------------------------------------------------------------
*/
int
TclOONextObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
813 814 815 816 817 818 819 | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 | - + - + |
return TclNRObjectContextInvokeNext(interp, context, objc, objv, 1);
}
int
TclOONextToObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
887 888 889 890 891 892 893 | 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | - + |
}
/*
* Generate an appropriate error message, depending on whether the value
* is on the chain but unreachable, or not on the chain at all.
*/
|
| ︙ | |||
934 935 936 937 938 939 940 | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | - + |
* ----------------------------------------------------------------------
*/
int
TclOOSelfObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
989 990 991 992 993 994 995 | 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 | - + - + - + - + - + - + |
switch ((enum SelfCmds) index) {
case SELF_OBJECT:
Tcl_SetObjResult(interp, TclOOObjectName(interp, contextPtr->oPtr));
return TCL_OK;
case SELF_NS:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1093 1094 1095 1096 1097 1098 1099 | 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 | - + - + |
declarerPtr = mPtr->declaringObjectPtr;
} else {
/*
* This should be unreachable code.
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1138 1139 1140 1141 1142 1143 1144 | 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 | - + |
declarerPtr = mPtr->declaringObjectPtr;
} else {
/*
* This should be unreachable code.
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1171 1172 1173 1174 1175 1176 1177 | 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | - + |
* ----------------------------------------------------------------------
*/
int
TclOOCopyObjectCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1207 1208 1209 1210 1211 1212 1213 | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 | - + - + |
name = TclGetString(objv[2]);
Tcl_DStringInit(&buffer);
if (name[0]!=':' || name[1]!=':') {
Interp *iPtr = (Interp *) interp;
if (iPtr->varFramePtr != NULL) {
Tcl_DStringAppend(&buffer,
|
| ︙ |
Changes to generic/tclOOCall.c.
| ︙ | |||
238 239 240 241 242 243 244 | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | - + |
int
TclOOInvokeContext(
ClientData clientData, /* The method call context. */
Tcl_Interp *interp, /* Interpreter for error reporting, and many
* other sorts of context handling (e.g.,
* commands, variables) depending on method
* implementation. */
|
| ︙ | |||
1422 1423 1424 1425 1426 1427 1428 | 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 | - + - + - + |
Foundation *fPtr = TclOOGetFoundation(interp);
int i;
/*
* Allocate the literals (potentially) used in our description.
*/
|
| ︙ | |||
1459 1460 1461 1462 1463 1464 1465 | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 | - + + | : callPtr->flags & DESTRUCTOR ? fPtr->destructorName : miPtr->mPtr->namePtr; descObjs[2] = miPtr->mPtr->declaringClassPtr ? Tcl_GetObjectName(interp, (Tcl_Object) miPtr->mPtr->declaringClassPtr->thisPtr) : objectLiteral; |
| ︙ |
Changes to generic/tclOODecls.h.
| ︙ | |||
48 49 50 51 52 53 54 | 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 | - - + + - + - - + + | TCLOOAPI Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls, Tcl_Obj *nameObj, int isPublic, const Tcl_MethodType *typePtr, ClientData clientData); /* 13 */ TCLOOAPI Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, |
| ︙ | |||
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 | - + - + - + |
Tcl_Class (*tcl_MethodDeclarerClass) (Tcl_Method method); /* 6 */
Tcl_Object (*tcl_MethodDeclarerObject) (Tcl_Method method); /* 7 */
int (*tcl_MethodIsPublic) (Tcl_Method method); /* 8 */
int (*tcl_MethodIsType) (Tcl_Method method, const Tcl_MethodType *typePtr, ClientData *clientDataPtr); /* 9 */
Tcl_Obj * (*tcl_MethodName) (Tcl_Method method); /* 10 */
Tcl_Method (*tcl_NewInstanceMethod) (Tcl_Interp *interp, Tcl_Object object, Tcl_Obj *nameObj, int isPublic, const Tcl_MethodType *typePtr, ClientData clientData); /* 11 */
Tcl_Method (*tcl_NewMethod) (Tcl_Interp *interp, Tcl_Class cls, Tcl_Obj *nameObj, int isPublic, const Tcl_MethodType *typePtr, ClientData clientData); /* 12 */
|
| ︙ |
Changes to generic/tclOODefineCmds.c.
| ︙ | |||
49 50 51 52 53 54 55 | 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 | - + - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - | Tcl_Namespace *const namespacePtr); static void GenerateErrorInfo(Tcl_Interp *interp, Object *oPtr, Tcl_Obj *savedNameObj, const char *typeOfSubject); static inline Class * GetClassInOuterContext(Tcl_Interp *interp, Tcl_Obj *className, const char *errMsg); static inline int InitDefineContext(Tcl_Interp *interp, Tcl_Namespace *namespacePtr, Object *oPtr, |
| ︙ | |||
190 191 192 193 194 195 196 | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | - + - + |
*
* ----------------------------------------------------------------------
*/
void
TclOOObjectSetFilters(
Object *oPtr,
|
| ︙ | |||
218 219 220 221 222 223 224 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - + |
RecomputeClassCacheFlag(oPtr);
} else {
/*
* We've got a list of filters, so we're creating filters.
*/
Tcl_Obj **filtersList;
|
| ︙ | |||
249 250 251 252 253 254 255 | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - + - + |
* ----------------------------------------------------------------------
*/
void
TclOOClassSetFilters(
Tcl_Interp *interp,
Class *classPtr,
|
| ︙ | |||
276 277 278 279 280 281 282 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | - + |
classPtr->filters.num = 0;
} else {
/*
* We've got a list of filters, so we're creating filters.
*/
Tcl_Obj **filtersList;
|
| ︙ | |||
310 311 312 313 314 315 316 | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | - + - + |
*
* ----------------------------------------------------------------------
*/
void
TclOOObjectSetMixins(
Object *oPtr,
|
| ︙ | |||
362 363 364 365 366 367 368 | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + - + |
* ----------------------------------------------------------------------
*/
void
TclOOClassSetMixins(
Tcl_Interp *interp,
Class *classPtr,
|
| ︙ | |||
435 436 437 438 439 440 441 | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | - + |
}
if (toPtr) {
newHPtr = Tcl_CreateHashEntry(oPtr->methodsPtr, (char *) toPtr,
&isNew);
if (hPtr == newHPtr) {
renameToSelf:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
500 501 502 503 504 505 506 | 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 | - + - + - + |
* ----------------------------------------------------------------------
*/
int
TclOOUnknownDefinition(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
544 545 546 547 548 549 550 | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | - + | /* * Got one match, and only one match! */ Tcl_Obj **newObjv = TclStackAlloc(interp, sizeof(Tcl_Obj*)*(objc-1)); int result; |
| ︙ | |||
578 579 580 581 582 583 584 | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | - + |
static Tcl_Command
FindCommand(
Tcl_Interp *interp,
Tcl_Obj *stringObj,
Tcl_Namespace *const namespacePtr)
{
|
| ︙ | |||
638 639 640 641 642 643 644 | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | - + - + |
*/
static inline int
InitDefineContext(
Tcl_Interp *interp,
Tcl_Namespace *namespacePtr,
Object *oPtr,
|
| ︙ | |||
687 688 689 690 691 692 693 | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | - + - + |
Interp *iPtr = (Interp *) interp;
Tcl_Object object;
if ((iPtr->varFramePtr == NULL)
|| (iPtr->varFramePtr->isProcCallFrame != FRAME_IS_OO_DEFINE)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"this command may only be called from within the context of"
|
| ︙ | |||
736 737 738 739 740 741 742 | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | - + |
}
oPtr = (Object *) Tcl_GetObjectFromObj(interp, className);
iPtr->varFramePtr = savedFramePtr;
if (oPtr == NULL) {
return NULL;
}
if (oPtr->classPtr == NULL) {
|
| ︙ | |||
769 770 771 772 773 774 775 | 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 783 784 785 | - + - + - + - + |
* current name (post-execution) has to be
* used. This matters, because the object
* could have been renamed... */
const char *typeOfSubject) /* Part of the message, saying whether it was
* an object, class or class-as-object that
* was being configured. */
{
|
| ︙ | |||
847 848 849 850 851 852 853 | 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 | - + - + |
GenerateErrorInfo(interp, oPtr, objNameObj, "class");
}
TclDecrRefCount(objNameObj);
} else {
Tcl_Obj *objPtr, *obj2Ptr, **objs;
Interp *iPtr = (Interp *) interp;
Tcl_Command cmd;
|
| ︙ | |||
920 921 922 923 924 925 926 | 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | - + |
* ----------------------------------------------------------------------
*/
int
TclOOObjDefObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
961 962 963 964 965 966 967 | 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 | - + - + |
GenerateErrorInfo(interp, oPtr, objNameObj, "object");
}
TclDecrRefCount(objNameObj);
} else {
Tcl_Obj *objPtr, *obj2Ptr, **objs;
Interp *iPtr = (Interp *) interp;
Tcl_Command cmd;
|
| ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineSelfObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1075 1076 1077 1078 1079 1080 1081 | 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 | - + - + |
GenerateErrorInfo(interp, oPtr, objNameObj, "class object");
}
TclDecrRefCount(objNameObj);
} else {
Tcl_Obj *objPtr, *obj2Ptr, **objs;
Interp *iPtr = (Interp *) interp;
Tcl_Command cmd;
|
| ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | 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 | - + - + + - + + |
* ----------------------------------------------------------------------
*/
int
TclOODefineClassObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1233 1234 1235 1236 1237 1238 1239 | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 | - + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineConstructorObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1301 1302 1303 1304 1305 1306 1307 | 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 | - + - + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineDeleteMethodObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1357 1358 1359 1360 1361 1362 1363 | 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 | - + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineDestructorObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1421 1422 1423 1424 1425 1426 1427 | 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 | - + - + + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineExportObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1515 1516 1517 1518 1519 1520 1521 | 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 1521 1522 1523 1524 | - + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineForwardObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1575 1576 1577 1578 1579 1580 1581 | 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 | - + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineMethodObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1632 1633 1634 1635 1636 1637 1638 | 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 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 1646 1647 1648 1649 | - + - + - + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineMixinObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1695 1696 1697 1698 1699 1700 1701 | 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 | - + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineRenameMethodObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1751 1752 1753 1754 1755 1756 1757 | 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 | - + + - + - + |
* ----------------------------------------------------------------------
*/
int
TclOODefineUnexportObjCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1900 1901 1902 1903 1904 1905 1906 | 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 | - - + + - + + - + + |
*/
int
TclOODefineSlots(
Foundation *fPtr)
{
const struct DeclaredSlot *slotInfoPtr;
|
| ︙ | |||
1943 1944 1945 1946 1947 1948 1949 | 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 | - + - + - + - + - + - + |
*/
static int
ClassFilterGet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2022 2023 2024 2025 2026 2027 2028 | 2000 2001 2002 2003 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 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 | - + - + - + - - + - + - + - + |
*/
static int
ClassMixinGet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2126 2127 2128 2129 2130 2131 2132 | 2103 2104 2105 2106 2107 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 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 | - + - + - + - + - + - + - + + |
*/
static int
ClassSuperGet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2225 2226 2227 2228 2229 2230 2231 | 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 | - + - + + |
if (superclasses[i] == NULL) {
goto failedAfterAlloc;
}
for (j=0 ; j<i ; j++) {
if (superclasses[j] == superclasses[i]) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"class should only be a direct superclass once",
|
| ︙ | |||
2279 2280 2281 2282 2283 2284 2285 | 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 | - + - + - + - + - + - - + |
*/
static int
ClassVarsGet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2380 2381 2382 2383 2384 2385 2386 | 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 | - + + |
oPtr->classPtr->variables.list = (Tcl_Obj **)
ckalloc(sizeof(Tcl_Obj *) * varc);
}
}
oPtr->classPtr->variables.num = 0;
if (varc > 0) {
|
| ︙ | |||
2421 2422 2423 2424 2425 2426 2427 | 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 | - + - + |
*/
static int
ObjFilterGet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2449 2450 2451 2452 2453 2454 2455 | 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 | - + - + |
}
static int
ObjFilterSet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2488 2489 2490 2491 2492 2493 2494 | 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 | - + - + |
*/
static int
ObjMixinGet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2518 2519 2520 2521 2522 2523 2524 | 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 | - + - + - |
}
static int
ObjMixinSet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2571 2572 2573 2574 2575 2576 2577 | 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 | - + - + |
*/
static int
ObjVarsGet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2599 2600 2601 2602 2603 2604 2605 | 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 | - + - + |
}
static int
ObjVarsSet(
ClientData clientData,
Tcl_Interp *interp,
Tcl_ObjectContext context,
|
| ︙ | |||
2658 2659 2660 2661 2662 2663 2664 | 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 | - + + |
} else {
oPtr->variables.list = (Tcl_Obj **)
ckalloc(sizeof(Tcl_Obj *) * varc);
}
}
oPtr->variables.num = 0;
if (varc > 0) {
|
| ︙ |
Changes to generic/tclOOInfo.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + | #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "tclInt.h" #include "tclOOInt.h" static inline Class * GetClassFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); |
| ︙ | |||
163 164 165 166 167 168 169 | 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 | - + - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectClassCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
217 218 219 220 221 222 223 | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectDefnCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
251 252 253 254 255 256 257 | 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 | - + + - + |
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(objv[2]), NULL);
return TCL_ERROR;
}
procPtr = TclOOGetProcFromMethod(Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
291 292 293 294 295 296 297 | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | - + - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectFiltersCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
330 331 332 333 334 335 336 | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectForwardCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
363 364 365 366 367 368 369 | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | - + |
TclGetString(objv[2]), NULL);
return TCL_ERROR;
}
prefixObj = TclOOGetFwdFromMethod(Tcl_GetHashValue(hPtr));
if (prefixObj == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"prefix argument list not available for this kind of method",
|
| ︙ | |||
387 388 389 390 391 392 393 | 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 | - + - + + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectIsACmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
455 456 457 458 459 460 461 | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | - + |
}
o2Ptr = (Object *) Tcl_GetObjectFromObj(interp, objv[3]);
if (o2Ptr == NULL) {
return TCL_ERROR;
}
if (o2Ptr->classPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
481 482 483 484 485 486 487 | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | - + |
}
o2Ptr = (Object *) Tcl_GetObjectFromObj(interp, objv[3]);
if (o2Ptr == NULL) {
return TCL_ERROR;
}
if (o2Ptr->classPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
511 512 513 514 515 516 517 | 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 | - + + - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectMethodsCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
559 560 561 562 563 564 565 | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | - + - + |
}
}
}
resultObj = Tcl_NewObj();
if (recurse) {
const char **names;
|
| ︙ | |||
593 594 595 596 597 598 599 | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectMethodTypeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
632 633 634 635 636 637 638 | 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 | - + + - + - + |
* Special entry for visibility control: pretend the method doesnt
* exist.
*/
goto unknownMethod;
}
|
| ︙ | |||
690 691 692 693 694 695 696 | 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 | - + - + - + - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectNsCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
761 762 763 764 765 766 767 | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectVarsCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
822 823 824 825 826 827 828 | 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassConstrCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
844 845 846 847 848 849 850 | 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 | - + + - + |
}
if (clsPtr->constructorPtr == NULL) {
return TCL_OK;
}
procPtr = TclOOGetProcFromMethod(clsPtr->constructorPtr);
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
883 884 885 886 887 888 889 | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassDefnCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
911 912 913 914 915 916 917 | 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 | - + + - + |
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(objv[2]), NULL);
return TCL_ERROR;
}
procPtr = TclOOGetProcFromMethod(Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
951 952 953 954 955 956 957 | 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 | - + - + + |
* ----------------------------------------------------------------------
*/
static int
InfoClassDestrCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
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 | - + - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassFiltersCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1033 1034 1035 1036 1037 1038 1039 | 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassForwardCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1060 1061 1062 1063 1064 1065 1066 | 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | - + |
TclGetString(objv[2]), NULL);
return TCL_ERROR;
}
prefixObj = TclOOGetFwdFromMethod(Tcl_GetHashValue(hPtr));
if (prefixObj == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"prefix argument list not available for this kind of method",
|
| ︙ | |||
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 | - + - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassInstancesCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
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 | - + + - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassMethodsCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1179 1180 1181 1182 1183 1184 1185 | 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | - + - + |
}
}
}
resultObj = Tcl_NewObj();
if (recurse) {
const char **names;
|
| ︙ | |||
1215 1216 1217 1218 1219 1220 1221 | 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassMethodTypeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1249 1250 1251 1252 1253 1254 1255 | 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 | - + + - + - + |
/*
* Special entry for visibility control: pretend the method doesnt
* exist.
*/
goto unknownMethod;
}
|
| ︙ | |||
1306 1307 1308 1309 1310 1311 1312 | 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | - + - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassSubsCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1361 1362 1363 1364 1365 1366 1367 | 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 | - + - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassSupersCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1400 1401 1402 1403 1404 1405 1406 | 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 | - + - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassVariablesCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1438 1439 1440 1441 1442 1443 1444 | 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoObjectCallCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1460 1461 1462 1463 1464 1465 1466 | 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | - + |
/*
* Get the call context and render its call chain.
*/
contextPtr = TclOOGetCallContext(oPtr, objv[2], PUBLIC_METHOD, NULL);
if (contextPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1483 1484 1485 1486 1487 1488 1489 | 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | - + |
* ----------------------------------------------------------------------
*/
static int
InfoClassCallCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
1505 1506 1507 1508 1509 1510 1511 | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 | - + |
/*
* Get an render the stereotypical call chain.
*/
callPtr = TclOOGetStereotypeCallChain(clsPtr, objv[2], PUBLIC_METHOD);
if (callPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ |
Changes to generic/tclOOInt.h.
| ︙ | |||
133 134 135 136 137 138 139 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | - + - + | * * The "num" field always counts the number of listType_t elements used in the * "list" field. When a "size" field exists, it describes how many elements * are present in the list; when absent, exactly "num" elements are present. */ #define LIST_STATIC(listType_t) \ |
| ︙ | |||
342 343 344 345 346 347 348 | 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 | - + - + |
* chain; it is in the call context. */
int objectEpoch; /* Local (object structure) epoch counter
* snapshot. */
int epoch; /* Global (class structure) epoch counter
* snapshot. */
int flags; /* Assorted flags, see below. */
int refCount; /* Reference count. */
|
| ︙ | |||
388 389 390 391 392 393 394 | 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 438 439 440 441 442 443 444 445 | - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - + + | /* *---------------------------------------------------------------- * Commands relating to OO support. *---------------------------------------------------------------- */ MODULE_SCOPE int TclOOInit(Tcl_Interp *interp); |
| ︙ | |||
505 506 507 508 509 510 511 | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | - + - - - - + + | MODULE_SCOPE Tcl_Obj * TclOOGetMethodBody(Method *mPtr); MODULE_SCOPE int TclOOGetSortedClassMethodList(Class *clsPtr, int flags, const char ***stringsPtr); MODULE_SCOPE int TclOOGetSortedMethodList(Object *oPtr, int flags, const char ***stringsPtr); MODULE_SCOPE int TclOOInit(Tcl_Interp *interp); MODULE_SCOPE void TclOOInitInfo(Tcl_Interp *interp); |
| ︙ |
Changes to generic/tclOOIntDecls.h.
| ︙ | |||
34 35 36 37 38 39 40 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + | /* 4 */ TCLOOAPI Method * TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 5 */ TCLOOAPI int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp, |
| ︙ | |||
67 68 69 70 71 72 73 | 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 106 107 108 109 110 111 112 113 114 115 116 117 | - + - - + + - + - + - + - + - - - - - + + + + + | ProcErrorProc *errProc, ClientData clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 11 */ TCLOOAPI int TclOOInvokeObject(Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, |
| ︙ |
Changes to generic/tclOOMethod.c.
| ︙ | |||
59 60 61 62 63 64 65 | 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 106 107 108 109 | - - - - + + + + - + - + - + - + | * variables be cached? */ } OOResVarInfo; /* * Function declarations for things defined in this file. */ |
| ︙ | |||
299 300 301 302 303 304 305 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | - + |
TclOONewBasicMethod(
Tcl_Interp *interp,
Class *clsPtr, /* Class to attach the method to. */
const DeclaredClassMethod *dcm)
/* Name of the method, whether it is public,
* and the function to implement it. */
{
|
| ︙ | |||
333 334 335 336 337 338 339 | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | - + |
Tcl_Obj *bodyObj, /* The body of the method, which must not be
* NULL. */
ProcedureMethod **pmPtrPtr) /* Place to write pointer to procedure method
* structure to allow for deeper tuning of the
* structure's contents. NULL if caller is not
* interested. */
{
|
| ︙ | |||
385 386 387 388 389 390 391 | 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 | - + - + - + |
Tcl_Obj *bodyObj, /* The body of the method, which must not be
* NULL. */
ProcedureMethod **pmPtrPtr) /* Place to write pointer to procedure method
* structure to allow for deeper tuning of the
* structure's contents. NULL if caller is not
* interested. */
{
|
| ︙ | |||
659 660 661 662 663 664 665 | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | - + |
*/
static int
InvokeProcedureMethod(
ClientData clientData, /* Pointer to some per-method context. */
Tcl_Interp *interp,
Tcl_ObjectContext context, /* The method calling context. */
|
| ︙ | |||
780 781 782 783 784 785 786 | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | - + |
static int
PushMethodCallFrame(
Tcl_Interp *interp, /* Current interpreter. */
CallContext *contextPtr, /* Current method call context. */
ProcedureMethod *pmPtr, /* Information about this procedure-like
* method. */
|
| ︙ | |||
988 989 990 991 992 993 994 | 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | - + + |
{
OOResVarInfo *infoPtr = (OOResVarInfo *) rPtr;
Interp *iPtr = (Interp *) interp;
CallFrame *framePtr = iPtr->varFramePtr;
CallContext *contextPtr;
Tcl_Obj *variableObj;
Tcl_HashEntry *hPtr;
|
| ︙ | |||
1085 1086 1087 1088 1089 1090 1091 | 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | - + |
ckfree(infoPtr);
}
static int
ProcedureMethodCompiledVarResolver(
Tcl_Interp *interp,
const char *varName,
|
| ︙ | |||
1156 1157 1158 1159 1160 1161 1162 | 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 | - + - + | * suitable formatting contexts. * * ---------------------------------------------------------------------- */ #define LIMIT 60 #define ELLIPSIFY(str,len) \ |
| ︙ | |||
1198 1199 1200 1201 1202 1203 1204 | 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 | - + |
Tcl_Interp *interp,
Tcl_Obj *methodNameObj)
{
CallContext *contextPtr = ((Interp *) interp)->varFramePtr->clientData;
Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr;
Object *declarerPtr;
const char *objectName, *kindName;
|
| ︙ | |||
1227 1228 1229 1230 1231 1232 1233 | 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | - + |
Tcl_Interp *interp,
Tcl_Obj *methodNameObj)
{
CallContext *contextPtr = ((Interp *) interp)->varFramePtr->clientData;
Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr;
Object *declarerPtr;
const char *objectName, *kindName;
|
| ︙ | |||
1363 1364 1365 1366 1367 1368 1369 | 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | - + - + |
Tcl_Interp *interp, /* Interpreter for error reporting. */
Object *oPtr, /* The object to attach the method to. */
int flags, /* Whether the method is public or not. */
Tcl_Obj *nameObj, /* The name of the method. */
Tcl_Obj *prefixObj) /* List of arguments that form the command
* prefix to forward to. */
{
|
| ︙ | |||
1404 1405 1406 1407 1408 1409 1410 | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 | - + - + |
Tcl_Interp *interp, /* Interpreter for error reporting. */
Class *clsPtr, /* The class to attach the method to. */
int flags, /* Whether the method is public or not. */
Tcl_Obj *nameObj, /* The name of the method. */
Tcl_Obj *prefixObj) /* List of arguments that form the command
* prefix to forward to. */
{
|
| ︙ | |||
1442 1443 1444 1445 1446 1447 1448 | 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 | - + - + |
*/
static int
InvokeForwardMethod(
ClientData clientData, /* Pointer to some per-method context. */
Tcl_Interp *interp,
Tcl_ObjectContext context, /* The method calling context. */
|
| ︙ | |||
1589 1590 1591 1592 1593 1594 1595 | 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 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 | - + - - + + - + - + - + |
*
* ----------------------------------------------------------------------
*/
static Tcl_Obj **
InitEnsembleRewrite(
Tcl_Interp *interp, /* Place to log the rewrite info. */
|
| ︙ |
Changes to generic/tclObj.c.
| ︙ | |||
142 143 144 145 146 147 148 | 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 | + - - - - + + + + + + + - - + + + |
* to them.
*/
#define ObjDeletionLock(contextPtr) ((contextPtr)->deletionCount++)
#define ObjDeletionUnlock(contextPtr) ((contextPtr)->deletionCount--)
#define ObjDeletePending(contextPtr) ((contextPtr)->deletionCount > 0)
#define ObjOnStack(contextPtr) ((contextPtr)->deletionStack != NULL)
#define PushObjToDelete(contextPtr,objPtr) \
do { \
|
| ︙ | |||
566 567 568 569 570 571 572 | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | - + - + |
*----------------------------------------------------------------------
*/
ContLineLoc *
TclContinuationsEnter(
Tcl_Obj *objPtr,
int num,
|
| ︙ | |||
600 601 602 603 604 605 606 | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | - + |
* doing.
*/
ckfree(Tcl_GetHashValue(hPtr));
}
clLocPtr->num = num;
|
| ︙ | |||
629 630 631 632 633 634 635 | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | - - + + - - + + |
* TIP #280
*----------------------------------------------------------------------
*/
void
TclContinuationsEnterDerived(
Tcl_Obj *objPtr,
|
| ︙ | |||
676 677 678 679 680 681 682 | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | - + |
/*
* And generate the table from the slice, if it was not empty.
*/
num = wordCLLast - clNext;
if (num) {
|
| ︙ | |||
874 875 876 877 878 879 880 | 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 | - + - - + + |
Tcl_Interp *interp, /* Interpreter used for error reporting. */
Tcl_Obj *objPtr) /* Points to the Tcl object onto which the
* name of each registered type is appended as
* a list element. */
{
register Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
|
| ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 | - + |
Tcl_HashEntry *hPtr;
Tcl_HashTable *tablePtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
tablePtr = tsdPtr->objThreadMap;
if (tablePtr != NULL) {
|
| ︙ | |||
1316 1317 1318 1319 1320 1321 1322 | 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 | - + - + |
* Skip that possibility so any double free will trigger the panic.
*/
objPtr->refCount = -1;
/*
* Invalidate the string rep first so we can use the bytes value for our
* pointer chain, and signal an obj deletion (as opposed to shimmering)
|
| ︙ | |||
1384 1385 1386 1387 1388 1389 1390 | 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 | - + - + |
void
TclFreeObj(
register Tcl_Obj *objPtr) /* The object to be freed. */
{
/*
* Invalidate the string rep first so we can use the bytes value for our
* pointer chain, and signal an obj deletion (as opposed to shimmering)
|
| ︙ | |||
1490 1491 1492 1493 1494 1495 1496 | 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | - + |
*----------------------------------------------------------------------
*/
int
TclObjBeingDeleted(
Tcl_Obj *objPtr)
{
|
| ︙ | |||
1613 1614 1615 1616 1617 1618 1619 | 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 | - + |
* NULL. This panic was added in Tcl 8.1.
*/
Tcl_Panic("UpdateStringProc should not be invoked for type %s",
objPtr->typePtr->name);
}
objPtr->typePtr->updateStringProc(objPtr);
|
| ︙ | |||
1648 1649 1650 1651 1652 1653 1654 | 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 | - + |
*----------------------------------------------------------------------
*/
char *
Tcl_GetStringFromObj(
register Tcl_Obj *objPtr, /* Object whose string rep byte pointer should
* be returned. */
|
| ︙ | |||
1886 1887 1888 1889 1890 1891 1892 | 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 | - + + |
#ifndef TCL_WIDE_INT_IS_LONG
if (objPtr->typePtr == &tclWideIntType) {
*boolPtr = (objPtr->internalRep.wideValue != 0);
return TCL_OK;
}
#endif
} while ((ParseBoolean(objPtr) == TCL_OK) || (TCL_OK ==
|
| ︙ | |||
1951 1952 1953 1954 1955 1956 1957 | 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 | - + - + - + + |
if (ParseBoolean(objPtr) == TCL_OK) {
return TCL_OK;
}
badBoolean:
if (interp != NULL) {
|
| ︙ | |||
2246 2247 2248 2249 2250 2251 2252 | 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 | - + + |
register double *dblPtr) /* Place to store resulting double. */
{
do {
if (objPtr->typePtr == &tclDoubleType) {
if (TclIsNaN(objPtr->internalRep.doubleValue)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2301 2302 2303 2304 2305 2306 2307 | 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 | - - + + |
*/
static int
SetDoubleFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr) /* The object to convert. */
{
|
| ︙ | |||
2331 2332 2333 2334 2335 2336 2337 | 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 | - + |
*/
static void
UpdateStringOfDouble(
register Tcl_Obj *objPtr) /* Double obj with string rep to update. */
{
char buffer[TCL_DOUBLE_SPACE];
|
| ︙ | |||
2467 2468 2469 2470 2471 2472 2473 | 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 | - + - + |
long l;
if (TclGetLongFromObj(interp, objPtr, &l) != TCL_OK) {
return TCL_ERROR;
}
if ((ULONG_MAX > UINT_MAX) && ((l > UINT_MAX) || (l < -(long)UINT_MAX))) {
if (interp != NULL) {
|
| ︙ | |||
2529 2530 2531 2532 2533 2534 2535 | 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 | - + |
*/
static void
UpdateStringOfInt(
register Tcl_Obj *objPtr) /* Int object whose string rep to update. */
{
char buffer[TCL_INTEGER_SPACE];
|
| ︙ | |||
2787 2788 2789 2790 2791 2792 2793 | 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 | - - + + - + |
return TCL_OK;
}
}
#ifndef TCL_WIDE_INT_IS_LONG
tooLarge:
#endif
if (interp != NULL) {
|
| ︙ | |||
2825 2826 2827 2828 2829 2830 2831 | 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 | - + |
*/
static void
UpdateStringOfWideInt(
register Tcl_Obj *objPtr) /* Int object whose string rep to update. */
{
char buffer[TCL_INTEGER_SPACE+2];
|
| ︙ | |||
3084 3085 3086 3087 3088 3089 3090 | 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 | - - + + - + |
} else {
*wideIntPtr = (Tcl_WideInt) value;
}
return TCL_OK;
}
}
if (interp != NULL) {
|
| ︙ | |||
3386 3387 3388 3389 3390 3391 3392 | 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 | - + |
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected integer but got \"%s\"",
Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", NULL);
}
return TCL_ERROR;
}
|
| ︙ | |||
3638 3639 3640 3641 3642 3643 3644 | 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 | - - + + | (int) sizeof(mp_int)); UNPACK_BIGNUM(objPtr, *bigPtr); *typePtr = TCL_NUMBER_BIG; *clientDataPtr = bigPtr; return TCL_OK; } |
| ︙ | |||
3945 3946 3947 3948 3949 3950 3951 | 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 | - + |
TclCompareObjKeys(
void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
Tcl_Obj *objPtr1 = keyPtr;
Tcl_Obj *objPtr2 = (Tcl_Obj *) hPtr->key.oneWordValue;
register const char *p1, *p2;
|
| ︙ | |||
4033 4034 4035 4036 4037 4038 4039 | 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 | - + |
unsigned int
TclHashObjKey(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key from which to compute hash value. */
{
Tcl_Obj *objPtr = keyPtr;
|
| ︙ | |||
4443 4444 4445 4446 4447 4448 4449 | 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_RepresentationCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
4475 4476 4477 4478 4479 4480 4481 | 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 | - + - + - + |
(void *) objv[1]->internalRep.twoPtrValue.ptr1,
(void *) objv[1]->internalRep.twoPtrValue.ptr2);
Tcl_AppendPrintfToObj(descObj, ", internal representation %s",
ptrBuffer);
}
if (objv[1]->bytes) {
|
| ︙ |
Changes to generic/tclOptimize.c.
| ︙ | |||
227 228 229 230 231 232 233 | 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 | - + - + |
case INST_PUSH1:
if (nextInst == INST_POP) {
blank = size + InstLength(nextInst);
} else if (nextInst == INST_CONCAT1
&& TclGetUInt1AtPtr(currentInstPtr + size + 1) == 2) {
Tcl_Obj *litPtr = TclFetchLiteral(envPtr,
TclGetUInt1AtPtr(currentInstPtr + 1));
|
| ︙ |
Changes to generic/tclParse.c.
| ︙ | |||
157 158 159 160 161 162 163 | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | - + - + - + | }; /* * Prototypes for local functions defined in this file: */ static inline int CommandComplete(const char *script, int numBytes); |
| ︙ | |||
184 185 186 187 188 189 190 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - - - + + + + + + |
*----------------------------------------------------------------------
*/
void
TclParseInit(
Tcl_Interp *interp, /* Interpreter to use for error reporting */
const char *start, /* Start of string to be parsed. */
|
| ︙ | |||
230 231 232 233 234 235 236 | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | - - - + + + |
int
Tcl_ParseCommand(
Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
const char *start, /* First character of string containing one or
* more Tcl commands. */
|
| ︙ | |||
256 257 258 259 260 261 262 | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - + - + |
const char *termPtr; /* Set by Tcl_ParseBraces/QuotedString to
* point to char after terminating one. */
int scanned;
if ((start == NULL) && (numBytes != 0)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
443 444 445 446 447 448 449 | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | - + |
/*
* Step through the literal string, parsing and counting list
* elements.
*/
while (nextElem < listEnd) {
|
| ︙ | |||
567 568 569 570 571 572 573 | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | - + - + |
parsePtr->term = src;
src++;
break;
}
if (src[-1] == '"') {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
634 635 636 637 638 639 640 | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | - + - + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
| ︙ | |||
688 689 690 691 692 693 694 | 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 | - + - + + + + + + + + + + - - + + - - - - + + + + + | * * Results: * Returns the number of bytes recognized as white space. * *---------------------------------------------------------------------- */ |
| ︙ | |||
728 729 730 731 732 733 734 | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | - + - + | * * The digits '0' .. '9' and the letters 'A' .. 'Z' and 'a' .. 'z' occupy * consecutive code points, and '0' < 'A' < 'a'. * *---------------------------------------------------------------------- */ |
| ︙ | |||
783 784 785 786 787 788 789 | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | - + - - + + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
| ︙ | |||
967 968 969 970 971 972 973 | 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 | - + - + - + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1055 1056 1057 1058 1059 1060 1061 | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | - + |
*
*----------------------------------------------------------------------
*/
static int
ParseTokens(
register const char *src, /* First character to parse. */
|
| ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | - + |
&& (*(nestedPtr->term) == ']')
&& !(nestedPtr->incomplete)) {
break;
}
if (numBytes == 0) {
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
| ︙ | |||
1330 1331 1332 1333 1334 1335 1336 | 1343 1344 1345 1346 1347 1348 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 | - - - + + + - + |
int
Tcl_ParseVarName(
Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
const char *start, /* Start of variable substitution string.
* First character must be "$". */
|
| ︙ | |||
1410 1411 1412 1413 1414 1415 1416 | 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 | - + |
while (numBytes && (*src != '}')) {
numBytes--;
src++;
}
if (numBytes == 0) {
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
| ︙ | |||
1478 1479 1480 1481 1482 1483 1484 | 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 | - + |
if (TCL_OK != ParseTokens(src+1, numBytes-1, TYPE_CLOSE_PAREN,
TCL_SUBST_ALL, parsePtr)) {
goto error;
}
if ((parsePtr->term == src+numBytes) || (*parsePtr->term != ')')){
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
| ︙ | |||
1545 1546 1547 1548 1549 1550 1551 | 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | - + |
* character just after last one in the
* variable specifier. */
{
register Tcl_Obj *objPtr;
int code;
Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
|
| ︙ | |||
1620 1621 1622 1623 1624 1625 1626 | 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 1666 1667 1668 1669 1670 | - - - + + + - + + - + |
int
Tcl_ParseBraces(
Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
const char *start, /* Start of string enclosed in braces. The
* first character must be {'. */
|
| ︙ | |||
1752 1753 1754 1755 1756 1757 1758 | 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 | - + |
* error message in.
*/
goto error;
}
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
| ︙ | |||
1775 1776 1777 1778 1779 1780 1781 | 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 | - + + |
break;
case '\n':
openBrace = 0;
break;
case '#' :
if (openBrace && TclIsSpaceProc(src[-1])) {
Tcl_AppendToObj(Tcl_GetObjResult(parsePtr->interp),
|
| ︙ | |||
1822 1823 1824 1825 1826 1827 1828 | 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 | - - - + + + - + - + |
int
Tcl_ParseQuotedString(
Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
const char *start, /* Start of the quoted string. The first
* character must be '"'. */
|
| ︙ | |||
1904 1905 1906 1907 1908 1909 1910 | 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 | - + - + |
*----------------------------------------------------------------------
*/
void
TclSubstParse(
Tcl_Interp *interp,
const char *bytes,
|
| ︙ | |||
2103 2104 2105 2106 2107 2108 2109 | 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 | - + - + - + |
int
TclSubstTokens(
Tcl_Interp *interp, /* Interpreter in which to lookup variables,
* execute nested commands, and report
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
|
| ︙ | |||
2131 2132 2133 2134 2135 2136 2137 | 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 | - + |
* for the places generating arguments for
* which this is true. */
{
Tcl_Obj *result;
int code = TCL_OK;
#define NUM_STATIC_POS 20
int isLiteral, maxNumCL, numCL, i, adjust;
|
| ︙ | |||
2166 2167 2168 2169 2170 2171 2172 | 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 | - + |
isLiteral = 0;
break;
}
}
if (isLiteral) {
maxNumCL = NUM_STATIC_POS;
|
| ︙ | |||
2206 2207 2208 2209 2210 2211 2212 | 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 | - + - + - + - |
* everything, just the number of lines we have to add as
* correction.
*/
if ((appendByteLength == 1) && (utfCharBytes[0] == ' ')
&& (tokenPtr->start[1] == '\n')) {
if (isLiteral) {
|
| ︙ | |||
2486 2487 2488 2489 2490 2491 2492 | 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 | - + |
*/
int
TclObjCommandComplete(
Tcl_Obj *objPtr) /* Points to object holding script to
* check. */
{
|
| ︙ | |||
2512 2513 2514 2515 2516 2517 2518 | 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 | - + |
*
*----------------------------------------------------------------------
*/
int
TclIsLocalScalar(
const char *src,
|
| ︙ |
Changes to generic/tclPathObj.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 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | - + + - + - + - + |
oldDirSep = dirSep;
}
again:
if (IsSeparatorOrNull(dirSep[2])) {
/*
* Need to skip '.' in the path.
*/
|
| ︙ | |||
399 400 401 402 403 404 405 | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | - + |
}
/*
* Ensure a windows drive like C:/ has a trailing separator.
*/
if (tclPlatform == TCL_PLATFORM_WINDOWS) {
|
| ︙ | |||
491 492 493 494 495 496 497 | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | - + |
*----------------------------------------------------------------------
*/
Tcl_PathType
TclFSGetPathType(
Tcl_Obj *pathPtr,
const Tcl_Filesystem **filesystemPtrPtr,
|
| ︙ | |||
573 574 575 576 577 578 579 | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | - + | * Check if the joined-on bit has any directory delimiters in * it. If so, the 'dirname' would be a joining of the main * part with the dirname of the joined-on bit. We could handle * that special case here, but we don't, and instead just use * the standardPath code. */ |
| ︙ | |||
611 612 613 614 615 616 617 | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | - + | /* * Check if the joined-on bit has any directory delimiters in * it. If so, the 'tail' would be only the part following the * last delimiter. We could handle that special case here, but * we don't, and instead just use the standardPath code. */ |
| ︙ | |||
640 641 642 643 644 645 646 | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | - + |
Tcl_IncrRefCount(fsPathPtr->normPathPtr);
return fsPathPtr->normPathPtr;
}
case TCL_PATH_EXTENSION:
return GetExtension(fsPathPtr->normPathPtr);
case TCL_PATH_ROOT: {
const char *fileName, *extension;
|
| ︙ | |||
683 684 685 686 687 688 689 | 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 | - + - + - + |
/* Relative path */
goto standardPath;
} else {
/* Absolute path */
goto standardPath;
}
} else {
|
| ︙ | |||
778 779 780 781 782 783 784 | 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | - + |
Tcl_Obj *ret;
tail = TclGetString(pathPtr);
extension = TclGetExtension(tail);
if (extension == NULL) {
ret = Tcl_NewObj();
} else {
|
| ︙ | |||
825 826 827 828 829 830 831 | 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 | - + - + - + - + |
Tcl_Obj *
Tcl_FSJoinPath(
Tcl_Obj *listObj, /* Path elements to join, may have a zero
* reference count. */
int elements) /* Number of elements to use (-1 = all) */
{
Tcl_Obj *copy, *res;
|
| ︙ | |||
875 876 877 878 879 880 881 | 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 | - + |
&& (elt->typePtr == &tclFsPathType)
&& !((elt->bytes != NULL) && (elt->bytes[0] == '\0'))) {
Tcl_Obj *tailObj = objv[i+1];
type = TclGetPathType(tailObj, NULL, NULL, NULL);
if (type == TCL_PATH_RELATIVE) {
const char *str;
|
| ︙ | |||
1073 1074 1075 1076 1077 1078 1079 | 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 | - + |
res = Tcl_DuplicateObj(res);
Tcl_IncrRefCount(res);
}
}
if (length > 0 && ptr[length -1] != '/') {
Tcl_AppendToObj(res, &separator, 1);
|
| ︙ | |||
1256 1257 1258 1259 1260 1261 1262 | 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | - + |
*---------------------------------------------------------------------------
*/
Tcl_Obj *
TclNewFSPathObj(
Tcl_Obj *dirPtr,
const char *addStrRep,
|
| ︙ | |||
1327 1328 1329 1330 1331 1332 1333 | 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | - + |
count++;
break;
case '/':
case '\\':
case ':':
if (count) {
PATHFLAGS(pathPtr) |= TCLPATH_NEEDNORM;
|
| ︙ | |||
1356 1357 1358 1359 1360 1361 1362 | 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | - + |
}
static Tcl_Obj *
AppendPath(
Tcl_Obj *head,
Tcl_Obj *tail)
{
|
| ︙ | |||
1405 1406 1407 1408 1409 1410 1411 | 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | - + |
Tcl_Obj *
TclFSMakePathRelative(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
Tcl_Obj *pathPtr, /* The path we have. */
Tcl_Obj *cwdPtr) /* Make it relative to this. */
{
|
| ︙ | |||
1489 1490 1491 1492 1493 1494 1495 | 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 | - + + |
*/
if (pathPtr->typePtr != NULL) {
if (pathPtr->bytes == NULL) {
if (pathPtr->typePtr->updateStringProc == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1710 1711 1712 1713 1714 1715 1716 | 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 | - + - + |
Tcl_FSGetTranslatedStringPath(
Tcl_Interp *interp,
Tcl_Obj *pathPtr)
{
Tcl_Obj *transPtr = Tcl_FSGetTranslatedPath(interp, pathPtr);
if (transPtr != NULL) {
|
| ︙ | |||
1760 1761 1762 1763 1764 1765 1766 | 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | - + + - + |
if (PATHFLAGS(pathPtr) != 0) {
/*
* This is a special path object which is the result of something like
* 'file join'
*/
Tcl_Obj *dir, *copy;
|
| ︙ | |||
1874 1875 1876 1877 1878 1879 1880 | 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 | - + |
}
FreeFsPathInternalRep(pathPtr);
if (SetFsPathFromAny(interp, pathPtr) != TCL_OK) {
return NULL;
}
fsPathPtr = PATHOBJ(pathPtr);
} else if (fsPathPtr->normPathPtr == NULL) {
|
| ︙ | |||
1982 1983 1984 1985 1986 1987 1988 | 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 | - + |
/*
* Check if path is pure normalized (this can only be the case if it
* is an absolute path).
*/
if (pureNormalized) {
|
| ︙ | |||
2247 2248 2249 2250 2251 2252 2253 | 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 | - + + |
int
Tcl_FSEqualPaths(
Tcl_Obj *firstPtr,
Tcl_Obj *secondPtr)
{
const char *firstStr, *secondStr;
|
| ︙ | |||
2306 2307 2308 2309 2310 2311 2312 | 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 | - + |
*/
static int
SetFsPathFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
Tcl_Obj *pathPtr) /* The object to convert. */
{
|
| ︙ | |||
2370 2371 2372 2373 2374 2375 2376 | 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 | - + |
}
dir = TclGetEnv("HOME", &dirString);
if (dir == NULL) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't find HOME environment variable to"
|
| ︙ | |||
2417 2418 2419 2420 2421 2422 2423 | 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 | - + |
if (name[split+1] == separator) {
/*
* Somewhat tricky case like ~//foo/bar. Make use of
* Split/Join machinery to get it right. Assumes all paths
* beginning with ~ are part of the native filesystem.
*/
|
| ︙ | |||
2440 2441 2442 2443 2444 2445 2446 | 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 | - + | /* * Simple case. "rest" is relative path. Just join it. The * "rest" object will be freed when Tcl_FSJoinToPath returns * (unless something else claims a refCount on it). */ Tcl_Obj *joined; |
| ︙ | |||
2595 2596 2597 2598 2599 2600 2601 | 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 | - + |
*/
static void
UpdateStringOfFsPath(
register Tcl_Obj *pathPtr) /* path obj with string rep to update. */
{
FsPath *fsPathPtr = PATHOBJ(pathPtr);
|
| ︙ | |||
2663 2664 2665 2666 2667 2668 2669 | 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 | - + |
} else {
/*
* It is somewhat unusual to reach this code path without the object
* being of tclFsPathType. However, we do our best to deal with the
* situation.
*/
|
| ︙ |
Changes to generic/tclPipe.c.
| ︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + | /* * Declarations for local functions defined in this file: */ static TclFile FileForRedirect(Tcl_Interp *interp, const char *spec, int atOk, const char *arg, const char *nextArg, |
| ︙ | |||
69 70 71 72 73 74 75 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | - + |
const char *arg, /* Pointer to entire argument containing spec:
* used for error reporting. */
const char *nextArg, /* Next argument in argc/argv array, if needed
* for file name or channel name. May be
* NULL. */
int flags, /* Flags to use for opening file or to specify
* mode for channel. */
|
| ︙ | |||
343 344 345 346 347 348 349 | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | - + + |
p = Tcl_SignalMsg(WSTOPSIG(waitStatus));
Tcl_SetErrorCode(interp, "CHILDSUSP", msg1,
Tcl_SignalId(WSTOPSIG(waitStatus)), p, NULL);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"child suspended: %s\n", p));
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
368 369 370 371 372 373 374 | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | - + |
if (interp != NULL) {
int count;
Tcl_Obj *objPtr;
Tcl_Seek(errorChan, (Tcl_WideInt)0, SEEK_SET);
objPtr = Tcl_NewObj();
|
| ︙ | |||
394 395 396 397 398 399 400 | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | - + |
/*
* If a child exited abnormally but didn't output any error information at
* all, generate an error message here.
*/
if ((abnormalExit != 0) && (anyErrorInfo == 0) && (interp != NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
431 432 433 434 435 436 437 | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | - + |
*
*----------------------------------------------------------------------
*/
int
TclCreatePipeline(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
|
| ︙ | |||
466 467 468 469 470 471 472 | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | - + |
* redirection then the file will still be
* created but it will never get any data. */
{
Tcl_Pid *pidPtr = NULL; /* Points to malloc-ed array holding all the
* pids of child processes. */
int numPids; /* Actual number of processes that exist at
* *pidPtr right now. */
|
| ︙ | |||
493 494 495 496 497 498 499 | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | - + + |
* commands in pipeline. NULL means use
* stderr. */
int errorClose = 0; /* If non-zero, then errorFile should be
* closed when cleaning up. */
int errorRelease = 0;
const char *p;
const char *nextArg;
|
| ︙ | |||
544 545 546 547 548 549 550 | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | - + |
case '|':
if (*p == '&') {
p++;
}
if (*p == '\0') {
if ((i == (lastBar + 1)) || (i == (argc - 1))) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
726 727 728 729 730 731 732 | 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | - + |
if (needCmd) {
/*
* We had a bar followed only by redirections.
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1046 1047 1048 1049 1050 1051 1052 | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | - + |
*----------------------------------------------------------------------
*/
Tcl_Channel
Tcl_OpenCommandChannel(
Tcl_Interp *interp, /* Interpreter for error reporting. Can NOT be
* NULL. */
|
| ︙ | |||
1079 1080 1081 1082 1083 1084 1085 | 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 | - + - + - + |
* constraints.
*/
if (flags & TCL_ENFORCE_MODE) {
if ((flags & TCL_STDOUT) && (outPipe == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't read output from command:"
|
| ︙ |
Changes to generic/tclPkg.c.
| ︙ | |||
55 56 57 58 59 60 61 | 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 | - + - + - - + + - + - + - + | static int CheckVersionAndConvert(Tcl_Interp *interp, const char *string, char **internal, int *stable); static int CompareVersions(char *v1i, char *v2i, int *isMajorPtr); static int CheckRequirement(Tcl_Interp *interp, const char *string); |
| ︙ | |||
275 276 277 278 279 280 281 | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | - + - + - + - + |
if (version == NULL) {
result = PkgRequireCore(interp, name, 0, NULL, clientDataPtr);
} else {
if (exact && TCL_OK
!= CheckVersionAndConvert(interp, version, NULL, NULL)) {
return NULL;
}
|
| ︙ | |||
464 465 466 467 468 469 470 | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | - + | char *versionToProvide = bestPtr->version; script = bestPtr->script; pkgPtr->clientData = versionToProvide; Tcl_Preserve(script); Tcl_Preserve(versionToProvide); |
| ︙ | |||
560 561 562 563 564 565 566 | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | - + |
if (pass > 1) {
break;
}
script = ((Interp *) interp)->packageUnknown;
if (script != NULL) {
Tcl_DStringInit(&command);
|
| ︙ | |||
710 711 712 713 714 715 716 717 718 719 720 721 | 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 | + + - + - + + |
*
* Side effects:
* See the user documentation.
*
*----------------------------------------------------------------------
*/
// TODO - Turn into an ensemble...
/* ARGSUSED */
int
Tcl_PackageObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
775 776 777 778 779 780 781 | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | - + + |
ckfree(availPtr);
}
ckfree(pkgPtr);
}
break;
}
case PKG_IFNEEDED: {
|
| ︙ | |||
814 815 816 817 818 819 820 | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | - + |
res = CompareVersions(avi, argv3i, NULL);
ckfree(avi);
if (res == 0){
if (objc == 4) {
ckfree(argv3i);
Tcl_SetObjResult(interp,
|
| ︙ | |||
856 857 858 859 860 861 862 | 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | - + |
resultObj = Tcl_NewObj();
tablePtr = &iPtr->packageTable;
for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&search)) {
pkgPtr = Tcl_GetHashValue(hPtr);
if ((pkgPtr->version != NULL) || (pkgPtr->availPtr != NULL)) {
Tcl_ListObjAppendElement(NULL,resultObj, Tcl_NewStringObj(
|
| ︙ | |||
920 921 922 923 924 925 926 | 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 | - + |
argv2 = TclGetString(objv[2]);
if (objc == 3) {
hPtr = Tcl_FindHashEntry(&iPtr->packageTable, argv2);
if (hPtr != NULL) {
pkgPtr = Tcl_GetHashValue(hPtr);
if (pkgPtr->version != NULL) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
960 961 962 963 964 965 966 | 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 | - + - + - + | return TCL_ERROR; } /* * Create a new-style requirement for the exact version. */ |
| ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | - - + + | } } /* * Always return current value. */ |
| ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | - + |
argv2 = TclGetString(objv[2]);
hPtr = Tcl_FindHashEntry(&iPtr->packageTable, argv2);
if (hPtr != NULL) {
pkgPtr = Tcl_GetHashValue(hPtr);
for (availPtr = pkgPtr->availPtr; availPtr != NULL;
availPtr = availPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, resultObj,
|
| ︙ | |||
1522 1523 1524 1525 1526 1527 1528 | 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 | - + - + |
*
*----------------------------------------------------------------------
*/
static int
CheckAllRequirements(
Tcl_Interp *interp,
|
| ︙ | |||
1628 1629 1630 1631 1632 1633 1634 | 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 | - + - + |
*
*----------------------------------------------------------------------
*/
static void
AddRequirementsToResult(
Tcl_Interp *interp,
|
| ︙ | |||
1667 1668 1669 1670 1671 1672 1673 | 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 | - + - + |
*
*----------------------------------------------------------------------
*/
static void
AddRequirementsToDString(
Tcl_DString *dsPtr,
|
| ︙ | |||
1707 1708 1709 1710 1711 1712 1713 | 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 | - + - + |
*----------------------------------------------------------------------
*/
static int
SomeRequirementSatisfied(
char *availVersionI, /* Candidate version to check against the
* requirements. */
|
| ︙ | |||
1845 1846 1847 1848 1849 1850 1851 | 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 | - + |
*
*----------------------------------------------------------------------
*/
const char *
Tcl_PkgInitStubsCheck(
Tcl_Interp *interp,
|
| ︙ |
Changes to generic/tclPlatDecls.h.
| ︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | - + - + - + - + - - + + - - + + | /* * Exported function declarations: */ #if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ /* 0 */ |
| ︙ |
Changes to generic/tclProc.c.
| ︙ | |||
38 39 40 41 42 43 44 | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | - + | static int InitArgsAndLocals(Tcl_Interp *interp, Tcl_Obj *procNameObj, int skip); static void InitResolvedLocals(Tcl_Interp *interp, ByteCode *codePtr, Var *defPtr, Namespace *nsPtr); static void InitLocalCache(Proc *procPtr); static int PushProcCallFrame(ClientData clientData, |
| ︙ | |||
121 122 123 124 125 126 127 | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | - + |
*/
/* ARGSUSED */
int
Tcl_ProcObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
191 192 193 194 195 196 197 | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | - + - + |
* current namespace unless the procedure's name included namespace
* qualifiers. To create the new command in the right namespace, we
* generate a fully qualified name for it.
*/
Tcl_DStringInit(&ds);
if (nsPtr != iPtr->globalNsPtr) {
|
| ︙ | |||
331 332 333 334 335 336 337 | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - + |
procArgs = TclGetString(objv[2]);
while (*procArgs == ' ') {
procArgs++;
}
if ((procArgs[0] == 'a') && (strncmp(procArgs, "args", 4) == 0)) {
|
| ︙ | |||
396 397 398 399 400 401 402 | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | - - + - + |
const char *procName, /* Unqualified name of this proc. */
Tcl_Obj *argsPtr, /* Description of arguments. */
Tcl_Obj *bodyPtr, /* Command body. */
Proc **procPtrPtr) /* Returns: pointer to proc data. */
{
Interp *iPtr = (Interp *) interp;
const char **argArray = NULL;
|
| ︙ | |||
488 489 490 491 492 493 494 | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | - - + + - + |
if (result != TCL_OK) {
goto procError;
}
if (precompiled) {
if (numArgs > procPtr->numArgs) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
526 527 528 529 530 531 532 | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | - + |
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"FORMALARGUMENTFORMAT", NULL);
goto procError;
}
if ((fieldCount == 0) || (*fieldValues[0] == 0)) {
ckfree(fieldValues);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
591 592 593 594 595 596 597 | 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 | - + - + |
if ((localPtr->nameLength != nameLength)
|| (strcmp(localPtr->name, fieldValues[0]))
|| (localPtr->frameIndex != i)
|| !(localPtr->flags & VAR_ARGUMENT)
|| (localPtr->defValuePtr == NULL && fieldCount == 2)
|| (localPtr->defValuePtr != NULL && fieldCount != 2)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
948 949 950 951 952 953 954 | 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 | - + - + |
}
/* ARGSUSED */
int
Tcl_UplevelObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1104 1105 1106 1107 1108 1109 1110 | 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 | - + + - + |
ProcWrongNumArgs(
Tcl_Interp *interp,
int skip)
{
CallFrame *framePtr = ((Interp *)interp)->varFramePtr;
register Proc *procPtr = framePtr->procPtr;
register Var *defPtr;
|
| ︙ | |||
1518 1519 1520 1521 1522 1523 1524 | 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 | + + + + + + + + + + + - - + + |
/*
* When we get here, the last formal argument remains to be defined:
* defPtr and varPtr point to the last argument to be initialized.
*/
varPtr->flags = 0;
if (defPtr && defPtr->flags & VAR_IS_ARGS) {
Tcl_Obj *listPtr;
/*
* Note that we can get the number of actual arguments (argCt) less
* than the current formal argument index (i) if there is a defaulted
* argument before 'args' that uses the default.
*/
if (argCt <= i) {
TclNewObj(listPtr);
} else {
|
| ︙ | |||
1588 1589 1590 1591 1592 1593 1594 | 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 | - + |
static int
PushProcCallFrame(
ClientData clientData, /* Record describing procedure to be
* interpreted. */
register Tcl_Interp *interp,/* Interpreter in which procedure was
* invoked. */
|
| ︙ | |||
1683 1684 1685 1686 1687 1688 1689 | 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | - + - + |
int
TclObjInterpProc(
ClientData clientData, /* Record describing procedure to be
* interpreted. */
register Tcl_Interp *interp,/* Interpreter in which procedure was
* invoked. */
|
| ︙ | |||
1990 1991 1992 1993 1994 1995 1996 | 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 | - + |
&& (codePtr->nsEpoch == nsPtr->resolverEpoch)) {
return TCL_OK;
}
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
if ((Interp *) *codePtr->interpHandle != iPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2017 2018 2019 2020 2021 2022 2023 | 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 | - + | */ Tcl_Obj *message; TclNewLiteralStringObj(message, "Compiling "); Tcl_IncrRefCount(message); Tcl_AppendStringsToObj(message, description, " \"", NULL); |
| ︙ | |||
2123 2124 2125 2126 2127 2128 2129 | 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 | - + + - + |
static void
MakeProcError(
Tcl_Interp *interp, /* The interpreter in which the procedure was
* called. */
Tcl_Obj *procNameObj) /* Name of the procedure. Used for error
* messages and trace information. */
{
|
| ︙ | |||
2474 2475 2476 2477 2478 2479 2480 | 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 | - + + |
SetLambdaFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr) /* The object to convert. */
{
Interp *iPtr = (Interp *) interp;
const char *name;
Tcl_Obj *argsPtr, *bodyPtr, *nsObjPtr, **objv;
|
| ︙ | |||
2662 2663 2664 2665 2666 2667 2668 | 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_ApplyObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2820 2821 2822 2823 2824 2825 2826 | 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 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 | - + + - + - + |
static void
MakeLambdaError(
Tcl_Interp *interp, /* The interpreter in which the procedure was
* called. */
Tcl_Obj *procNameObj) /* Name of the procedure. Used for error
* messages and trace information. */
{
|
| ︙ | |||
3014 3015 3016 3017 3018 3019 3020 | 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 | - + + |
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(objv[3]), NULL);
return TCL_ERROR;
}
procPtr = TclOOGetProcFromMethod(Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3050 3051 3052 3053 3054 3055 3056 | 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 | - + |
/*
* Do the actual disassembly.
*/
if (((ByteCode *) codeObjPtr->internalRep.twoPtrValue.ptr1)->flags
& TCL_BYTECODE_PRECOMPILED) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ |
Changes to generic/tclRegexp.c.
| ︙ | |||
196 197 198 199 200 201 202 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - + |
regexp->objPtr = NULL;
/*
* Convert the string to Unicode and perform the match.
*/
Tcl_DStringInit(&ds);
|
| ︙ | |||
429 430 431 432 433 434 435 | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | - + |
int nmatches, /* How many subexpression matches (counting
* the whole match as subexpression 0) are of
* interest. -1 means all of them. */
int flags) /* Regular expression execution flags. */
{
TclRegexp *regexpPtr = (TclRegexp *) re;
Tcl_UniChar *udata;
|
| ︙ | |||
565 566 567 568 569 570 571 | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | - + |
* the interp regexp cache. */
Tcl_Obj *objPtr, /* Object whose string rep contains regular
* expression pattern. Internal rep will be
* changed to compiled form of this regular
* expression. */
int flags) /* Regular expression compilation flags. */
{
|
| ︙ | |||
678 679 680 681 682 683 684 | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | - + |
* Now append a list of all the bit-flags set for the RE.
*/
TclNewObj(infoObj);
for (inf=infonames ; inf->bit != 0 ; inf++) {
if (regexpPtr->re.re_info & inf->bit) {
Tcl_ListObjAppendElement(NULL, infoObj,
|
| ︙ |
Changes to generic/tclResult.c.
| ︙ | |||
437 438 439 440 441 442 443 | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - + |
* extended. */
const char *element) /* String to convert to list element and add
* to result. */
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1);
Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr);
|
| ︙ | |||
614 615 616 617 618 619 620 | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | - + + |
while (1) {
char *elem = va_arg(argList, char *);
if (elem == NULL) {
break;
}
|
| ︙ | |||
858 859 860 861 862 863 864 | 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 | - + - + |
if (iPtr->errorInfo) {
Tcl_DecrRefCount(iPtr->errorInfo);
iPtr->errorInfo = NULL;
}
Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORINFO],
&valuePtr);
if (valuePtr != NULL) {
|
| ︙ | |||
947 948 949 950 951 952 953 | 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 | - + - + - |
*
*----------------------------------------------------------------------
*/
int
TclMergeReturnOptions(
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | 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 | - + - + - + - + |
/*
* Check for bogus -errorcode value.
*/
Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORCODE], &valuePtr);
if (valuePtr != NULL) {
|
| ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 | - + + |
*/
int
Tcl_SetReturnOptions(
Tcl_Interp *interp,
Tcl_Obj *options)
{
|
| ︙ |
Changes to generic/tclScan.c.
| ︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + | * Declarations for functions used only in this file. */ static const char * BuildCharSet(CharSet *cset, const char *format); static int CharInSet(CharSet *cset, int ch); static void ReleaseCharSet(CharSet *cset); static int ValidateFormat(Tcl_Interp *interp, const char *format, |
| ︙ | |||
246 247 248 249 250 251 252 | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | - + - + |
*----------------------------------------------------------------------
*/
static int
ValidateFormat(
Tcl_Interp *interp, /* Current interpreter. */
const char *format, /* The format string. */
|
| ︙ | |||
330 331 332 333 334 335 336 | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | - + |
notXpg:
gotSequential = 1;
if (gotXpg) {
mixedXPG:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot mix \"%\" and \"%n$\" conversion specifiers",
|
| ︙ | |||
377 378 379 380 381 382 383 | 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 | - + - - - + + + + - + |
*/
switch (ch) {
case 'c':
if (flags & SCAN_WIDTH) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"field width may not be specified in %c conversion",
|
| ︙ | |||
449 450 451 452 453 454 455 | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | - + - - - + + + | goto badSet; } format += Tcl_UtfToUniChar(format, &ch); } break; badSet: Tcl_SetObjResult(interp, Tcl_NewStringObj( |
| ︙ | |||
505 506 507 508 509 510 511 | 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 | - + - + - + - + |
if (totalSubs) {
*totalSubs = numVars;
}
for (i = 0; i < numVars; i++) {
if (nassign[i] > 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"variable is assigned by multiple \"%n$\" conversion specifiers",
|
| ︙ | |||
564 565 566 567 568 569 570 | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | - + - - + + |
*/
/* ARGSUSED */
int
Tcl_ScanObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
922 923 924 925 926 927 928 | 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 | - + - + |
if (TclGetString(objPtr)[0] == '-') {
wideValue++; /* WIDE_MAX + 1 = WIDE_MIN */
}
}
if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) {
sprintf(buf, "%" TCL_LL_MODIFIER "u",
(Tcl_WideUInt)wideValue);
|
| ︙ |
Changes to generic/tclStrToD.c.
| ︙ | |||
372 373 374 375 376 377 378 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | - - - + + + | * number in a format recognized by Tcl. * * The arguments bytes, numBytes, and objPtr are the inputs which * determine the string to be parsed. If bytes is non-NULL, it points to * the first byte to be scanned. If bytes is NULL, then objPtr must be * non-NULL, and the string representation of objPtr will be scanned * (generated first, if necessary). The numBytes argument determines the |
| ︙ | |||
467 468 469 470 471 472 473 | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | - + |
Tcl_Interp *interp, /* Used for error reporting. May be NULL. */
Tcl_Obj *objPtr, /* Object to receive the internal rep. */
const char *expected, /* Description of the type of number the
* caller expects to be able to parse
* ("integer", "boolean value", etc.). */
const char *bytes, /* Pointer to the start of the string to
* scan. */
|
| ︙ | |||
1070 1071 1072 1073 1074 1075 1076 | 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | - + |
while (len != 0 && TclIsSpaceProc(*p)) {
p++;
len--;
}
}
if (endPtrPtr == NULL) {
|
| ︙ | |||
1309 1310 1311 1312 1313 1314 1315 | 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 | - + |
if (status != TCL_OK) {
if (interp != NULL) {
Tcl_Obj *msg = Tcl_ObjPrintf("expected %s but got \"",
expected);
Tcl_AppendLimitedToObj(msg, bytes, numBytes, 50, "");
|
| ︙ | |||
4434 4435 4436 4437 4438 4439 4440 | 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 | - + - + |
/*
* Infinite values can't convert to bignum.
*/
if (TclIsInfinite(d)) {
if (interp != NULL) {
|
| ︙ |
Changes to generic/tclStringObj.c.
| ︙ | |||
49 50 51 52 53 54 55 | 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 | - + + - + - + - + - + - - + + - - + + - - + + | /* * Prototypes for functions defined later in this file: */ static void AppendPrintfToObjVA(Tcl_Obj *objPtr, const char *format, va_list argList); static void AppendUnicodeToUnicodeRep(Tcl_Obj *objPtr, |
| ︙ | |||
101 102 103 104 105 106 107 | 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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | - - - - - - + + + + + + + - + - + - + - - + + - + - + - + - + - + - + |
* Under normal configurations, what Tcl calls "Unicode" is actually UTF-16
* restricted to the Basic Multilingual Plane (i.e. U+00000 to U+0FFFF). This
* can be officially modified by altering the definition of Tcl_UniChar in
* tcl.h, but do not do that unless you are sure what you're doing!
*/
typedef struct {
|
| ︙ | |||
180 181 182 183 184 185 186 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | - + - + - + - - + + + - + + + - + - + - + + - + + |
#ifndef TCL_MIN_UNICHAR_GROWTH
#define TCL_MIN_UNICHAR_GROWTH TCL_MIN_GROWTH/sizeof(Tcl_UniChar)
#endif
static void
GrowStringBuffer(
Tcl_Obj *objPtr,
|
| ︙ | |||
311 312 313 314 315 316 317 | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | - + - + - + - + - + |
#ifdef TCL_MEM_DEBUG
#undef Tcl_NewStringObj
Tcl_Obj *
Tcl_NewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
|
| ︙ | |||
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 | - + - + - + - + - + |
*/
#ifdef TCL_MEM_DEBUG
Tcl_Obj *
Tcl_DbNewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
|
| ︙ | |||
431 432 433 434 435 436 437 | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | - + |
*---------------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_NewUnicodeObj(
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
* new object. */
|
| ︙ | |||
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 503 504 505 506 507 508 509 510 511 512 | - + - + - + - + | * Side effects: * Frees old internal rep. Allocates memory for new "String" internal * rep. * *---------------------------------------------------------------------- */ |
| ︙ | |||
531 532 533 534 535 536 537 | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | - + |
*----------------------------------------------------------------------
*/
Tcl_UniChar
Tcl_GetUniChar(
Tcl_Obj *objPtr, /* The object to get the Unicode charater
* from. */
|
| ︙ | |||
559 560 561 562 563 564 565 | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | - + |
stringPtr = GET_STRING(objPtr);
if (stringPtr->hasUnicode == 0) {
/*
* If numChars is unknown, compute it.
*/
|
| ︙ | |||
621 622 623 624 625 626 627 | 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | - + |
*----------------------------------------------------------------------
*/
Tcl_UniChar *
Tcl_GetUnicodeFromObj(
Tcl_Obj *objPtr, /* The object to find the unicode string
* for. */
|
| ︙ | |||
663 664 665 666 667 668 669 | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | - - + + |
*
*----------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_GetRange(
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
|
| ︙ | |||
693 694 695 696 697 698 699 | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | - + |
stringPtr = GET_STRING(objPtr);
if (stringPtr->hasUnicode == 0) {
/*
* If numChars is unknown, compute it.
*/
|
| ︙ | |||
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 783 | - - - + + + + - + |
*/
void
Tcl_SetStringObj(
Tcl_Obj *objPtr, /* Object whose internal rep to init. */
const char *bytes, /* Points to the first of the length bytes
* used to initialize the object. */
|
| ︙ | |||
794 795 796 797 798 799 800 | 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 | - + - + - + |
*----------------------------------------------------------------------
*/
void
Tcl_SetObjLength(
Tcl_Obj *objPtr, /* Pointer to object. This object must not
* currently be shared. */
|
| ︙ | |||
843 844 845 846 847 848 849 | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | - + | objPtr->length = length; objPtr->bytes[length] = 0; /* * Invalidate the unicode data. */ |
| ︙ | |||
899 900 901 902 903 904 905 | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_AttemptSetObjLength(
Tcl_Obj *objPtr, /* Pointer to object. This object must not
* currently be shared. */
|
| ︙ | |||
953 954 955 956 957 958 959 | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | - + | objPtr->length = length; objPtr->bytes[length] = 0; /* * Invalidate the unicode data. */ |
| ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | 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 | - + - + - + - - + + + + + + - + - + |
*/
void
Tcl_SetUnicodeObj(
Tcl_Obj *objPtr, /* The object to set the string of. */
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
* object. */
|
| ︙ | |||
1090 1091 1092 1093 1094 1095 1096 | 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 | - - - - + + + + + - + - + |
*/
void
Tcl_AppendLimitedToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* Points to the bytes to append to the
* object. */
|
| ︙ | |||
1171 1172 1173 1174 1175 1176 1177 | 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 | - - - + + + + - + - + |
*/
void
Tcl_AppendToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* Points to the bytes to append to the
* object. */
|
| ︙ | |||
1256 1257 1258 1259 1260 1261 1262 | 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | - + |
void
Tcl_AppendObjToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
Tcl_Obj *appendObjPtr) /* Object to append. */
{
String *stringPtr;
|
| ︙ | |||
1278 1279 1280 1281 1282 1283 1284 | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | - + |
* it did, then appending the byte arrays together could well lose
* information; this is a special-case optimization only.
*/
if ((TclIsPureByteArray(objPtr) || objPtr->bytes == tclEmptyStringRep)
&& TclIsPureByteArray(appendObjPtr)) {
unsigned char *bytesSrc;
|
| ︙ | |||
1339 1340 1341 1342 1343 1344 1345 | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | - + + - + |
* in both objects before appending, then set the combined number of
* characters in the final (appended-to) object.
*/
bytes = TclGetStringFromObj(appendObjPtr, &length);
numChars = stringPtr->numChars;
|
| ︙ | |||
1376 1377 1378 1379 1380 1381 1382 | 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 | - + - + |
*----------------------------------------------------------------------
*/
static void
AppendUnicodeToUnicodeRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const Tcl_UniChar *unicode, /* String to append. */
|
| ︙ | |||
1403 1404 1405 1406 1407 1408 1409 | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | - + |
* explanation of this growth algorithm.
*/
numChars = stringPtr->numChars + appendNumChars;
stringCheckLimits(numChars);
if (numChars > stringPtr->maxChars) {
|
| ︙ | |||
1463 1464 1465 1466 1467 1468 1469 | 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 | - + - + |
*----------------------------------------------------------------------
*/
static void
AppendUnicodeToUtfRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const Tcl_UniChar *unicode, /* String to convert to UTF. */
|
| ︙ | |||
1504 1505 1506 1507 1508 1509 1510 | 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 | - + - + |
*----------------------------------------------------------------------
*/
static void
AppendUtfToUnicodeRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* String to convert to Unicode. */
|
| ︙ | |||
1540 1541 1542 1543 1544 1545 1546 | 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 | - + - + - + - + |
*----------------------------------------------------------------------
*/
static void
AppendUtfToUtfRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* String to append. */
|
| ︙ | |||
1598 1599 1600 1601 1602 1603 1604 | 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 | - + |
}
}
/*
* Invalidate the unicode data.
*/
|
| ︙ | |||
1639 1640 1641 1642 1643 1644 1645 | 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 | - + |
while (1) {
const char *bytes = va_arg(argList, char *);
if (bytes == NULL) {
break;
}
|
| ︙ | |||
1698 1699 1700 1701 1702 1703 1704 | 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 | - + + - - + + |
*/
int
Tcl_AppendFormatToObj(
Tcl_Interp *interp,
Tcl_Obj *appendObj,
const char *format,
|
| ︙ | |||
1726 1727 1728 1729 1730 1731 1732 | 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 | - + + |
* Format string is NUL-terminated.
*/
while (*format != '\0') {
char *end;
int gotMinus, gotHash, gotZero, gotSpace, gotPlus, sawFlag;
int width, gotPrecision, precision, useShort, useWide, useBig;
|
| ︙ | |||
1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 | 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | + + + - + + |
newXpg = 0;
if (isdigit(UCHAR(ch))) {
int position = strtoul(format, &end, 10);
if (*end == '$') {
newXpg = 1;
if (position == 0) {
goto badXpgIndex;
}
objIndex = position - 1;
format = end + 1;
step = Tcl_UtfToUniChar(format, &ch);
}
}
if (newXpg) {
if (gotSequential) {
msg = mixedXPG;
errCode = "MIXEDSPECTYPES";
goto errorMsg;
}
gotXpg = 1;
} else {
if (gotXpg) {
msg = mixedXPG;
errCode = "MIXEDSPECTYPES";
goto errorMsg;
}
gotSequential = 1;
}
|
| ︙ | |||
1929 1930 1931 1932 1933 1934 1935 | 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 | - + | span = format; /* * Step 6. The actual conversion character. */ segment = objv[objIndex]; |
| ︙ | |||
2060 2061 2062 2063 2064 2065 2066 | 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 | - + |
segmentLimit -= 2;
break;
}
}
switch (ch) {
case 'd': {
|
| ︙ | |||
2337 2338 2339 2340 2341 2342 2343 | 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 | - + |
case 'E':
case 'G':
case 'X': {
Tcl_SetObjLength(segment, Tcl_UtfToUpper(TclGetString(segment)));
}
}
|
| ︙ | |||
2391 2392 2393 2394 2395 2396 2397 | 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 | - + |
numBytes = 0;
}
return TCL_OK;
errorMsg:
if (interp != NULL) {
|
| ︙ | |||
2417 2418 2419 2420 2421 2422 2423 | 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 | - + |
*---------------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_Format(
Tcl_Interp *interp,
const char *format,
|
| ︙ | |||
2449 2450 2451 2452 2453 2454 2455 | 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 | - + + |
static void
AppendPrintfToObjVA(
Tcl_Obj *objPtr,
const char *format,
va_list argList)
{
|
| ︙ | |||
2504 2505 2506 2507 2508 2509 2510 | 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 | - + |
q = bytes + TCL_UTF_MAX;
while ((bytes < end) && (bytes < q)
&& ((*bytes & 0xC0) == 0x80)) {
bytes++;
}
Tcl_ListObjAppendElement(NULL, list,
|
| ︙ | |||
2653 2654 2655 2656 2657 2658 2659 | 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 | - + |
*---------------------------------------------------------------------------
*/
static void
ReverseBytes(
unsigned char *to, /* Copy bytes into here... */
unsigned char *from, /* ...from here... */
|
| ︙ | |||
2679 2680 2681 2682 2683 2684 2685 | 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 | - + |
TclStringObjReverse(
Tcl_Obj *objPtr)
{
String *stringPtr;
Tcl_UniChar ch;
if (TclIsPureByteArray(objPtr)) {
|
| ︙ | |||
2732 2733 2734 2735 2736 2737 2738 | 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 | - + - - - - + + + + |
if (Tcl_IsShared(objPtr)) {
objPtr = Tcl_NewObj();
Tcl_SetObjLength(objPtr, numBytes);
}
to = objPtr->bytes;
|
| ︙ | |||
2802 2803 2804 2805 2806 2807 2808 | 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 | - - + + - + |
stringPtr->numChars);
}
static void
ExtendUnicodeRepWithString(
Tcl_Obj *objPtr,
const char *bytes,
|
| ︙ | |||
2860 2861 2862 2863 2864 2865 2866 | 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 | - + |
Tcl_Obj *copyPtr) /* Object with internal rep to set. Must not
* currently have an internal rep.*/
{
String *srcStringPtr = GET_STRING(srcPtr);
String *copyStringPtr = NULL;
#if COMPAT==0
|
| ︙ | |||
2979 2980 2981 2982 2983 2984 2985 | 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 | - + | TclFreeIntRep(objPtr); /* * Create a basic String intrep that just points to the UTF-8 string * already in place at objPtr->bytes. */ |
| ︙ | |||
3025 3026 3027 3028 3029 3030 3031 | 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 | - + - + - + |
}
}
static int
ExtendStringRepWithUnicode(
Tcl_Obj *objPtr,
const Tcl_UniChar *unicode,
|
| ︙ | |||
3057 3058 3059 3060 3061 3062 3063 | 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 | - - - - - + + + + + + + |
*/
if (numChars <= (INT_MAX - size)/TCL_UTF_MAX
&& stringPtr->allocated >= size + numChars * TCL_UTF_MAX) {
goto copyBytes;
}
|
| ︙ |
Changes to generic/tclStubInit.c.
| ︙ | |||
232 233 234 235 236 237 238 239 240 241 242 243 244 245 | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | + + + |
static int formatInt(char *buffer, int n){
return TclFormatInt(buffer, (long)n);
}
#define TclFormatInt (int(*)(char *, long))formatInt
#endif
#else /* UNIX and MAC */
# define TclpLocaltime_unix TclpLocaltime
# define TclpGmtime_unix TclpGmtime
#endif
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
* below should be made in the generic/tcl.decls script.
*/
|
| ︙ |
Changes to generic/tclTest.c.
| ︙ | |||
146 147 148 149 150 151 152 | 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 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | - + + - + + - + - + - + - + - + + - + - - + + - + - - + + - + + - + + - + - - + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - - + + - + + - + - + - + - + - + + - + + - + - + + - + - + - + + - + - + + - + + - + + - + + - + + - + - + + - + + - + - + + - + + - + + - - - + + + + + - + - + - + - + - + - + - + - + + - + + - + + - + + - + - + + - + + - + + - + + - + - + - + + - + + - + - - + + | static Tcl_ThreadCreateType AsyncThreadProc(ClientData); #endif static void CleanupTestSetassocdataTests( ClientData clientData, Tcl_Interp *interp); static void CmdDelProc1(ClientData clientData); static void CmdDelProc2(ClientData clientData); static int CmdProc1(ClientData clientData, |
| ︙ | |||
376 377 378 379 380 381 382 | 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 | - + - + - + - + - + | static Tcl_FSAccessProc SimpleAccess; static Tcl_FSOpenFileChannelProc SimpleOpenFileChannel; static Tcl_FSListVolumesProc SimpleListVolumes; static Tcl_FSPathInFilesystemProc SimplePathInFilesystem; static Tcl_Obj * SimpleRedirect(Tcl_Obj *pathPtr); static Tcl_FSMatchInDirectoryProc SimpleMatchInDirectory; static int TestNumUtfCharsCmd(ClientData clientData, |
| ︙ | |||
500 501 502 503 504 505 506 | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | + - + |
int
Tcltest_Init(
Tcl_Interp *interp) /* Interpreter for application. */
{
Tcl_Obj *listPtr;
Tcl_Obj **objv;
size_t objc;
|
| ︙ | |||
758 759 760 761 762 763 764 | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | - + |
*/
/* ARGSUSED */
static int
TestasyncCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
838 839 840 841 842 843 844 | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | - + |
for (asyncPtr = firstHandler; asyncPtr != NULL;
asyncPtr = asyncPtr->nextPtr) {
if (asyncPtr->id == id) {
Tcl_AsyncMark(asyncPtr->handler);
break;
}
}
|
| ︙ | |||
985 986 987 988 989 990 991 | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | - + |
*/
/* ARGSUSED */
static int
TestcmdinfoCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1056 1057 1058 1059 1060 1061 1062 | 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 | - + - + - - + + - - + + |
}
/*ARGSUSED*/
static int
CmdProc1(
ClientData clientData, /* String to return. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1115 1116 1117 1118 1119 1120 1121 | 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 | - + |
*/
/* ARGSUSED */
static int
TestcmdtokenCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1179 1180 1181 1182 1183 1184 1185 | 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 | - + |
*/
/* ARGSUSED */
static int
TestcmdtraceCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1276 1277 1278 1279 1280 1281 1282 | 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 | - + |
Tcl_Interp *interp, /* Current interpreter. */
int level, /* Current trace level. */
char *command, /* The command being traced (after
* substitutions). */
Tcl_CmdProc *cmdProc, /* Points to command's command procedure. */
ClientData cmdClientData, /* Client data associated with command
* procedure. */
|
| ︙ | |||
1301 1302 1303 1304 1305 1306 1307 | 1344 1345 1346 1347 1348 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 | - + - - + + - + - + |
Tcl_Interp *interp, /* Current interpreter. */
int level, /* Current trace level. */
char *command, /* The command being traced (after
* substitutions). */
Tcl_CmdProc *cmdProc, /* Points to command's command procedure. */
ClientData cmdClientData, /* Client data associated with command
* procedure. */
|
| ︙ | |||
1374 1375 1376 1377 1378 1379 1380 | 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | - + |
*----------------------------------------------------------------------
*/
static int
TestcreatecommandCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1404 1405 1406 1407 1408 1409 1410 | 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | - + |
return TCL_OK;
}
static int
CreatedCommandProc(
ClientData clientData, /* String to return. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1426 1427 1428 1429 1430 1431 1432 | 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | - + |
return TCL_OK;
}
static int
CreatedCommandProc2(
ClientData clientData, /* String to return. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1465 1466 1467 1468 1469 1470 1471 | 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 | - + + - + - + - - + - |
*/
/* ARGSUSED */
static int
TestdcallCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1530 1531 1532 1533 1534 1535 1536 | 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 | - + |
*/
/* ARGSUSED */
static int
TestdelCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1560 1561 1562 1563 1564 1565 1566 | 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 | - + |
return TCL_OK;
}
static int
DelCmdProc(
ClientData clientData, /* String result to return. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1605 1606 1607 1608 1609 1610 1611 | 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 | - + |
*----------------------------------------------------------------------
*/
static int
TestdelassocdataCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1639 1640 1641 1642 1643 1644 1645 | 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 | - - - + + + - - - - + + - | * type - One of 'shortest', 'Steele', 'e', 'f' * shorten - Indicates that the 'shorten' flag should be passed in. * *----------------------------------------------------------------------------- */ static int |
| ︙ | |||
1689 1690 1691 1692 1693 1694 1695 | 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | - - + + - + + |
|| TclIsNaN(objv[1]->internalRep.doubleValue)) {
status = TCL_OK;
memcpy(&d, &(objv[1]->internalRep.doubleValue), sizeof(double));
}
}
if (status != TCL_OK
|| Tcl_GetIntFromObj(interp, objv[2], &ndigits) != TCL_OK
|
| ︙ | |||
1735 1736 1737 1738 1739 1740 1741 | 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | - + |
*/
/* ARGSUSED */
static int
TestdstringCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1786 1787 1788 1789 1790 1791 1792 | 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 | - + |
} else if (strcmp(argv[2], "staticlarge") == 0) {
Tcl_AppendResult(interp, "first0 first1 first2 first3 first4 first5 first6 first7 first8 first9\nsecond0 second1 second2 second3 second4 second5 second6 second7 second8 second9\nthird0 third1 third2 third3 third4 third5 third6 third7 third8 third9\nfourth0 fourth1 fourth2 fourth3 fourth4 fourth5 fourth6 fourth7 fourth8 fourth9\nfifth0 fifth1 fifth2 fifth3 fifth4 fifth5 fifth6 fifth7 fifth8 fifth9\nsixth0 sixth1 sixth2 sixth3 sixth4 sixth5 sixth6 sixth7 sixth8 sixth9\nseventh0 seventh1 seventh2 seventh3 seventh4 seventh5 seventh6 seventh7 seventh8 seventh9\n", NULL);
} else if (strcmp(argv[2], "free") == 0) {
char *s = ckalloc(100);
strcpy(s, "This is a malloc-ed string");
Tcl_SetResult(interp, s, TCL_DYNAMIC);
} else if (strcmp(argv[2], "special") == 0) {
|
| ︙ | |||
1862 1863 1864 1865 1866 1867 1868 | 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 | - + - + + |
*/
/* ARGSUSED */
static int
TestencodingObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1927 1928 1929 1930 1931 1932 1933 | 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 | - + - - - - + + + + - + |
return TCL_OK;
}
static int
EncodingToUtfProc(
ClientData clientData, /* TclEncoding structure. */
const char *src, /* Source string in specified encoding. */
|
| ︙ | |||
1959 1960 1961 1962 1963 1964 1965 | 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 | - + - - - - + + + + - + |
return TCL_OK;
}
static int
EncodingFromUtfProc(
ClientData clientData, /* TclEncoding structure. */
const char *src, /* Source string in specified encoding. */
|
| ︙ | |||
2019 2020 2021 2022 2023 2024 2025 | 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 | - + - + + |
*----------------------------------------------------------------------
*/
static int
TestevalexObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2064 2065 2066 2067 2068 2069 2070 | 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 | - + |
*----------------------------------------------------------------------
*/
static int
TestevalobjvObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2113 2114 2115 2116 2117 2118 2119 | 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 | - + |
*----------------------------------------------------------------------
*/
static int
TesteventObjCmd(
ClientData unused, /* Not used */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
2292 2293 2294 2295 2296 2297 2298 | 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 | - + |
*----------------------------------------------------------------------
*/
static int
TestexithandlerCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2368 2369 2370 2371 2372 2373 2374 | 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 | - + |
*----------------------------------------------------------------------
*/
static int
TestexprlongCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2411 2412 2413 2414 2415 2416 2417 | 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 | - + |
*----------------------------------------------------------------------
*/
static int
TestexprlongobjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2453 2454 2455 2456 2457 2458 2459 | 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 | - + |
*----------------------------------------------------------------------
*/
static int
TestexprdoubleCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2497 2498 2499 2500 2501 2502 2503 | 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 | - + |
*----------------------------------------------------------------------
*/
static int
TestexprdoubleobjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2539 2540 2541 2542 2543 2544 2545 | 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 | - + |
*----------------------------------------------------------------------
*/
static int
TestexprstringCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2571 2572 2573 2574 2575 2576 2577 | 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 | - + |
*----------------------------------------------------------------------
*/
static int
TestfilelinkCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2638 2639 2640 2641 2642 2643 2644 | 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 | - + |
*----------------------------------------------------------------------
*/
static int
TestgetassocdataCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2676 2677 2678 2679 2680 2681 2682 | 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 | - + |
*----------------------------------------------------------------------
*/
static int
TestgetplatformCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2717 2718 2719 2720 2721 2722 2723 | 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 | - + |
*/
/* ARGSUSED */
static int
TestinterpdeleteCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2758 2759 2760 2761 2762 2763 2764 | 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 | - + |
*/
/* ARGSUSED */
static int
TestlinkCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3013 3014 3015 3016 3017 3018 3019 | 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 | - + |
stringVar = NULL;
} else {
stringVar = ckalloc(strlen(argv[5]) + 1);
strcpy(stringVar, argv[5]);
}
}
if (argv[6][0] != 0) {
|
| ︙ | |||
3071 3072 3073 3074 3075 3076 3077 | 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 | - + |
if (Tcl_GetDouble(interp, argv[14], &d) != TCL_OK) {
return TCL_ERROR;
}
floatVar = (float) d;
}
if (argv[15][0]) {
Tcl_WideInt w;
|
| ︙ | |||
3121 3122 3123 3124 3125 3126 3127 | 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 | - + |
} else {
stringVar = ckalloc(strlen(argv[5]) + 1);
strcpy(stringVar, argv[5]);
}
Tcl_UpdateLinkedVar(interp, "string");
}
if (argv[6][0] != 0) {
|
| ︙ | |||
3188 3189 3190 3191 3192 3193 3194 | 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 | - + |
return TCL_ERROR;
}
floatVar = (float) d;
Tcl_UpdateLinkedVar(interp, "float");
}
if (argv[15][0]) {
Tcl_WideInt w;
|
| ︙ | |||
3226 3227 3228 3229 3230 3231 3232 | 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 | - + |
*----------------------------------------------------------------------
*/
static int
TestlocaleCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3262 3263 3264 3265 3266 3267 3268 | 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 | - + |
if (objc == 3) {
locale = Tcl_GetString(objv[2]);
} else {
locale = NULL;
}
locale = setlocale(lcTypes[index], locale);
if (locale) {
|
| ︙ | |||
3313 3314 3315 3316 3317 3318 3319 | 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 3380 3381 3382 3383 3384 3385 3386 | - + - + + - + |
*----------------------------------------------------------------------
*/
static int
TestparserObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3369 3370 3371 3372 3373 3374 3375 | 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 3438 3439 3440 3441 3442 3443 | - + - + + - + |
*----------------------------------------------------------------------
*/
static int
TestexprparserObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3435 3436 3437 3438 3439 3440 3441 | 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 | - + |
Tcl_Interp *interp, /* Interpreter whose result is to be set to
* the contents of a parse structure. */
Tcl_Parse *parsePtr) /* Parse structure to print out. */
{
Tcl_Obj *objPtr;
const char *typeString;
Tcl_Token *tokenPtr;
|
| ︙ | |||
3484 3485 3486 3487 3488 3489 3490 | 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 | - + - - + + - - - + + - + | typeString = "operator"; break; default: typeString = "??"; break; } Tcl_ListObjAppendElement(NULL, objPtr, |
| ︙ | |||
3557 3558 3559 3560 3561 3562 3563 | 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 | - + - + + - + |
*----------------------------------------------------------------------
*/
static int
TestparsevarnameObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3622 3623 3624 3625 3626 3627 3628 | 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 | - + - - + + |
*/
/* ARGSUSED */
static int
TestregexpObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3853 3854 3855 3856 3857 3858 3859 | 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 | - - + + + - + | * regexec flags word, as appropriate. * *---------------------------------------------------------------------- */ static void TestregexpXflags( |
| ︙ | |||
3946 3947 3948 3949 3950 3951 3952 | 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 | - + |
*/
/* ARGSUSED */
static int
TestreturnObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3974 3975 3976 3977 3978 3979 3980 | 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 | - + |
*----------------------------------------------------------------------
*/
static int
TestsetassocdataCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4026 4027 4028 4029 4030 4031 4032 | 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 | - + |
*----------------------------------------------------------------------
*/
static int
TestsetplatformCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4075 4076 4077 4078 4079 4080 4081 | 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 | - + |
*----------------------------------------------------------------------
*/
static int
TeststaticpkgCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4126 4127 4128 4129 4130 4131 4132 | 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 | - + |
*----------------------------------------------------------------------
*/
static int
TesttranslatefilenameCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4168 4169 4170 4171 4172 4173 4174 | 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 | - + |
*/
/* ARGSUSED */
static int
TestupvarCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4221 4222 4223 4224 4225 4226 4227 | 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 | - + |
*/
/* ARGSUSED */
static int
TestseterrorcodeCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4274 4275 4276 4277 4278 4279 4280 | 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 | - + |
*/
/* ARGSUSED */
static int
TestsetobjerrorcodeCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4303 4304 4305 4306 4307 4308 4309 | 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 | - + |
*/
/* ARGSUSED */
static int
TestfeventCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4375 4376 4377 4378 4379 4380 4381 | 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 4453 4454 4455 | - + - + |
*----------------------------------------------------------------------
*/
static int
TestpanicCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4478 4479 4480 4481 4482 4483 4484 | 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 | - + |
*----------------------------------------------------------------------
*/
static int
TestgetvarfullnameCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4556 4557 4558 4559 4560 4561 4562 | 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 | - + |
*----------------------------------------------------------------------
*/
static int
GetTimesCmd(
ClientData unused, /* Unused. */
Tcl_Interp *interp, /* The current interpreter. */
|
| ︙ | |||
4623 4624 4625 4626 4627 4628 4629 | 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 | - + |
Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per Tcl_DecrRefCount\n", timePer/5000);
ckfree(objv);
/* TclGetString 100000 times */
fprintf(stderr, "TclGetStringFromObj of \"12345\" 100000 times\n");
|
| ︙ | |||
4735 4736 4737 4738 4739 4740 4741 | 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 | - + |
*----------------------------------------------------------------------
*/
static int
NoopCmd(
ClientData unused, /* Unused. */
Tcl_Interp *interp, /* The current interpreter. */
|
| ︙ | |||
4762 4763 4764 4765 4766 4767 4768 | 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 | - + |
*----------------------------------------------------------------------
*/
static int
NoopObjCmd(
ClientData unused, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4790 4791 4792 4793 4794 4795 4796 | 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 | - + |
*/
/* ARGSUSED */
static int
TestsetCmd(
ClientData data, /* Additional flags for Get/SetVar2. */
register Tcl_Interp *interp,/* Current interpreter. */
|
| ︙ | |||
4822 4823 4824 4825 4826 4827 4828 | 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 | - + |
return TCL_ERROR;
}
}
static int
Testset2Cmd(
ClientData data, /* Additional flags for Get/SetVar2. */
register Tcl_Interp *interp,/* Current interpreter. */
|
| ︙ | |||
4873 4874 4875 4876 4877 4878 4879 | 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 | - + |
*/
/* ARGSUSED */
static int
TestsaveresultCmd(
ClientData dummy, /* Not used. */
register Tcl_Interp *interp,/* Current interpreter. */
|
| ︙ | |||
4921 4922 4923 4924 4925 4926 4927 | 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 | - + |
Tcl_SetResult(interp, buf, TCL_DYNAMIC);
break;
}
case RESULT_DYNAMIC:
Tcl_SetResult(interp, (char *)"dynamic result", TestsaveresultFree);
break;
case RESULT_OBJECT:
|
| ︙ | |||
5000 5001 5002 5003 5004 5005 5006 | 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 | - + |
*----------------------------------------------------------------------
*/
static int
TestmainthreadCmd(
ClientData dummy, /* Not used. */
register Tcl_Interp *interp,/* Current interpreter. */
|
| ︙ | |||
5061 5062 5063 5064 5065 5066 5067 | 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 | - + |
*----------------------------------------------------------------------
*/
static int
TestsetmainloopCmd(
ClientData dummy, /* Not used. */
register Tcl_Interp *interp,/* Current interpreter. */
|
| ︙ | |||
5090 5091 5092 5093 5094 5095 5096 | 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 | - + |
*----------------------------------------------------------------------
*/
static int
TestexitmainloopCmd(
ClientData dummy, /* Not used. */
register Tcl_Interp *interp,/* Current interpreter. */
|
| ︙ | |||
5119 5120 5121 5122 5123 5124 5125 | 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 | - + |
*/
/* ARGSUSED */
static int
TestChannelCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Interpreter for result. */
|
| ︙ | |||
5183 5184 5185 5186 5187 5188 5189 | 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 | - + - + |
/* lint */
statePtr = NULL;
chan = NULL;
}
if ((cmdName[0] == 's') && (strncmp(cmdName, "setchannelerror", len) == 0)) {
|
| ︙ | |||
5544 5545 5546 5547 5548 5549 5550 | 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 | - + |
if (strcmp(argv[3], "-command") != 0) {
Tcl_AppendResult(interp, "bad argument \"", argv[3],
"\": should be \"-command\"", NULL);
return TCL_ERROR;
}
return TclChannelTransform(interp, chan,
|
| ︙ | |||
5588 5589 5590 5591 5592 5593 5594 | 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 | - + |
*/
/* ARGSUSED */
static int
TestChannelEventCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
5636 5637 5638 5639 5640 5641 5642 | 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 | - + | esPtr = ckalloc(sizeof(EventScriptRecord)); esPtr->nextPtr = statePtr->scriptRecordPtr; statePtr->scriptRecordPtr = esPtr; esPtr->chanPtr = chanPtr; esPtr->interp = interp; esPtr->mask = mask; |
| ︙ | |||
5703 5704 5705 5706 5707 5708 5709 | 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 | - + + - + |
}
resultListPtr = Tcl_GetObjResult(interp);
for (esPtr = statePtr->scriptRecordPtr;
esPtr != NULL;
esPtr = esPtr->nextPtr) {
if (esPtr->mask) {
Tcl_ListObjAppendElement(interp, resultListPtr, Tcl_NewStringObj(
|
| ︙ | |||
5799 5800 5801 5802 5803 5804 5805 | 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 | - + + - + - + |
*----------------------------------------------------------------------
*/
static int
TestWrongNumArgsObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
5855 5856 5857 5858 5859 5860 5861 | 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 | - + |
*----------------------------------------------------------------------
*/
static int
TestGetIndexFromObjStructObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
5909 5910 5911 5912 5913 5914 5915 | 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 | - + - + |
*----------------------------------------------------------------------
*/
static int
TestFilesystemObjCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
6016 6017 6018 6019 6020 6021 6022 | 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 | - + | * API, but there you go. We should convert it to objects. */ Tcl_Obj *savedResult; Tcl_DString ds; Tcl_DStringInit(&ds); |
| ︙ | |||
6285 6286 6287 6288 6289 6290 6291 | 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 | - + - + - + - + |
* important features.
*/
static int
TestSimpleFilesystemObjCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
6364 6365 6366 6367 6368 6369 6370 | 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 | - + + + - + |
* We assume the same name in the current directory is ok.
*/
resPtr = Tcl_NewObj();
Tcl_IncrRefCount(resPtr);
origPtr = SimpleRedirect(dirPtr);
res = Tcl_FSMatchInDirectory(interp, resPtr, origPtr, pattern, types);
if (res == TCL_OK) {
|
| ︙ | |||
6432 6433 6434 6435 6436 6437 6438 | 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 | - + - + - + |
static Tcl_Obj *
SimpleListVolumes(void)
{
/* Add one new volume */
Tcl_Obj *retVal;
|
| ︙ | |||
6488 6489 6490 6491 6492 6493 6494 | 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
TestcpuidCmd(
ClientData dummy,
Tcl_Interp* interp, /* Tcl interpreter */
|
| ︙ | |||
6551 6552 6553 6554 6555 6556 6557 | 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 | - + + - + + - + + |
return TCL_ERROR;
}
for (i=0 ; i<limit ; i++) {
hPtr = Tcl_CreateHashEntry(&hash, INT2PTR(i), &isNew);
if (!isNew) {
Tcl_SetObjResult(interp, Tcl_NewLongObj(i));
|
| ︙ | |||
6600 6601 6602 6603 6604 6605 6606 | 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 | - + |
* Used for testing Tcl_GetInt which is no longer used directly by the
* core very much.
*/
static int
TestgetintCmd(
ClientData dummy,
Tcl_Interp *interp,
|
| ︙ | |||
6624 6625 6626 6627 6628 6629 6630 | 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 | - + |
}
}
static int
TestNRELevels(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
6680 6681 6682 6683 6684 6685 6686 | 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 | - + - + + - + - + - + |
*----------------------------------------------------------------------
*/
static int
TestconcatobjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
6853 6854 6855 6856 6857 6858 6859 | 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 | - + |
concatPtr = Tcl_ConcatObj(2, objv);
if (concatPtr->refCount != 0) {
result = TCL_ERROR;
Tcl_AppendResult(interp,
"\n\t* (e) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
|
| ︙ | |||
6885 6886 6887 6888 6889 6890 6891 | 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 | - + |
concatPtr = Tcl_ConcatObj(2, objv);
if (concatPtr->refCount != 0) {
result = TCL_ERROR;
Tcl_AppendResult(interp,
"\n\t* (f) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
|
| ︙ | |||
6918 6919 6920 6921 6922 6923 6924 | 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 | - + |
concatPtr = Tcl_ConcatObj(2, objv);
if (concatPtr->refCount != 0) {
result = TCL_ERROR;
Tcl_AppendResult(interp,
"\n\t* (g) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
|
| ︙ | |||
6983 6984 6985 6986 6987 6988 6989 | 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 | - + - + - + |
*----------------------------------------------------------------------
*/
static int
TestparseargsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
7141 7142 7143 7144 7145 7146 7147 | 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 | - + - + - + |
return var;
}
static int
InterpCompiledVarResolver(
Tcl_Interp *interp,
const char *name,
|
| ︙ |
Changes to generic/tclTestObj.c.
| ︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + - + - + - + - + - + - + - + - - - + + + - | */ static int CheckIfVarUnset(Tcl_Interp *interp, Tcl_Obj **varPtr, int varIndex); static int GetVariableIndex(Tcl_Interp *interp, const char *string, int *indexPtr); static void SetVarToObj(Tcl_Obj **varPtr, int varIndex, Tcl_Obj *objPtr); static int TestbignumobjCmd(ClientData dummy, Tcl_Interp *interp, |
| ︙ | |||
150 151 152 153 154 155 156 | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | - + |
*----------------------------------------------------------------------
*/
static int
TestbignumobjCmd(
ClientData clientData, /* unused */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
187 188 189 190 191 192 193 | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | - + - + |
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "var value");
return TCL_ERROR;
}
string = Tcl_GetString(objv[3]);
if (mp_init(&bignumValue) != MP_OKAY) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
239 240 241 242 243 244 245 | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | - + |
return TCL_ERROR;
}
if (mp_init(&newValue) != MP_OKAY
|| (mp_mul_d(&bignumValue, 10, &newValue) != MP_OKAY)) {
mp_clear(&bignumValue);
mp_clear(&newValue);
Tcl_SetObjResult(interp,
|
| ︙ | |||
267 268 269 270 271 272 273 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + |
return TCL_ERROR;
}
if (mp_init(&newValue) != MP_OKAY
|| (mp_div_d(&bignumValue, 10, &newValue, NULL) != MP_OKAY)) {
mp_clear(&bignumValue);
mp_clear(&newValue);
Tcl_SetObjResult(interp,
|
| ︙ | |||
304 305 306 307 308 309 310 | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | - + |
*----------------------------------------------------------------------
*/
static int
TestbooleanobjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
404 405 406 407 408 409 410 | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | - + |
*----------------------------------------------------------------------
*/
static int
TestdoubleobjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
522 523 524 525 526 527 528 | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | - + |
*----------------------------------------------------------------------
*/
static int
TestindexobjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
563 564 565 566 567 568 569 | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | - + |
if (result == TCL_OK) {
Tcl_SetLongObj(Tcl_GetObjResult(interp), index);
}
return result;
}
if (objc < 5) {
|
| ︙ | |||
626 627 628 629 630 631 632 | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | - + |
*----------------------------------------------------------------------
*/
static int
TestintobjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
721 722 723 724 725 726 727 | 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 | - + - + - + - + - + |
if (CheckIfVarUnset(interp, varPtr,varIndex)) {
return TCL_ERROR;
}
if (Tcl_GetLongFromObj(interp, varPtr[varIndex], &longValue) != TCL_OK) {
return TCL_ERROR;
}
Tcl_AppendToObj(Tcl_GetObjResult(interp),
|
| ︙ | |||
830 831 832 833 834 835 836 | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 | - + |
*-----------------------------------------------------------------------------
*/
static int
TestlistobjCmd(
ClientData clientData, /* Not used */
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
927 928 929 930 931 932 933 | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | - + |
*----------------------------------------------------------------------
*/
static int
TestobjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | - + - + |
* internal rep. If none exists, return "none".
*/
if (objc != 3) {
goto wrongNumArgs;
}
if (objv[2]->typePtr == NULL) {
|
| ︙ | |||
1086 1087 1088 1089 1090 1091 1092 | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 | - + - + |
if (GetVariableIndex(interp, index, &varIndex) != TCL_OK) {
return TCL_ERROR;
}
if (CheckIfVarUnset(interp, varPtr,varIndex)) {
return TCL_ERROR;
}
if (varPtr[varIndex]->typePtr == NULL) { /* a string! */
|
| ︙ | |||
1131 1132 1133 1134 1135 1136 1137 | 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | - + + |
*----------------------------------------------------------------------
*/
static int
TeststringobjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1183 1184 1185 1186 1187 1188 1189 | 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 | - + |
* "copy on write" and append to a copy of the object.
*/
if (Tcl_IsShared(varPtr[varIndex])) {
SetVarToObj(varPtr, varIndex, Tcl_DuplicateObj(varPtr[varIndex]));
}
string = Tcl_GetString(objv[3]);
|
| ︙ | |||
1231 1232 1233 1234 1235 1236 1237 | 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 | - + |
if (objc != 3) {
goto wrongNumArgs;
}
if (CheckIfVarUnset(interp, varPtr, varIndex)) {
return TCL_ERROR;
}
string = Tcl_GetString(varPtr[varIndex]);
|
| ︙ | |||
1268 1269 1270 1271 1272 1273 1274 | 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | - + + | * varIndex has ref count 1 (i.e. the object is unshared) we can * modify that object directly. Otherwise, if RC>1 (i.e. the * object is shared), we must create a new object to modify/set * and decrement the old formerly-shared object's ref count. This * is "copy on write". */ |
| ︙ | |||
1302 1303 1304 1305 1306 1307 1308 | 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | - + |
if (objc != 3) {
goto wrongNumArgs;
}
if (varPtr[varIndex] != NULL) {
Tcl_ConvertToType(NULL, varPtr[varIndex],
Tcl_GetObjType("string"));
strPtr = varPtr[varIndex]->internalRep.twoPtrValue.ptr1;
|
| ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 | - + + - + |
* "copy on write" and append to a copy of the object.
*/
if (Tcl_IsShared(varPtr[varIndex])) {
SetVarToObj(varPtr, varIndex, Tcl_DuplicateObj(varPtr[varIndex]));
}
|
| ︙ | |||
1362 1363 1364 1365 1366 1367 1368 | 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 | - + + - + |
* "copy on write" and append to a copy of the object.
*/
if (Tcl_IsShared(varPtr[varIndex])) {
SetVarToObj(varPtr, varIndex, Tcl_DuplicateObj(varPtr[varIndex]));
}
|
| ︙ | |||
1446 1447 1448 1449 1450 1451 1452 | 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | - + + |
int index;
if (Tcl_GetInt(interp, string, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index < 0 || index >= NUMBER_OF_OBJECT_VARS) {
Tcl_ResetResult(interp);
|
| ︙ | |||
1483 1484 1485 1486 1487 1488 1489 | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | - + |
int varIndex) /* Index of the test variable to check. */
{
if (varPtr[varIndex] == NULL) {
char buf[32 + TCL_INTEGER_SPACE];
sprintf(buf, "variable %d is unset (NULL)", varIndex);
Tcl_ResetResult(interp);
|
Changes to generic/tclTestProcBodyObj.c.
| ︙ | |||
40 41 42 43 44 45 46 | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - - + + |
int exportIt; /* if 1, export the command */
} CmdTable;
/*
* Declarations for functions defined in this file.
*/
|
| ︙ | |||
130 131 132 133 134 135 136 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - + |
*----------------------------------------------------------------------
*/
static int
RegisterCommand(
Tcl_Interp* interp, /* the Tcl interpreter for which the operation
* is performed */
|
| ︙ | |||
221 222 223 224 225 226 227 | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - + |
*----------------------------------------------------------------------
*/
static int
ProcBodyTestProcObjCmd(
ClientData dummy, /* context; not used */
Tcl_Interp *interp, /* the current interpreter */
|
| ︙ |
Changes to generic/tclThreadAlloc.c.
| ︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | - + |
* code in Tcl_CreateInterp().
*/
typedef struct Cache {
struct Cache *nextPtr; /* Linked list of cache entries */
Tcl_ThreadId owner; /* Which thread's cache is this? */
Tcl_Obj *firstObjPtr; /* List of free objects for thread */
|
| ︙ | |||
129 130 131 132 133 134 135 | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | - + | static Cache * GetCache(void); static void LockBucket(Cache *cachePtr, int bucket); static void UnlockBucket(Cache *cachePtr, int bucket); static void PutBlocks(Cache *cachePtr, int bucket, int numMove); static int GetBlocks(Cache *cachePtr, int bucket); static Block * Ptr2Block(char *ptr); |
| ︙ | |||
304 305 306 307 308 309 310 | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | - + | * May allocate more blocks for a bucket. * *---------------------------------------------------------------------- */ char * TclpAlloc( |
| ︙ | |||
438 439 440 441 442 443 444 | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | - + |
*
*----------------------------------------------------------------------
*/
char *
TclpRealloc(
char *ptr,
|
| ︙ | |||
751 752 753 754 755 756 757 | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | - + |
*----------------------------------------------------------------------
*/
static char *
Block2Ptr(
Block *blockPtr,
int bucket,
|
| ︙ |
Changes to generic/tclThreadTest.c.
| ︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + | * Access to the list of threads and to the thread send results is guarded by * this mutex. */ TCL_DECLARE_MUTEX(threadMutex) static int ThreadObjCmd(ClientData clientData, |
| ︙ | |||
205 206 207 208 209 210 211 | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | - + |
*/
/* ARGSUSED */
static int
ThreadObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
246 247 248 249 250 251 252 | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | - + + |
Tcl_MutexUnlock(&threadMutex);
}
switch ((enum options)option) {
case THREAD_CANCEL: {
long id;
const char *result;
|
| ︙ | |||
273 274 275 276 277 278 279 | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | - + + |
} else {
result = NULL;
}
return ThreadCancel(interp, (Tcl_ThreadId) (size_t) id, result, flags);
}
case THREAD_CREATE: {
const char *script;
|
| ︙ | |||
656 657 658 659 660 661 662 | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | - - + + - + |
char buf[TCL_DOUBLE_SPACE+1];
sprintf(buf, "%" TCL_LL_MODIFIER "d", (Tcl_WideInt)(size_t)Tcl_GetCurrentThread());
errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
if (errorProcString == NULL) {
errChannel = Tcl_GetStdChannel(TCL_STDERR);
|
| ︙ | |||
985 986 987 988 989 990 991 | 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | - + + |
* Since Tcl_CancelEval can be safely called from any thread,
* we do it now.
*/
Tcl_MutexUnlock(&threadMutex);
Tcl_ResetResult(interp);
return Tcl_CancelEval(tsdPtr->interp,
|
| ︙ |
Changes to generic/tclTimer.c.
| ︙ | |||
772 773 774 775 776 777 778 779 780 781 782 783 | 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 | + - + - + |
*
* Side effects:
* See the user documentation.
*
*----------------------------------------------------------------------
*/
// TODO Can this become an ensemble?
/* ARGSUSED */
int
Tcl_AfterObjCmd(
ClientData clientData, /* Unused */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
885 886 887 888 889 890 891 | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | - + |
assocPtr->firstAfterPtr = afterPtr;
Tcl_SetObjResult(interp, Tcl_ObjPrintf("after#%d", afterPtr->id));
return TCL_OK;
}
case AFTER_CANCEL: {
Tcl_Obj *commandPtr;
const char *command, *tempCommand;
|
| ︙ | |||
975 976 977 978 979 980 981 | 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 | - + + |
return TCL_ERROR;
} else {
Tcl_Obj *resultListPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(interp, resultListPtr,
afterPtr->commandPtr);
Tcl_ListObjAppendElement(interp, resultListPtr, Tcl_NewStringObj(
|
| ︙ |
Changes to generic/tclTrace.c.
| ︙ | |||
90 91 92 93 94 95 96 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | - + | #define TCL_TRACE_EXEC_DIRECT 0x20 /* * Forward declarations for functions defined in this file: */ typedef int (Tcl_TraceTypeObjCmd)(Tcl_Interp *interp, int optionIndex, |
| ︙ | |||
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 | - - + + + - + | }; /* * Declarations for local functions to this file: */ static int CallTraceFunction(Tcl_Interp *interp, Trace *tracePtr, |
| ︙ | |||
183 184 185 186 187 188 189 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | - + |
*/
/* ARGSUSED */
int
Tcl_TraceObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
265 266 267 268 269 270 271 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | - + + |
}
#ifndef TCL_REMOVE_OBSOLETE_TRACES
case TRACE_OLD_VARIABLE:
case TRACE_OLD_VDELETE: {
Tcl_Obj *copyObjv[6];
Tcl_Obj *opsList;
|
| ︙ | |||
348 349 350 351 352 353 354 | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - + - + | /* * Build a pair (2-item list) with the ops string as the first obj * element and the tvarPtr->command string as the second obj * element. Append the pair (as an element) to the end of the * result object list. */ |
| ︙ | |||
392 393 394 395 396 397 398 | 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 438 439 440 441 442 443 444 445 446 447 448 449 | - + - + - + - + - + - + |
*----------------------------------------------------------------------
*/
static int
TraceExecutionObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
int optionIndex, /* Add, info or remove */
|
| ︙ | |||
570 571 572 573 574 575 576 | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | - + |
if (Tcl_FindCommand(interp, name, NULL, TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
resultListPtr = Tcl_NewListObj(0, NULL);
FOREACH_COMMAND_TRACE(interp, name, clientData) {
|
| ︙ | |||
609 610 611 612 613 614 615 | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | - + | } eachTraceObjPtr = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr); Tcl_DecrRefCount(elemObjPtr); elemObjPtr = NULL; Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, |
| ︙ | |||
642 643 644 645 646 647 648 | 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 683 684 685 686 687 688 689 690 691 692 | - + - + - + - - + + - + |
*----------------------------------------------------------------------
*/
static int
TraceCommandObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
int optionIndex, /* Add, info or remove */
|
| ︙ | |||
773 774 775 776 777 778 779 | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | - + |
name = Tcl_GetString(objv[3]);
if (Tcl_FindCommand(interp, name, NULL, TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
resultListPtr = Tcl_NewListObj(0, NULL);
FOREACH_COMMAND_TRACE(interp, name, clientData) {
|
| ︙ | |||
802 803 804 805 806 807 808 | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | - + | Tcl_DecrRefCount(elemObjPtr); continue; } eachTraceObjPtr = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr); Tcl_DecrRefCount(elemObjPtr); |
| ︙ | |||
836 837 838 839 840 841 842 | 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 | - + - + - + - - + + - + |
*----------------------------------------------------------------------
*/
static int
TraceVariableObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
int optionIndex, /* Add, info or remove */
|
| ︙ | |||
987 988 989 990 991 992 993 | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | - + |
if (tvarPtr->flags & TCL_TRACE_UNSETS) {
TclNewLiteralStringObj(opObjPtr, "unset");
Tcl_ListObjAppendElement(NULL, elemObjPtr, opObjPtr);
}
eachTraceObjPtr = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr);
|
| ︙ | |||
1127 1128 1129 1130 1131 1132 1133 | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 | - + + |
tracePtr->refCount = 1;
cmdPtr->tracePtr = tracePtr;
if (tracePtr->flags & TCL_TRACE_ANY_EXEC) {
/*
* Bug 3484621: up the interp's epoch if this is a BC'ed command
*/
|
| ︙ | |||
1243 1244 1245 1246 1247 1248 1249 | 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | - |
cmdPtr->flags &= ~CMD_HAS_EXEC_TRACES;
/*
* Bug 3484621: up the interp's epoch if this is a BC'ed command
*/
if (cmdPtr->compileProc != NULL) {
|
| ︙ | |||
1413 1414 1415 1416 1417 1418 1419 | 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | - + - + |
*/
int
TclCheckExecutionTraces(
Tcl_Interp *interp, /* The current interpreter. */
const char *command, /* Pointer to beginning of the current command
* string. */
|
| ︙ | |||
1519 1520 1521 1522 1523 1524 1525 | 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 | - + - + - + |
*/
int
TclCheckInterpTraces(
Tcl_Interp *interp, /* The current interpreter. */
const char *command, /* Pointer to beginning of the current command
* string. */
|
| ︙ | |||
1666 1667 1668 1669 1670 1671 1672 | 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 | - + - + - - + + |
static int
CallTraceFunction(
Tcl_Interp *interp, /* The current interpreter. */
register Trace *tracePtr, /* Describes the trace function to call. */
Command *cmdPtr, /* Points to command's Command struct. */
const char *command, /* Points to the first character of the
* command's source before substitutions. */
|
| ︙ | |||
1754 1755 1756 1757 1758 1759 1760 | 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 | - + |
static int
TraceExecutionProc(
ClientData clientData,
Tcl_Interp *interp,
int level,
const char *command,
Tcl_Command cmdInfo,
|
| ︙ | |||
1991 1992 1993 1994 1995 1996 1997 | 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 | - + |
if (tvarPtr->length != (size_t) 0) {
/*
* Generate a command to execute by appending list elements for
* the two variable names and the operation.
*/
Tcl_DStringInit(&cmd);
|
| ︙ | |||
2254 2255 2256 2257 2258 2259 2260 | 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 | - + - + - + |
static int
StringTraceProc(
ClientData clientData,
Tcl_Interp *interp,
int level,
const char *command,
Tcl_Command commandInfo,
|
| ︙ | |||
2719 2720 2721 2722 2723 2724 2725 | 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 | - + |
break;
}
if (disposeFlags & TCL_TRACE_RESULT_OBJECT) {
Tcl_SetObjResult((Tcl_Interp *)iPtr, (Tcl_Obj *) result);
} else {
Tcl_SetObjResult((Tcl_Interp *)iPtr,
|
| ︙ |
Changes to generic/tclUtf.c.
| ︙ | |||
228 229 230 231 232 233 234 | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | - + |
*
*---------------------------------------------------------------------------
*/
char *
Tcl_UniCharToUtfDString(
const Tcl_UniChar *uniStr, /* Unicode string to convert to UTF-8. */
|
| ︙ | |||
390 391 392 393 394 395 396 | 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 | - - + + - + - + - + - + |
*
*---------------------------------------------------------------------------
*/
Tcl_UniChar *
Tcl_UtfToUniCharDString(
const char *src, /* UTF-8 string to convert to Unicode. */
|
| ︙ | |||
451 452 453 454 455 456 457 | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | - + |
*---------------------------------------------------------------------------
*/
int
Tcl_UtfCharComplete(
const char *src, /* String to check if first few bytes contain
* a complete UTF-8 character. */
|
| ︙ | |||
477 478 479 480 481 482 483 | 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 503 504 505 506 507 508 509 | - + - - + + - + | * * Side effects: * None. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
698 699 700 701 702 703 704 | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | - + |
*
*---------------------------------------------------------------------------
*/
Tcl_UniChar
Tcl_UniCharAtIndex(
register const char *src, /* The UTF-8 string to dereference. */
|
| ︙ | |||
729 730 731 732 733 734 735 | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | - + |
*
*---------------------------------------------------------------------------
*/
const char *
Tcl_UtfAtIndex(
register const char *src, /* The UTF-8 string. */
|
| ︙ | |||
766 767 768 769 770 771 772 | 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 | - + - + - + - | * that represent the Unicode character is at least as large as the * source buffer from which the backslashed sequence was extracted, no * buffer overruns should occur. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
817 818 819 820 821 822 823 | 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 | - + - + |
int
Tcl_UtfToUpper(
char *str) /* String to convert in place. */
{
Tcl_UniChar ch, upChar;
char *src, *dst;
|
| ︙ | |||
870 871 872 873 874 875 876 | 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 | - + - + |
int
Tcl_UtfToLower(
char *str) /* String to convert in place. */
{
Tcl_UniChar ch, lowChar;
char *src, *dst;
|
| ︙ | |||
924 925 926 927 928 929 930 | 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 | - + - + - + |
int
Tcl_UtfToTitle(
char *str) /* String to convert in place. */
{
Tcl_UniChar ch, titleChar, lowChar;
char *src, *dst;
|
| ︙ | |||
982 983 984 985 986 987 988 | 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | - + |
*----------------------------------------------------------------------
*/
int
TclpUtfNcmp2(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
|
| ︙ | |||
1029 1030 1031 1032 1033 1034 1035 | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_UtfNcmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
|
| ︙ | |||
1077 1078 1079 1080 1081 1082 1083 | 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_UtfNcasecmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
|
| ︙ | |||
1281 1282 1283 1284 1285 1286 1287 | 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_UniCharNcmp(
const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */
const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
|
| ︙ | |||
1326 1327 1328 1329 1330 1331 1332 | 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_UniCharNcasecmp(
const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */
const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
|
| ︙ | |||
1821 1822 1823 1824 1825 1826 1827 | 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 | - + - + |
*
*----------------------------------------------------------------------
*/
int
TclUniCharMatch(
const Tcl_UniChar *string, /* Unicode String. */
|
| ︙ |
Changes to generic/tclUtil.c.
| ︙ | |||
360 361 362 363 364 365 366 | 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 | - - - - + + + + - + - + - + - + - + - + + - + | /* *---------------------------------------------------------------------- * * TclMaxListLength -- * * Given 'bytes' pointing to 'numBytes' bytes, scan through them and * count the number of whitespace runs that could be list element |
| ︙ | |||
485 486 487 488 489 490 491 | 486 487 488 489 490 491 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 | - + - + - - + + |
TclFindElement(
Tcl_Interp *interp, /* Interpreter to use for error reporting. If
* NULL, then no error message is left after
* errors. */
const char *list, /* Points to the first byte of a string
* containing a Tcl list with zero or more
* elements (possibly in braces). */
|
| ︙ | |||
666 667 668 669 670 671 672 | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | - + - + |
* End of list: terminate element.
*/
if (p == limit) {
if (openBraces != 0) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
717 718 719 720 721 722 723 | 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 | - + - + - + - - + + + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
| ︙ | |||
781 782 783 784 785 786 787 | 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 | - + + - + - + |
*/
int
Tcl_SplitList(
Tcl_Interp *interp, /* Interpreter to use for error reporting. If
* NULL, no error message is left. */
const char *list, /* Pointer to string with list structure. */
|
| ︙ | |||
821 822 823 824 825 826 827 | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 | - + |
if (*element == 0) {
break;
}
if (i >= size) {
ckfree(argv);
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
865 866 867 868 869 870 871 | 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 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 | - + - + - - + + - + - + - + - - - - + + + + - + - + - + - + + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
| ︙ | |||
987 988 989 990 991 992 993 | 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 | - - - + + + - + - - - - + + + + - + - - - - - - + + + + + + - - - - - + + + + + - - - - + + + + - + - - - - - - - - - - - + + + + + + + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - - - + + + + - - - - - - - - - - - + + + + + + + + + + + - + - - - - - - - - - - + + + + + + + + + + |
forbidNone = 1;
#if COMPAT
preferBrace = 1;
#endif /* COMPAT */
}
while (length) {
|
| ︙ | |||
1110 1111 1112 1113 1114 1115 1116 | 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 | - + |
* Make room to escape leading #, if needed.
*/
if ((*src == '#') && !(*flagPtr & TCL_DONT_QUOTE_HASH)) {
bytesNeeded++;
}
*flagPtr = CONVERT_ESCAPE;
|
| ︙ | |||
1158 1159 1160 1161 1162 1163 1164 | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | - + |
* escape the braces.
*/
if (*flagPtr & TCL_DONT_USE_BRACES) {
bytesNeeded += braceCount;
}
*flagPtr = CONVERT_MASK;
|
| ︙ | |||
1184 1185 1186 1187 1188 1189 1190 | 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 | - + - - - - - | /* * Add 2 bytes for room for the enclosing braces. */ bytesNeeded += 2; } *flagPtr = CONVERT_BRACE; |
| ︙ | |||
1228 1229 1230 1231 1232 1233 1234 | 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | - + - + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1258 1259 1260 1261 1262 1263 1264 | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | - + - + - + + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1291 1292 1293 1294 1295 1296 1297 | 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 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 | - + - + - + + - + - + - + - + | * * Side effects: * None. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1432 1433 1434 1435 1436 1437 1438 | 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 | - + | case '\v': *p = '\\'; p++; *p = 'v'; p++; continue; case '\0': |
| ︙ | |||
1474 1475 1476 1477 1478 1479 1480 | 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 | - + - + | * None. * *---------------------------------------------------------------------- */ char * Tcl_Merge( |
| ︙ | |||
1504 1505 1506 1507 1508 1509 1510 | 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 | - + - - - + - + - + |
if (argc <= LOCAL_SIZE) {
flagPtr = localFlags;
} else {
flagPtr = ckalloc(argc);
}
for (i = 0; i < argc; i++) {
flagPtr[i] = ( i ? TCL_DONT_QUOTE_HASH : 0 );
|
| ︙ | |||
1555 1556 1557 1558 1559 1560 1561 | 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 | - + - + |
*
*----------------------------------------------------------------------
*/
int
TclTrimRight(
const char *bytes, /* String to be trimmed... */
|
| ︙ | |||
1581 1582 1583 1584 1585 1586 1587 | 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 | - + |
/*
* Outer loop: iterate over string to be trimmed.
*/
do {
Tcl_UniChar ch1;
const char *q = trim;
|
| ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 | - + - + |
*
*----------------------------------------------------------------------
*/
int
TclTrimLeft(
const char *bytes, /* String to be trimmed... */
|
| ︙ | |||
1660 1661 1662 1663 1664 1665 1666 | 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 | - + - + |
/*
* Outer loop: iterate over string to be trimmed.
*/
do {
Tcl_UniChar ch1;
|
| ︙ | |||
1720 1721 1722 1723 1724 1725 1726 | 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 | - + - + - + - - - + - + - + | /* The whitespace characters trimmed during [concat] operations */ #define CONCAT_WS " \f\v\r\t\n" #define CONCAT_WS_SIZE (int) (sizeof(CONCAT_WS "") - 1) char * Tcl_Concat( |
| ︙ | |||
1800 1801 1802 1803 1804 1805 1806 | 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 | - + |
/*
* Append to the result with space if needed.
*/
if (needSpace) {
*p++ = ' ';
}
|
| ︙ | |||
1828 1829 1830 1831 1832 1833 1834 | 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 | - + - + - + | * A new object is created. * *---------------------------------------------------------------------- */ Tcl_Obj * Tcl_ConcatObj( |
| ︙ | |||
1882 1883 1884 1885 1886 1887 1888 | 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 | - - - - + |
*
* First try to pre-allocate the size required.
*/
for (i = 0; i < objc; i++) {
element = TclGetStringFromObj(objv[i], &elemLength);
bytesNeeded += elemLength;
|
| ︙ | |||
1993 1994 1995 1996 1997 1998 1999 | 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 | + - + |
int
Tcl_StringCaseMatch(
const char *str, /* String. */
const char *pattern, /* Pattern, which may contain special
* characters. */
int nocase) /* 0 for case sensitive, 1 for insensitive */
{
int p;
|
| ︙ | |||
2222 2223 2224 2225 2226 2227 2228 | 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 | - + - + |
*
*----------------------------------------------------------------------
*/
int
TclByteArrayMatch(
const unsigned char *string,/* String. */
|
| ︙ | |||
2403 2404 2405 2406 2407 2408 2409 | 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 | - + + |
int
TclStringMatchObj(
Tcl_Obj *strObj, /* string object. */
Tcl_Obj *ptnObj, /* pattern object. */
int flags) /* Only TCL_MATCH_NOCASE should be passed, or
* 0. */
{
|
| ︙ | |||
2480 2481 2482 2483 2484 2485 2486 | 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 | - - - - - + + + + + - + - + |
*
*----------------------------------------------------------------------
*/
char *
Tcl_DStringAppend(
Tcl_DString *dsPtr, /* Structure describing dynamic string. */
|
| ︙ | |||
2537 2538 2539 2540 2541 2542 2543 | 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 | - + |
*/
char *
TclDStringAppendObj(
Tcl_DString *dsPtr,
Tcl_Obj *objPtr)
{
|
| ︙ | |||
2577 2578 2579 2580 2581 2582 2583 | 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 | - + - - + + |
char *
Tcl_DStringAppendElement(
Tcl_DString *dsPtr, /* Structure describing dynamic string. */
const char *element) /* String to append. Must be
* null-terminated. */
{
char *dst = dsPtr->string + dsPtr->length;
|
| ︙ | |||
2621 2622 2623 2624 2625 2626 2627 | 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 | - + |
* If we need a space to separate this element from preceding stuff,
* then this element will not lead a list, and need not have it's
* leading '#' quoted.
*/
flags |= TCL_DONT_QUOTE_HASH;
}
|
| ︙ | |||
2648 2649 2650 2651 2652 2653 2654 | 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 | - + - + - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_DStringSetLength(
Tcl_DString *dsPtr, /* Structure describing dynamic string. */
|
| ︙ | |||
2772 2773 2774 2775 2776 2777 2778 | 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 | - + |
void
Tcl_DStringGetResult(
Tcl_Interp *interp, /* Interpreter whose result is to be reset. */
Tcl_DString *dsPtr) /* Dynamic string that is to become the result
* of interp. */
{
|
| ︙ | |||
3260 3261 3262 3263 3264 3265 3266 | 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 | - + - - + | * Side effects: * The formatted characters are written into the storage pointer to by * the "buffer" argument. * *---------------------------------------------------------------------- */ |
| ︙ | |||
3354 3355 3356 3357 3358 3359 3360 | 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 | - + - + - + + + - + + |
int
TclGetIntForIndex(
Tcl_Interp *interp, /* Interpreter to use for error reporting. If
* NULL, then no error message is left after
* errors. */
Tcl_Obj *objPtr, /* Points to an object containing either "end"
* or an integer. */
|
| ︙ | |||
3497 3498 3499 3500 3501 3502 3503 | 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 | - + |
static int
SetEndOffsetFromAny(
Tcl_Interp *interp, /* Tcl interpreter or NULL */
Tcl_Obj *objPtr) /* Pointer to the object to parse */
{
int offset; /* Offset in the "end-offset" expression */
register const char *bytes; /* String rep of the object */
|
| ︙ | |||
3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 | 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 | + |
* This is our limited string expression evaluator. Pass everything
* after "end-" to Tcl_GetInt, then reverse for offset.
*/
if (TclIsSpaceProc(bytes[4])) {
goto badIndexFormat;
}
// TODO might not fit in an int
if (Tcl_GetInt(interp, bytes+4, &offset) != TCL_OK) {
return TCL_ERROR;
}
if (bytes[3] == '-') {
offset = -offset;
}
} else {
|
| ︙ | |||
3778 3779 3780 3781 3782 3783 3784 | 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 | - + - + | Tcl_MutexLock(&pgvPtr->mutex); pgvPtr->epoch++; epoch = pgvPtr->epoch; Tcl_UtfToExternalDString(pgvPtr->encoding, pgvPtr->value, pgvPtr->numBytes, &native); Tcl_ExternalToUtfDString(current, Tcl_DStringValue(&native), |
| ︙ | |||
3909 3910 3911 3912 3913 3914 3915 | 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 | - + + + + + + + + + + + + + + + + + + + + + + + + + + |
*
*----------------------------------------------------------------------
*/
const char *
Tcl_GetNameOfExecutable(void)
{
|
| ︙ | |||
3966 3967 3968 3969 3970 3971 3972 | 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 | - + |
*----------------------------------------------------------------------
*/
int
TclReToGlob(
Tcl_Interp *interp,
const char *reStr,
|
| ︙ | |||
4152 4153 4154 4155 4156 4157 4158 | 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 | - + |
*exactPtr = (anchorLeft && anchorRight);
}
return TCL_OK;
invalidGlob:
if (interp != NULL) {
|
Changes to generic/tclVar.c.
| ︙ | |||
281 282 283 284 285 286 287 | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | - + |
TclVarHashTable *tablePtr,
const char *key,
int *newPtr)
{
Tcl_Obj *keyPtr;
Var *varPtr;
|
| ︙ | |||
411 412 413 414 415 416 417 | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | - + - |
* return error if it doesn't exist. */
Var **arrayPtrPtr) /* If the name refers to an element of an
* array, *arrayPtrPtr gets filled in with
* address of array variable. Otherwise this
* is set to NULL. */
{
Var *varPtr;
|
| ︙ | |||
494 495 496 497 498 499 500 | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | - + |
* address of array variable. Otherwise this
* is set to NULL. */
{
Tcl_Obj *part2Ptr = NULL;
Var *resPtr;
if (part2) {
|
| ︙ | |||
544 545 546 547 548 549 550 | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | - - + + |
* address of array variable. Otherwise this
* is set to NULL. */
{
Interp *iPtr = (Interp *) interp;
register Var *varPtr; /* Points to the variable's in-frame Var
* structure. */
const char *part1;
|
| ︙ | |||
655 656 657 658 659 660 661 | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | - + |
noSuchVar, -1);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "VARNAME", NULL);
}
return NULL;
}
part2 = newPart2 = part1Ptr->internalRep.twoPtrValue.ptr2;
if (newPart2) {
|
| ︙ | |||
700 701 702 703 704 705 706 | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | - + - + | */ part2 = part1 + i + 1; len2 = len1 - i - 2; len1 = i; newPart2 = ckalloc(len2 + 1); |
| ︙ | |||
916 917 918 919 920 921 922 | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | - + + |
TclVarHashTable *tablePtr; /* Points to the hashtable, if any, in which
* to look up the variable. */
Tcl_Var var; /* Used to search for global names. */
Var *varPtr; /* Points to the Var structure returned for
* the variable. */
Namespace *varNsPtr, *cxtNsPtr, *dummy1Ptr, *dummy2Ptr;
ResolverScheme *resPtr;
|
| ︙ | |||
1019 1020 1021 1022 1023 1024 1025 | 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 | - + |
*errMsgPtr = badNamespace;
return NULL;
} else if (tail == NULL) {
*errMsgPtr = missingName;
return NULL;
}
if (tail != varName) {
|
| ︙ | |||
1042 1043 1044 1045 1046 1047 1048 | 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | + - + |
}
} else { /* Var wasn't found and not to create it. */
*errMsgPtr = noSuchVar;
return NULL;
}
}
} else { /* Local var: look in frame varFramePtr. */
size_t localLen;
|
| ︙ | |||
1254 1255 1256 1257 1258 1259 1260 | 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | - + - + |
const char *part2, /* If non-NULL, gives the name of an element
* in the array part1. */
int flags) /* OR-ed combination of TCL_GLOBAL_ONLY,
* TCL_NAMESPACE_ONLY and TCL_LEAVE_ERR_MSG *
* bits. */
{
Tcl_Obj *resultPtr;
|
| ︙ | |||
1307 1308 1309 1310 1311 1312 1313 | 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | - + + - + |
const char *part1, /* Name of an array (if part2 is non-NULL) or
* the name of a variable. */
const char *part2, /* If non-NULL, gives the name of an element
* in the array part1. */
int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and
* TCL_LEAVE_ERR_MSG bits. */
{
|
| ︙ | |||
1490 1491 1492 1493 1494 1495 1496 | 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | - + |
*/
/* ARGSUSED */
int
Tcl_SetObjCmd(
ClientData dummy, /* Not used. */
register Tcl_Interp *interp,/* Current interpreter. */
|
| ︙ | |||
1558 1559 1560 1561 1562 1563 1564 | 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 | - + |
const char *newValue, /* New value for variable. */
int flags) /* Various flags that tell how to set value:
* any of TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_APPEND_VALUE, TCL_LIST_ELEMENT, or
* TCL_LEAVE_ERR_MSG. */
{
Tcl_Obj *varValuePtr = Tcl_SetVar2Ex(interp, part1, part2,
|
| ︙ | |||
1618 1619 1620 1621 1622 1623 1624 | 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 | - + + - + |
* in the array part1. */
Tcl_Obj *newValuePtr, /* New value for variable. */
int flags) /* Various flags that tell how to set value:
* any of TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_APPEND_VALUE, TCL_LIST_ELEMENT or
* TCL_LEAVE_ERR_MSG. */
{
|
| ︙ | |||
2058 2059 2060 2061 2062 2063 2064 | 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 | - |
} else {
Tcl_DecrRefCount(varValuePtr);
return NULL;
}
} else {
/* Unshared - can Incr in place */
if (TCL_OK == TclIncrObj(interp, varValuePtr, incrPtr)) {
|
| ︙ | |||
2106 2107 2108 2109 2110 2111 2112 | 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 | - + + - + |
const char *part1, /* Name of variable or array. */
const char *part2, /* Name of element within array or NULL. */
int flags) /* OR-ed combination of any of
* TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_LEAVE_ERR_MSG. */
{
int result;
|
| ︙ | |||
2458 2459 2460 2461 2462 2463 2464 | 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 | - + |
*/
/* ARGSUSED */
int
Tcl_UnsetObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2526 2527 2528 2529 2530 2531 2532 | 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 | - + |
*/
/* ARGSUSED */
int
Tcl_AppendObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2592 2593 2594 2595 2596 2597 2598 | 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 | - + - + - + |
*/
/* ARGSUSED */
int
Tcl_LappendObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2738 2739 2740 2741 2742 2743 2744 | 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 | - + + |
TclArraySet(
Tcl_Interp *interp, /* Current interpreter. */
Tcl_Obj *arrayNameObj, /* The array name. */
Tcl_Obj *arrayElemObj) /* The array elements list or dict. If this is
* NULL, create an empty array. */
{
Var *varPtr, *arrayPtr;
|
| ︙ | |||
2766 2767 2768 2769 2770 2771 2772 2773 | 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 | + - + |
* Install the contents of the dictionary or list into the array.
*/
if (arrayElemObj->typePtr == &tclDictType) {
Tcl_Obj *keyPtr, *valuePtr;
Tcl_DictSearch search;
int done;
size_t len;
|
| ︙ | |||
2809 2810 2811 2812 2813 2814 2815 | 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 | - + - + |
return TCL_OK;
} else {
/*
* Not a dictionary, so assume (and convert to, for backward-
* -compatability reasons) a list.
*/
|
| ︙ | |||
2903 2904 2905 2906 2907 2908 2909 | 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 | - + |
*/
/* ARGSUSED */
static int
ArrayStartSearchCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3001 3002 3003 3004 3005 3006 3007 | 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 | - + |
*/
/* ARGSUSED */
static int
ArrayAnyMoreCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3108 3109 3110 3111 3112 3113 3114 | 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 | - + |
*/
/* ARGSUSED */
static int
ArrayNextElementCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3217 3218 3219 3220 3221 3222 3223 | 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 | - + |
*/
/* ARGSUSED */
static int
ArrayDoneSearchCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3325 3326 3327 3328 3329 3330 3331 | 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 | - + |
*/
/* ARGSUSED */
static int
ArrayExistsCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3392 3393 3394 3395 3396 3397 3398 | 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 | - + + - + |
*/
/* ARGSUSED */
static int
ArrayGetCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3576 3577 3578 3579 3580 3581 3582 | 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 | - + |
*/
/* ARGSUSED */
static int
ArrayNamesCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3768 3769 3770 3771 3772 3773 3774 | 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 | - + |
*/
/* ARGSUSED */
static int
ArraySetCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3825 3826 3827 3828 3829 3830 3831 | 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 | - + |
*/
/* ARGSUSED */
static int
ArraySizeCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3909 3910 3911 3912 3913 3914 3915 | 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 | - + |
*/
/* ARGSUSED */
static int
ArrayStatsCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
3962 3963 3964 3965 3966 3967 3968 | 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 | - + - + |
TclGetString(varNameObj), NULL);
return TCL_ERROR;
}
stats = Tcl_HashStats((Tcl_HashTable *) varPtr->value.tablePtr);
if (stats == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3992 3993 3994 3995 3996 3997 3998 | 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 | - + |
*/
/* ARGSUSED */
static int
ArrayUnsetCmd(
ClientData clientData,
Tcl_Interp *interp,
|
| ︙ | |||
4301 4302 4303 4304 4305 4306 4307 | 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 | - + |
int index) /* If the variable to be linked is an indexed
* scalar, this is its index. Otherwise, -1 */
{
Tcl_Obj *myNamePtr = NULL;
int result;
if (myName) {
|
| ︙ | |||
4385 4386 4387 4388 4389 4390 4391 | 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 | - + |
TclGetString(myNamePtr), NULL);
return TCL_ERROR;
}
}
if (varPtr == otherPtr) {
Tcl_SetObjResult((Tcl_Interp *) iPtr, Tcl_NewStringObj(
|
| ︙ | |||
4473 4474 4475 4476 4477 4478 4479 | 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 | - + - + |
CallFrame *framePtr;
Tcl_Obj *part1Ptr, *localNamePtr;
if (TclGetFrame(interp, frameName, &framePtr) == -1) {
return TCL_ERROR;
}
|
| ︙ | |||
4528 4529 4530 4531 4532 4533 4534 | 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 | - + |
/*
* Add the full name of the containing namespace (if any), followed by the
* "::" separator, then the variable name.
*/
nsPtr = TclGetVarNsPtr(varPtr);
if (nsPtr) {
|
| ︙ | |||
4569 4570 4571 4572 4573 4574 4575 | 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_GlobalObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4613 4614 4615 4616 4617 4618 4619 | 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 | - + |
if ((*tail == ':') && (tail > varName)) {
tail++;
}
if (tail == varName) {
tailPtr = objPtr;
} else {
|
| ︙ | |||
4673 4674 4675 4676 4677 4678 4679 | 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_VariableObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
4764 4765 4766 4767 4768 4769 4770 | 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 | - + |
* Create a local link "tail" to the variable "varName" in the
* current namespace.
*/
if (tail == varName) {
tailPtr = varNamePtr;
} else {
|
| ︙ | |||
4806 4807 4808 4809 4810 4811 4812 | 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 | - + |
*/
/* ARGSUSED */
int
Tcl_UpvarObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
5386 5387 5388 5389 5390 5391 5392 | 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 | - + - + |
Tcl_Interp *interp, /* Interpreter in which to record message. */
const char *part1,
const char *part2, /* Variable's two-part name. */
const char *operation, /* String describing operation that failed,
* e.g. "read", "set", or "unset". */
const char *reason) /* String describing why operation failed. */
{
|
| ︙ | |||
5589 5590 5591 5592 5593 5594 5595 | 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 | - + - + - + |
UpdateParsedVarName(
Tcl_Obj *objPtr)
{
Tcl_Obj *arrayPtr = objPtr->internalRep.twoPtrValue.ptr1;
char *part2 = objPtr->internalRep.twoPtrValue.ptr2;
const char *part1;
char *p;
|
| ︙ | |||
5659 5660 5661 5662 5663 5664 5665 | 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 | - + |
* global namespace), TCL_NAMESPACE_ONLY (look
* up only in contextNsPtr, or the current
* namespace if contextNsPtr is NULL), and
* TCL_LEAVE_ERR_MSG. If both TCL_GLOBAL_ONLY
* and TCL_NAMESPACE_ONLY are given,
* TCL_GLOBAL_ONLY is ignored. */
{
|
| ︙ | |||
5755 5756 5757 5758 5759 5760 5761 | 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 | - + |
* Look for the variable in the variable table of its namespace. Be sure
* to check both possible search paths: from the specified namespace
* context and from the global namespace.
*/
varPtr = NULL;
if (simpleName != name) {
|
| ︙ | |||
5804 5805 5806 5807 5808 5809 5810 | 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 | - + |
*----------------------------------------------------------------------
*/
int
TclInfoVarsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
5848 5849 5850 5851 5852 5853 5854 | 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 | - + |
&nsPtr, &dummy1NsPtr, &dummy2NsPtr, &simplePattern);
if (nsPtr != NULL) { /* We successfully found the pattern's ns. */
specificNsInPattern = (strcmp(simplePattern, pattern) != 0);
if (simplePattern == pattern) {
simplePatternPtr = objv[1];
} else {
|
| ︙ | |||
5995 5996 5997 5998 5999 6000 6001 | 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 | - + |
*----------------------------------------------------------------------
*/
int
TclInfoGlobalsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
6033 6034 6035 6036 6037 6038 6039 | 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 | - + |
*/
listPtr = Tcl_NewListObj(0, NULL);
if (pattern != NULL && TclMatchIsTrivial(pattern)) {
if (pattern == TclGetString(objv[1])) {
patternPtr = objv[1];
} else {
|
| ︙ | |||
6088 6089 6090 6091 6092 6093 6094 | 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 | - + |
*----------------------------------------------------------------------
*/
int
TclInfoLocalsCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to generic/tclZlib.c.
| ︙ | |||
175 176 177 178 179 180 181 | 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 | - - + + - - - - + + + + - + | static Tcl_ObjCmdProc ZlibStreamPutCmd; static void ConvertError(Tcl_Interp *interp, int code, uLong adler); static Tcl_Obj * ConvertErrorToList(int code, uLong adler); static void ExtractHeader(gz_header *headerPtr, Tcl_Obj *dictObj); static int GenerateHeader(Tcl_Interp *interp, Tcl_Obj *dictObj, |
| ︙ | |||
255 256 257 258 259 260 261 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | - + + |
* Firstly, the case that is *different* because it's really coming
* from the OS and is just being reported via zlib. It should be
* really uncommon because Tcl handles all I/O rather than delegating
* it to zlib, but proving it can't happen is hard.
*/
case Z_ERRNO:
|
| ︙ | |||
306 307 308 309 310 311 312 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | - + |
default:
codeStr = "UNKNOWN";
codeStr2 = codeStrBuf;
sprintf(codeStrBuf, "%d", code);
break;
}
|
| ︙ | |||
343 344 345 346 347 348 349 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | - + |
TclNewLiteralStringObj(objv[2], "BUF");
return Tcl_NewListObj(3, objv);
case Z_VERSION_ERROR:
TclNewLiteralStringObj(objv[2], "VERSION");
return Tcl_NewListObj(3, objv);
case Z_ERRNO:
TclNewLiteralStringObj(objv[2], "POSIX");
|
| ︙ | |||
398 399 400 401 402 403 404 | 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 | - + - + + - + |
static inline int
GetValue(
Tcl_Interp *interp,
Tcl_Obj *dictObj,
const char *nameStr,
Tcl_Obj **valuePtrPtr)
{
|
| ︙ | |||
515 516 517 518 519 520 521 | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | - + | * Side effects: * Updates the dictionary, which must be writable (i.e. refCount < 2). * *---------------------------------------------------------------------- */ #define SetValue(dictObj, key, value) \ |
| ︙ | |||
537 538 539 540 541 542 543 | 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 605 606 607 608 609 610 | - - + + - - + + - - + + - + - + |
latin1enc = Tcl_GetEncoding(NULL, "iso8859-1");
if (latin1enc == NULL) {
Tcl_Panic("no latin-1 encoding");
}
}
|
| ︙ | |||
768 769 770 771 772 773 774 | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | - + |
}
Tcl_DStringInit(&cmdname);
TclDStringAppendLiteral(&cmdname, "::tcl::zlib::streamcmd_");
TclDStringAppendObj(&cmdname, Tcl_GetObjResult(interp));
if (Tcl_GetCommandInfo(interp, Tcl_DStringValue(&cmdname),
&cmdinfo) == 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | + - + - + |
Tcl_ZlibStream zshandle, /* As obtained from Tcl_ZlibStreamInit */
Tcl_Obj *data, /* Data to compress/decompress */
int flush) /* TCL_ZLIB_NO_FLUSH, TCL_ZLIB_FLUSH,
* TCL_ZLIB_FULLFLUSH, or TCL_ZLIB_FINALIZE */
{
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
char *dataTmp = NULL;
int e;
|
| ︙ | |||
1266 1267 1268 1269 1270 1271 1272 | 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 | - + - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_ZlibStreamGet(
Tcl_ZlibStream zshandle, /* As obtained from Tcl_ZlibStreamInit */
Tcl_Obj *data, /* A place to append the data. */
|
| ︙ | |||
1377 1378 1379 1380 1381 1382 1383 | 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 | - + |
* more to inflate.
*/
if (zshPtr->stream.avail_in > 0) {
if (zshPtr->interp) {
Tcl_SetObjResult(zshPtr->interp, Tcl_NewStringObj(
"unexpected zlib internal state during"
|
| ︙ | |||
1521 1522 1523 1524 1525 1526 1527 | 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 | - + + |
Tcl_ZlibDeflate(
Tcl_Interp *interp,
int format,
Tcl_Obj *data,
int level,
Tcl_Obj *gzipHeaderDictObj)
{
|
| ︙ | |||
1671 1672 1673 1674 1675 1676 1677 | 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 | - + + |
Tcl_ZlibInflate(
Tcl_Interp *interp,
int format,
Tcl_Obj *data,
int bufferSize,
Tcl_Obj *gzipHeaderDictObj)
{
|
| ︙ | |||
1851 1852 1853 1854 1855 1856 1857 | 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 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 | - + + - + + - + - + + |
*----------------------------------------------------------------------
*/
unsigned int
Tcl_ZlibCRC32(
unsigned int crc,
const unsigned char *buf,
|
| ︙ | |||
2121 2122 2123 2124 2125 2126 2127 | 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 | - + + |
* -> channel */
return ZlibPushSubcmd(interp, objc, objv);
};
return TCL_ERROR;
badLevel:
|
| ︙ | |||
2148 2149 2150 2151 2152 2153 2154 | 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 | - + |
*
*----------------------------------------------------------------------
*/
static int
ZlibStreamSubcmd(
Tcl_Interp *interp,
|
| ︙ | |||
2265 2266 2267 2268 2269 2270 2271 | 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 | - + + |
*/
if (levelObj == NULL) {
level = Z_DEFAULT_COMPRESSION;
} else if (Tcl_GetIntFromObj(interp, levelObj, &level) != TCL_OK) {
return TCL_ERROR;
} else if (level < 0 || level > 9) {
|
| ︙ | |||
2302 2303 2304 2305 2306 2307 2308 | 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 | - + |
*
*----------------------------------------------------------------------
*/
static int
ZlibPushSubcmd(
Tcl_Interp *interp,
|
| ︙ | |||
2324 2325 2326 2327 2328 2329 2330 | 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 | - + + |
};
static const char *const pushDecompressOptions[] = {
"-dictionary", "-header", "-level", "-limit", NULL
};
const char *const *pushOptions = pushDecompressOptions;
enum pushOptions {poDictionary, poHeader, poLevel, poLimit};
Tcl_Obj *headerObj = NULL, *compDictObj = NULL;
|
| ︙ | |||
2377 2378 2379 2380 2381 2382 2383 | 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 | - + + - + + |
/*
* Sanity checks.
*/
if (mode == TCL_ZLIB_STREAM_DEFLATE && !(chanMode & TCL_WRITABLE)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2417 2418 2419 2420 2421 2422 2423 | 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 | - + |
break;
case poLevel:
if (Tcl_GetIntFromObj(interp, objv[i], (int*) &level) != TCL_OK) {
goto genericOptionError;
}
if (level < 0 || level > 9) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2439 2440 2441 2442 2443 2444 2445 | 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 | - + |
goto genericOptionError;
}
break;
case poDictionary:
if (format == TCL_ZLIB_FORMAT_GZIP) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"a compression dictionary may not be set in the "
|
| ︙ | |||
2476 2477 2478 2479 2480 2481 2482 | 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 | - + |
*----------------------------------------------------------------------
*/
static int
ZlibStreamCmd(
ClientData cd,
Tcl_Interp *interp,
|
| ︙ | |||
2602 2603 2604 2605 2606 2607 2608 | 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 | - + |
return TCL_OK;
}
static int
ZlibStreamAddCmd(
ClientData cd,
Tcl_Interp *interp,
|
| ︙ | |||
2647 2648 2649 2650 2651 2652 2653 | 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 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 | - + - + - + - + |
flush = Z_FINISH;
}
break;
case ao_buffer: /* -buffer */
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-buffer\" option must be followed by integer "
|
| ︙ | |||
2726 2727 2728 2729 2730 2731 2732 | 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 | - + |
return code;
}
static int
ZlibStreamPutCmd(
ClientData cd,
Tcl_Interp *interp,
|
| ︙ | |||
2771 2772 2773 2774 2775 2776 2777 | 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 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 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 | - + - + - + - + - + + |
flush = Z_FINISH;
}
break;
case po_dictionary:
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-dictionary\" option must be followed by"
|
| ︙ | |||
2931 2932 2933 2934 2935 2936 2937 | 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 | - + - + + - + | * ZlibTransformInput -- * * Reader filter that does decompression. * *---------------------------------------------------------------------- */ |
| ︙ | |||
3080 3081 3082 3083 3084 3085 3086 | 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 | - + - + + - + | * ZlibTransformOutput -- * * Writer filter that does compression. * *---------------------------------------------------------------------- */ |
| ︙ | |||
3120 3121 3122 3123 3124 3125 3126 | 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 | - + + - + |
} while (e == Z_OK && produced > 0 && cd->outStream.avail_in > 0);
if (e == Z_OK) {
return toWrite - cd->outStream.avail_in;
}
errObj = Tcl_NewListObj(0, NULL);
|
| ︙ | |||
3240 3241 3242 3243 3244 3245 3246 | 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 | - + |
if (optionName && strcmp(optionName, "-limit") == 0) {
int newLimit;
if (Tcl_GetInt(interp, value, &newLimit) != TCL_OK) {
return TCL_ERROR;
} else if (newLimit < 1 || newLimit > MAX_BUFFER_SIZE) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3314 3315 3316 3317 3318 3319 3320 | 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 | - + - + |
}
sprintf(buf, "%lu", crc);
if (optionName == NULL) {
Tcl_DStringAppendElement(dsPtr, "-checksum");
Tcl_DStringAppendElement(dsPtr, buf);
} else {
|
| ︙ | |||
3644 3645 3646 3647 3648 3649 3650 | 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 | - + + |
chan = Tcl_StackChannel(interp, &zlibChannelType, cd,
Tcl_GetChannelMode(channel), channel);
if (chan == NULL) {
goto error;
}
cd->chan = chan;
cd->parent = Tcl_GetStackedChannel(chan);
|
| ︙ | |||
3681 3682 3683 3684 3685 3686 3687 | 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 | - + - + - + | * * Result: * The number of actually copied bytes, possibly less than 'toRead'. * *---------------------------------------------------------------------- */ |
| ︙ | |||
3741 3742 3743 3744 3745 3746 3747 | 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 | - + |
*
*----------------------------------------------------------------------
*/
static int
ResultGenerate(
ZlibChannelData *cd,
|
| ︙ | |||
3815 3816 3817 3818 3819 3820 3821 | 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 | - + + - + |
if (cd->inStream.avail_in <= 0 && flush != Z_SYNC_FLUSH) {
return TCL_OK;
}
}
handleError:
errObj = Tcl_NewListObj(0, NULL);
|
| ︙ | |||
3888 3889 3890 3891 3892 3893 3894 | 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 | - + + |
int mode,
int format,
int level,
Tcl_Obj *dictObj,
Tcl_ZlibStream *zshandle)
{
if (interp) {
|
| ︙ | |||
3956 3957 3958 3959 3960 3961 3962 | 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 | - + + - + + |
Tcl_Interp *interp,
int format,
Tcl_Obj *data,
int level,
Tcl_Obj *gzipHeaderDictObj)
{
if (interp) {
|
| ︙ |
Changes to macosx/tclMacOSXBundle.c.
| ︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | - + |
*/
int
Tcl_MacOSXOpenBundleResources(
Tcl_Interp *interp,
const char *bundleName,
int hasResourceFile,
|
| ︙ | |||
197 198 199 200 201 202 203 | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | - + |
int
Tcl_MacOSXOpenVersionedBundleResources(
Tcl_Interp *interp,
const char *bundleName,
const char *bundleVersion,
int hasResourceFile,
|
| ︙ |
Changes to macosx/tclMacOSXFCmd.c.
| ︙ | |||
632 633 634 635 636 637 638 | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | + - + |
static int
SetOSTypeFromAny(
Tcl_Interp *interp, /* Tcl interpreter */
Tcl_Obj *objPtr) /* Pointer to the object to convert */
{
const char *string;
size_t length;
|
| ︙ |
Changes to tests/env.test.
| ︙ | |||
300 301 302 303 304 305 306 307 | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | + + + + + + + + + + + - + + + - + |
}
array donesearch env $s
return $n
} 0
test env-7.2 {[219226]: links to env elements should not be removed by read} {
apply {{} {
set ::env(test7_2) ok
set ::env(test7_2,trigger) x
upvar env(test7_2) elem
set ::env(test7_2,trigger)
try {
return $elem
} finally {
unset -nocomplain ::env(test7_2) ::env(test7_2,trigger)
}
}}
} ok
test env-7.3 {[219226]: links to env elements should not be removed by write} {
apply {{} {
|
| ︙ |
Changes to tests/io.test.
| ︙ | |||
90 91 92 93 94 95 96 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | - + |
proc contents {file} {
set f [open $file]
fconfigure $f -translation binary
set a [read $f]
close $f
return $a
}
|
| ︙ | |||
6871 6872 6873 6874 6875 6876 6877 | 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 | - + |
set listen [socket -server [namespace code FcopyTestAccept] -myaddr 127.0.0.1 0]
set in [open $thisScript] ;# 126 K
set out [socket 127.0.0.1 [lindex [fconfigure $listen -sockname] 2]]
catch {unset fcopyTestDone}
close $listen ;# This means the socket open never really succeeds
fcopy $in $out -command [namespace code FcopyTestDone]
variable fcopyTestDone
|
| ︙ | |||
7551 7552 7553 7554 7555 7556 7557 | 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 | - - |
lappend res [catch {seek $c 0 start}]
close $c
removeFile cutsplice
set res
} {0 1 0}
|
| ︙ | |||
7770 7771 7772 7773 7774 7775 7776 | 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 | - - + |
} [lrange $expected 0 end]
}
test io-73.1 {channel Tcl_Obj SetChannelFromAny} {} {
# Test for Bug 1847044 - don't spoil type unless we have a valid channel
catch {close [lreplace [list a] 0 end]}
} {1}
|
Changes to unix/Makefile.in.
| ︙ | |||
1188 1189 1190 1191 1192 1193 1194 1195 | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | + + - + | tclLoadDl2.o: $(UNIX_DIR)/tclLoadDl2.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclLoadDl2.c tclLoadDld.o: $(UNIX_DIR)/tclLoadDld.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclLoadDld.c # Can explicitly list this: we know we'll only ever compile this file with # something that understands deprecated declarations as it is OSX-specific. tclLoadDyld.o: $(UNIX_DIR)/tclLoadDyld.c |
| ︙ |
Changes to unix/dltest/pkga.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + - + | #include "tcl.h" /* * Prototypes for procedures defined later in this file: */ static int Pkga_EqObjCmd(ClientData clientData, |
| ︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - + - + |
*----------------------------------------------------------------------
*/
static int
Pkga_EqObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
83 84 85 86 87 88 89 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | - + |
*----------------------------------------------------------------------
*/
static int
Pkga_QuoteObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to unix/dltest/pkgb.c.
| ︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + - + - + | #include "tcl.h" /* * Prototypes for procedures defined later in this file: */ static int Pkgb_SubObjCmd(ClientData clientData, |
| ︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | - + |
# define Tcl_GetErrorLine(interp) ((interp)->errorLine)
#endif
static int
Pkgb_SubObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
86 87 88 89 90 91 92 | 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 112 113 114 115 116 117 118 | - + - + - - - - |
*----------------------------------------------------------------------
*/
static int
Pkgb_UnsafeObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to unix/dltest/pkgc.c.
| ︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + - + | #include "tcl.h" /* * Prototypes for procedures defined later in this file: */ static int Pkgc_SubObjCmd(ClientData clientData, |
| ︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - + |
*----------------------------------------------------------------------
*/
static int
Pkgc_SubObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
77 78 79 80 81 82 83 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + - + + |
*----------------------------------------------------------------------
*/
static int
Pkgc_UnsafeObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to unix/dltest/pkgd.c.
| ︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + - + | #include "tcl.h" /* * Prototypes for procedures defined later in this file: */ static int Pkgd_SubObjCmd(ClientData clientData, |
| ︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - + |
*----------------------------------------------------------------------
*/
static int
Pkgd_SubObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
77 78 79 80 81 82 83 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + - + + |
*----------------------------------------------------------------------
*/
static int
Pkgd_UnsafeObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to unix/dltest/pkgua.c.
| ︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + - + | #include "tcl.h" /* * Prototypes for procedures defined later in this file: */ static int PkguaEqObjCmd(ClientData clientData, |
| ︙ | |||
115 116 117 118 119 120 121 | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | - + - + |
*----------------------------------------------------------------------
*/
static int
PkguaEqObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
159 160 161 162 163 164 165 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | - + |
*----------------------------------------------------------------------
*/
static int
PkguaQuoteObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to unix/tclLoadDl.c.
| ︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | + + |
/*
* First try the full path the user gave us. This is particularly
* important if the cwd is inside a vfs, and we are trying to load using a
* relative path.
*/
native = Tcl_FSGetNativePath(pathPtr);
/*
* Use (RTLD_NOW|RTLD_LOCAL) as default, see [Bug #3216070]
*/
if (flags & TCL_LOAD_GLOBAL) {
dlopenflags |= RTLD_GLOBAL;
} else {
dlopenflags |= RTLD_LOCAL;
}
if (flags & TCL_LOAD_LAZY) {
dlopenflags |= RTLD_LAZY;
|
| ︙ | |||
104 105 106 107 108 109 110 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - + + + | * string the user gave us which hopefully refers to a file on the * binary path. */ Tcl_DString ds; const char *fileName = Tcl_GetString(pathPtr); |
| ︙ | |||
173 174 175 176 177 178 179 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - + - + |
/*
* Some platforms still add an underscore to the beginning of symbol
* names. If we can't find a name without an underscore, try again with
* the underscore.
*/
|
| ︙ |
Changes to unix/tclLoadDyld.c.
| ︙ | |||
178 179 180 181 182 183 184 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | - + |
* First try the full path the user gave us. This is particularly
* important if the cwd is inside a vfs, and we are trying to load using a
* relative path.
*/
nativePath = Tcl_FSGetNativePath(pathPtr);
nativeFileName = Tcl_UtfToExternalDString(NULL, Tcl_GetString(pathPtr),
|
| ︙ | |||
246 247 248 249 250 251 252 253 254 255 256 257 258 259 | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | + |
* attempt to load it as a MH_BUNDLE.
*/
err = NSCreateObjectFileImageFromFile(nativePath,
&dyldObjFileImage);
if (err == NSObjectFileImageSuccess && dyldObjFileImage) {
int nsflags = NSLINKMODULE_OPTION_RETURN_ON_ERROR;
if (!(flags & 1)) nsflags |= NSLINKMODULE_OPTION_PRIVATE;
if (!(flags & 2)) nsflags |= NSLINKMODULE_OPTION_BINDNOW;
module = NSLinkModule(dyldObjFileImage, nativePath, nsflags);
NSDestroyObjectFileImage(dyldObjFileImage);
if (module) {
modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle));
modulePtr->module = module;
|
| ︙ | |||
288 289 290 291 292 293 294 | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | - + |
*unloadProcPtr = &UnloadFile;
*loadHandle = newHandle;
result = TCL_OK;
} else {
Tcl_Obj *errObj = Tcl_NewObj();
if (errMsg != NULL) {
|
| ︙ | |||
333 334 335 336 337 338 339 | 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 | - + - + |
{
Tcl_DyldLoadHandle *dyldLoadHandle = loadHandle->clientData;
Tcl_PackageInitProc *proc = NULL;
const char *errMsg = NULL;
Tcl_DString ds;
const char *native;
|
| ︙ | |||
507 508 509 510 511 512 513 | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | - + |
*----------------------------------------------------------------------
*/
#ifdef TCL_LOAD_FROM_MEMORY
MODULE_SCOPE void *
TclpLoadMemoryGetBuffer(
Tcl_Interp *interp, /* Used for error reporting. */
|
| ︙ | |||
554 555 556 557 558 559 560 | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | - - - - + + + + |
#ifdef TCL_LOAD_FROM_MEMORY
MODULE_SCOPE int
TclpLoadMemory(
Tcl_Interp *interp, /* Used for error reporting. */
void *buffer, /* Buffer containing the desired code
* (allocated with TclpLoadMemoryGetBuffer). */
|
| ︙ | |||
579 580 581 582 583 584 585 | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | - + |
const char *objFileImageErrMsg = NULL;
int nsflags = NSLINKMODULE_OPTION_RETURN_ON_ERROR;
/*
* Try to create an object file image that we can load from.
*/
|
| ︙ | |||
668 669 670 671 672 673 674 | 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 | + - - + + + + + - + |
return TCL_ERROR;
}
/*
* Extract the module we want from the image of the object file.
*/
if (!(flags & 1)) {
|
| ︙ |
Changes to unix/tclLoadNext.c.
| ︙ | |||
79 80 81 82 83 84 85 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - + | * Let the OS loader examine the binary search path for whatever * string the user gave us which hopefully refers to a file on the * binary path */ Tcl_DString ds; |
| ︙ |
Changes to unix/tclLoadOSF.c.
| ︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | - + | * Let the OS loader examine the binary search path for whatever * string the user gave us which hopefully refers to a file on the * binary path */ Tcl_DString ds; |
| ︙ |
Changes to unix/tclLoadShl.c.
| ︙ | |||
82 83 84 85 86 87 88 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - + | * Let the OS loader examine the binary search path for whatever * string the user gave us which hopefully refers to a file on the * binary path. */ Tcl_DString ds; |
| ︙ | |||
136 137 138 139 140 141 142 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - + |
* of exported symbols while others don't; try both forms of each name.
*/
if (shl_findsym(&handle, symbol, (short) TYPE_PROCEDURE,
(void *) &proc) != 0) {
Tcl_DStringInit(&newName);
TclDStringAppendLiteral(&newName, "_");
|
| ︙ |
Changes to unix/tclUnixChan.c.
| ︙ | |||
92 93 94 95 96 97 98 | 92 93 94 95 96 97 98 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 | - - + + - - + - - + - - + - - + - - + - - + - - + + + - - - - - - |
Tcl_SetErrorCode(interp, "TCL", "UNSUPPORTED", NULL); \
}
/*
* Static routines for this file:
*/
|
| ︙ | |||
227 228 229 230 231 232 233 | 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 | - + - + - + - - + + | * * Side effects: * Reads input from the input device of the channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
274 275 276 277 278 279 280 | 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 | - + - + - + - - - + + + - - + + | * * Side effects: * Writes output on the output device of the channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
577 578 579 580 581 582 583 | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | - + |
Tcl_Interp *interp, /* For error reporting - can be NULL. */
const char *optionName, /* Which option to set? */
const char *value) /* New value for option. */
{
FileState *fsPtr = instanceData;
unsigned int len, vlen;
TtyAttrs tty;
|
| ︙ |
Changes to unix/tclUnixCompat.c.
| ︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 | 43 44 45 46 47 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 | + + + - + - + - + - + - + |
/*
* Per-thread private storage used to store values returned from MT-unsafe
* library calls.
*/
#ifdef TCL_THREADS
#define STANDARD_BUFFER_SIZE 2048
#define INITIAL_PWGR_BUFFER_SIZE 1024
typedef struct {
struct passwd pwd;
#if defined(HAVE_GETPWNAM_R_5) || defined(HAVE_GETPWUID_R_5)
#define NEED_PW_CLEANER 1
char *pbuf;
|
| ︙ | |||
95 96 97 98 99 100 101 | 98 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 126 | - + + - + + - - + + - - + + | #undef NEED_COPYGRP #undef NEED_COPYHOSTENT #undef NEED_COPYPWD #undef NEED_COPYSTRING #if !defined(HAVE_GETGRNAM_R_5) && !defined(HAVE_GETGRNAM_R_4) #define NEED_COPYGRP 1 |
| ︙ | |||
191 192 193 194 195 196 197 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | - - - + + + + + + |
/*
* How to allocate a buffer of the right initial size. If you want the
* gory detail, see http://www.opengroup.org/austin/docs/austin_328.txt
* and weep.
*/
if (tsdPtr->pbuf == NULL) {
|
| ︙ | |||
271 272 273 274 275 276 277 | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | - - - + + + + + + |
/*
* How to allocate a buffer of the right initial size. If you want the
* gory detail, see http://www.opengroup.org/austin/docs/austin_328.txt
* and weep.
*/
if (tsdPtr->pbuf == NULL) {
|
| ︙ | |||
374 375 376 377 378 379 380 | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | - - - + + + + + + |
/*
* How to allocate a buffer of the right initial size. If you want the
* gory detail, see http://www.opengroup.org/austin/docs/austin_328.txt
* and weep.
*/
if (tsdPtr->gbuf == NULL) {
|
| ︙ | |||
454 455 456 457 458 459 460 | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | - - - + + + + + + |
/*
* How to allocate a buffer of the right initial size. If you want the
* gory detail, see http://www.opengroup.org/austin/docs/austin_328.txt
* and weep.
*/
if (tsdPtr->gbuf == NULL) {
|
| ︙ | |||
677 678 679 680 681 682 683 | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | - + - + |
#define NEED_COPYARRAY 1
#define NEED_COPYSTRING 1
static int
CopyGrp(
struct group *tgtPtr,
char *buf,
|
| ︙ | |||
711 712 713 714 715 716 717 | 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | - + |
p = buf + len;
/*
* Copy group members.
*/
PadBuffer(p, len, sizeof(char *));
|
| ︙ | |||
750 751 752 753 754 755 756 | 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 793 794 795 | - + - + - + |
#define NEED_COPYSTRING 1
#define NEED_COPYARRAY 1
static int
CopyHostent(
struct hostent *tgtPtr,
char *buf,
|
| ︙ | |||
812 813 814 815 816 817 818 | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | - + - + |
#ifdef NEED_COPYPWD
#define NEED_COPYSTRING 1
static int
CopyPwd(
struct passwd *tgtPtr,
char *buf,
|
| ︙ | |||
871 872 873 874 875 876 877 | 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 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | + - + - - + + - + - + - + - + | * Side effects: * None. * *--------------------------------------------------------------------------- */ #ifdef NEED_COPYARRAY |
| ︙ | |||
935 936 937 938 939 940 941 | 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 | - + - + - + - + - - - - - - - - - + + | * Side effects: * None * *--------------------------------------------------------------------------- */ #ifdef NEED_COPYSTRING |
| ︙ | |||
1006 1007 1008 1009 1010 1011 1012 | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | - + |
: "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
: "a"(index));
#endif
status = TCL_OK;
#endif
return status;
}
|
Changes to unix/tclUnixFCmd.c.
| ︙ | |||
521 522 523 524 525 526 527 | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | - + |
const Tcl_StatBuf *statBufPtr,
/* Used to determine mode and blocksize. */
int dontCopyAtts) /* If flag set, don't copy attributes. */
{
int srcFd, dstFd;
unsigned blockSize; /* Optimal I/O blocksize for filesystem */
char *buffer; /* Data buffer for copy */
|
| ︙ | |||
577 578 579 580 581 582 583 | 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 | - - + + - - + + - + |
*/
if (blockSize <= 0) {
blockSize = DEFAULT_COPY_BLOCK_SIZE;
}
buffer = ckalloc(blockSize);
while (1) {
|
| ︙ | |||
1472 1473 1474 1475 1476 1477 1478 | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 | - + |
int result;
const char *native;
if (Tcl_GetLongFromObj(NULL, attributePtr, &gid) != TCL_OK) {
Tcl_DString ds;
struct group *groupPtr = NULL;
const char *string;
|
| ︙ | |||
1539 1540 1541 1542 1543 1544 1545 | 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | - + |
int result;
const char *native;
if (Tcl_GetLongFromObj(NULL, attributePtr, &uid) != TCL_OK) {
Tcl_DString ds;
struct passwd *pwPtr = NULL;
const char *string;
|
| ︙ | |||
1911 1912 1913 1914 1915 1916 1917 | 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 | - + |
int
TclpObjNormalizePath(
Tcl_Interp *interp,
Tcl_Obj *pathPtr,
int nextCheckpoint)
{
const char *currentPathEndPosition;
|
| ︙ | |||
2142 2143 2144 2145 2146 2147 2148 | 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 | + - + |
Tcl_Obj *dirObj,
Tcl_Obj *basenameObj,
Tcl_Obj *extensionObj,
Tcl_Obj *resultingNameObj)
{
Tcl_DString template, tmp;
const char *string;
int fd;
|
| ︙ |
Changes to unix/tclUnixFile.c.
| ︙ | |||
255 256 257 258 259 260 261 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | - + |
}
Tcl_DecrRefCount(tailPtr);
Tcl_DecrRefCount(fileNamePtr);
} else {
DIR *d;
Tcl_DirEntry *entryPtr;
const char *dirName;
|
| ︙ | |||
930 931 932 933 934 935 936 | 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | - + |
}
/*
* Check symbolic link flag first, since we prefer to create these.
*/
if (linkAction & TCL_CREATE_SYMBOLIC_LINK) {
|
| ︙ | |||
1073 1074 1075 1076 1077 1078 1079 | 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 | - + |
TclNativeCreateNativeRep(
Tcl_Obj *pathPtr)
{
char *nativePathPtr;
const char *str;
Tcl_DString ds;
Tcl_Obj *validPathPtr;
|
| ︙ | |||
1103 1104 1105 1106 1107 1108 1109 | 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | - + |
}
str = Tcl_GetStringFromObj(validPathPtr, &len);
Tcl_UtfToExternalDString(NULL, str, len, &ds);
len = Tcl_DStringLength(&ds) + sizeof(char);
Tcl_DecrRefCount(validPathPtr);
nativePathPtr = ckalloc(len);
|
| ︙ |
Changes to unix/tclUnixInit.c.
| ︙ | |||
454 455 456 457 458 459 460 | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | - + |
*
*-------------------------------------------------------------------------
*/
void
TclpInitLibraryPath(
char **valuePtr,
|
| ︙ | |||
477 478 479 480 481 482 483 | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | - + |
str = getenv("TCL_LIBRARY"); /* INTL: Native. */
Tcl_ExternalToUtfDString(NULL, str, -1, &buffer);
str = Tcl_DStringValue(&buffer);
if ((str != NULL) && (str[0] != '\0')) {
Tcl_DString ds;
|
| ︙ | |||
979 980 981 982 983 984 985 | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | - + |
*----------------------------------------------------------------------
*/
int
TclpFindVariable(
const char *name, /* Name of desired environment variable
* (native). */
|
| ︙ |
Changes to unix/tclUnixPipe.c.
| ︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - - + + - - + - - + - - + - - + | * the children at close time. */ } PipeState; /* * Declarations for local functions defined in this file: */ |
| ︙ | |||
375 376 377 378 379 380 381 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | - + |
/* ARGSUSED */
int
TclpCreateProcess(
Tcl_Interp *interp, /* Interpreter in which to leave errors that
* occurred when creating the child process.
* Error messages from the child process
* itself are sent to errorFile. */
|
| ︙ | |||
1030 1031 1032 1033 1034 1035 1036 | 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 | - + - + - + - + | * * Side effects: * Reads input from the input device of the channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | 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 | - + - + - + - + | * * Side effects: * Writes output on the output device of the channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1248 1249 1250 1251 1252 1253 1254 | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | - + |
*/
/* ARGSUSED */
int
Tcl_PidObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to unix/tclUnixSock.c.
| ︙ | |||
109 110 111 112 113 114 115 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - - + + - - + - - + - - + - - - + - - + - - + |
/*
* Static routines for this file:
*/
static int CreateClientSocket(Tcl_Interp *interp,
TcpState *state);
static void TcpAccept(ClientData data, int mask);
|
| ︙ | |||
176 177 178 179 180 181 182 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | - + |
*
*----------------------------------------------------------------------
*/
static void
InitializeHostName(
char **valuePtr,
|
| ︙ | |||
433 434 435 436 437 438 439 | 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 | - + - + - + - + | * Side effects: * Reads input from the input device of the channel. * *---------------------------------------------------------------------- */ /* ARGSUSED */ |
| ︙ | |||
484 485 486 487 488 489 490 | 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 503 504 505 | - + - + - + - + | * * Side effects: * Writes output on the output device of the channel. * *---------------------------------------------------------------------- */ |
| ︙ |
Changes to unix/tclUnixTest.c.
| ︙ | |||
136 137 138 139 140 141 142 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - + |
*----------------------------------------------------------------------
*/
static int
TestfilehandlerCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
358 359 360 361 362 363 364 | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | - + |
*----------------------------------------------------------------------
*/
static int
TestfilewaitCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
427 428 429 430 431 432 433 | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | - + |
*----------------------------------------------------------------------
*/
static int
TestfindexecutableCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
470 471 472 473 474 475 476 | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | - + |
*----------------------------------------------------------------------
*/
static int
TestgetopenfileCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
513 514 515 516 517 518 519 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | - - + + |
*----------------------------------------------------------------------
*/
static int
TestsetdefencdirCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
553 554 555 556 557 558 559 | 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | - - + + |
*----------------------------------------------------------------------
*/
static int
TestforkObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
599 600 601 602 603 604 605 | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | - - + + - + |
*----------------------------------------------------------------------
*/
static int
TestgetdefencdirCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
643 644 645 646 647 648 649 | 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | - + |
*----------------------------------------------------------------------
*/
static int
TestalarmCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
722 723 724 725 726 727 728 | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | - + |
*----------------------------------------------------------------------
*/
static int
TestgotsigCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
753 754 755 756 757 758 759 | 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | - + + - + |
*---------------------------------------------------------------------------
*/
static int
TestchmodCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to unix/tclUnixThrd.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 82 83 84 85 86 87 88 89 90 91 92 93 | - + - + |
*/
int
TclpThreadCreate(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
ClientData clientData, /* The one argument to Main() */
|
| ︙ |
Changes to unix/tclXtTest.c.
| ︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | static Tcl_CmdProc TesteventloopCmd; extern DLLEXPORT Tcl_PackageInitProc Tclxttest_Init; /* * Functions defined in tclXtNotify.c for use by users of the Xt Notifier: */ |
| ︙ | |||
76 77 78 79 80 81 82 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - + |
*----------------------------------------------------------------------
*/
static int
TesteventloopCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to win/tclAppInit.c.
| ︙ | |||
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | - + - - - + + + - + + - + - + | * * Side effects: * Just about anything, since from here we call arbitrary Tcl code. * *---------------------------------------------------------------------- */ |
| ︙ | |||
193 194 195 196 197 198 199 | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - - + + + |
/*
* Specify a user-specific startup file to invoke if the application is
* run interactively. Typically the startup file is "~/.apprc" where "app"
* is the name of the application. If this line is deleted then no
* user-specific startup file will be run under any conditions.
*/
|
| ︙ | |||
255 256 257 258 259 260 261 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | + - - - + + + + + + |
}
if (*p == '\0') {
break;
}
}
}
/*
|
| ︙ |
Changes to win/tclWin32Dll.c.
| ︙ | |||
82 83 84 85 86 87 88 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - - + | MountPointMap *driveLetterLookup = NULL; TCL_DECLARE_MUTEX(mountPointMap) /* * We will need this below. */ |
| ︙ | |||
149 150 151 152 153 154 155 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | - - + |
* DLL_PROCESS_DETACH is unnecessary as the user should call
* Tcl_Finalize explicitly before unloading Tcl.
*/
}
return TRUE;
}
|
| ︙ | |||
354 355 356 357 358 359 360 361 362 363 364 365 366 367 | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | + |
* None.
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
void
TclWinResetInterfaces(void)
{
if (winTCharEncoding != NULL) {
Tcl_FreeEncoding(winTCharEncoding);
winTCharEncoding = NULL;
}
|
| ︙ | |||
574 575 576 577 578 579 580 | 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 | - - + + - - + + + |
*
*---------------------------------------------------------------------------
*/
TCHAR *
Tcl_WinUtfToTChar(
const char *string, /* Source string in UTF-8. */
|
| ︙ |
Changes to win/tclWinChan.c.
| ︙ | |||
67 68 69 70 71 72 73 | 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 | - + - - - + - - - + - - - + - - + - - + - - - - - - - - - - + + + + + + + + + + + + + | * pointer. */ } FileEvent; /* * Static routines for this file: */ |
| ︙ | |||
662 663 664 665 666 667 668 | 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 688 689 690 691 692 693 | - + - + - + | * * Side effects: * Reads input from the actual channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
713 714 715 716 717 718 719 | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | - + - + | * * Side effects: * Writes output on the actual channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
741 742 743 744 745 746 747 | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | - + |
if (WriteFile(infoPtr->handle, (LPVOID) buf, (DWORD) toWrite,
&bytesWritten, (LPOVERLAPPED) NULL) == FALSE) {
TclWinConvertError(GetLastError());
*errorCode = errno;
return -1;
}
infoPtr->dirty = 1;
|
| ︙ |
Changes to win/tclWinConsole.c.
| ︙ | |||
95 96 97 98 99 100 101 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - + - + - - + + |
DWORD writeError; /* An error caused by the last background
* write. Set to 0 if no error has been
* detected. This word is shared with the
* writer thread so access must be
* synchronized with the writable object. */
char *writeBuf; /* Current background output buffer. Access is
* synchronized with the writable object. */
|
| ︙ | |||
137 138 139 140 141 142 143 | 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 | - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - | * pointer. */ } ConsoleEvent; /* * Declarations for functions used only in this file. */ |
| ︙ | |||
691 692 693 694 695 696 697 | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | - + - + | * * Side effects: * Reads input from the actual channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
777 778 779 780 781 782 783 | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | - + - + | * * Side effects: * Writes output on the actual channel. * *---------------------------------------------------------------------- */ |
| ︙ |
Changes to win/tclWinDde.c.
| ︙ | |||
88 89 90 91 92 93 94 | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | - - - + + + |
static int ddeIsServer = 0;
#define TCL_DDE_VERSION "1.4.0"
#define TCL_DDE_PACKAGE_NAME "dde"
#define TCL_DDE_SERVICE_NAME TEXT("TclEval")
#define TCL_DDE_EXECUTE_RESULT TEXT("$TCLEVAL$EXECUTE$RESULT")
|
| ︙ | |||
117 118 119 120 121 122 123 | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | - + - - | LPARAM lParam); static void DeleteProc(ClientData clientData); static Tcl_Obj * ExecuteRemoteObject(RegisteredInterp *riPtr, Tcl_Obj *ddeObjectPtr); static int MakeDdeConnection(Tcl_Interp *interp, const TCHAR *name, HCONV *ddeConvPtr); static void SetDdeError(Tcl_Interp *interp); |
| ︙ | |||
271 272 273 274 275 276 277 | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | - + - + - + + |
*
*----------------------------------------------------------------------
*/
static const TCHAR *
DdeSetServerName(
Tcl_Interp *interp,
|
| ︙ | |||
340 341 342 343 344 345 346 | 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 | - + + - - + + + + - + + - + |
srvListPtr = Tcl_GetObjResult(interp);
}
if (r == TCL_OK) {
r = Tcl_ListObjGetElements(interp, srvListPtr, &srvCount,
&srvPtrPtr);
}
if (r != TCL_OK) {
|
| ︙ | |||
540 541 542 543 544 545 546 | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | - + |
{
Tcl_Obj *returnPackagePtr;
int result = TCL_OK;
if (riPtr->handlerPtr == NULL && Tcl_IsSafe(riPtr->interp)) {
Tcl_SetObjResult(riPtr->interp, Tcl_NewStringObj("permission denied: "
"a handler procedure must be defined for use in a safe "
|
| ︙ | |||
735 736 737 738 739 740 741 | 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 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | - + - - + + - - + + - - + + - - + + + - - - + + + |
* Empty loop body.
*/
}
if (convPtr != NULL) {
char *returnString;
|
| ︙ | |||
813 814 815 816 817 818 819 | 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 | - + - + - + + - + |
}
if (convPtr && !Tcl_IsSafe(convPtr->riPtr->interp)) {
Tcl_DString ds;
Tcl_Obj *variableObjPtr;
Tcl_Obj *varName;
|
| ︙ | |||
873 874 875 876 877 878 879 | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | - + + |
if (!string[dlen-1]) {
dlen--;
}
ddeObjectPtr = Tcl_NewStringObj(string, dlen);
} else {
/* unicode */
dlen >>= 1;
|
| ︙ | |||
992 993 994 995 996 997 998 | 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 | - + + - + - + + |
Tcl_Interp *interp, /* Used to report errors. */
const TCHAR *name, /* The connection to use. */
HCONV *ddeConvPtr)
{
HSZ ddeTopic, ddeService;
HCONV ddeConv;
|
| ︙ | |||
1112 1113 1114 1115 1116 1117 1118 | 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | - - + + + - - + + + |
if ((es->service == (ATOM)0 || es->service == service)
&& (es->topic == (ATOM)0 || es->topic == topic)) {
Tcl_Obj *matchPtr = Tcl_NewListObj(0, NULL);
Tcl_Obj *resultPtr = Tcl_GetObjResult(es->interp);
GlobalGetAtomName(service, sz, 255);
|
| ︙ | |||
1235 1236 1237 1238 1239 1240 1241 | 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | - + |
errorCode = "NOCANDO";
break;
default:
errorMessage = "dde command failed";
errorCode = "FAILED";
}
|
| ︙ | |||
1260 1261 1262 1263 1264 1265 1266 | 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | - + |
*----------------------------------------------------------------------
*/
static int
DdeObjCmd(
ClientData clientData, /* Used only for deletion */
Tcl_Interp *interp, /* The interp we are sending from */
|
| ︙ | |||
1289 1290 1291 1292 1293 1294 1295 | 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | + - + |
static const char *const ddeEvalOptions[] = {
"-async", NULL
};
static const char *const ddeReqOptions[] = {
"-binary", NULL
};
size_t i, length;
|
| ︙ | |||
1465 1466 1467 1468 1469 1470 1471 | 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 | + - + - + + - + + |
} else if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) {
ddeService = DdeCreateStringHandle(ddeInstance, (void *) serviceName,
CP_WINUNICODE);
}
if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) {
#ifdef UNICODE
topicName = (TCHAR *)
|
| ︙ | |||
1507 1508 1509 1510 1511 1512 1513 | 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 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 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 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 1646 1647 1648 1649 1650 | - + + - + - + + - - + + + + - - + + - - + + - + + - + + - - + + - + - + - - + + - - + + |
dataString =
Tcl_GetUnicodeFromObj(objv[firstArg + 2], &dataLength);
dataLength = (dataLength + 1) * sizeof(Tcl_UniChar);
}
if (dataLength <= 0) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
1641 1642 1643 1644 1645 1646 1647 | 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 | - - + + + + |
if (hConv == NULL) {
SetDdeError(interp);
result = TCL_ERROR;
} else {
ddeItem = DdeCreateStringHandle(ddeInstance, (void *) itemString,
CP_WINUNICODE);
if (ddeItem != NULL) {
|
| ︙ | |||
1664 1665 1666 1667 1668 1669 1670 | 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 | - - + + |
break;
case DDE_EVAL: {
RegisteredInterp *riPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (serviceName == NULL) {
|
| ︙ | |||
1713 1714 1715 1716 1717 1718 1719 | 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 | - + + |
* interp is then deleted, the bytecode structure would be
* referring to deallocated objects.
*/
if (Tcl_IsSafe(riPtr->interp) && riPtr->handlerPtr == NULL) {
Tcl_SetObjResult(riPtr->interp, Tcl_NewStringObj(
"permission denied: a handler procedure must be"
|
| ︙ | |||
1782 1783 1784 1785 1786 1787 1788 | 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 | - - + + - - + + - - + + |
/*
* This is a non-local request. Send the script to the server and
* poll it for a result.
*/
if (MakeDdeConnection(interp, serviceName, &hConv) != TCL_OK) {
invalidServerResponse:
|
| ︙ |
Changes to win/tclWinFCmd.c.
| ︙ | |||
343 344 345 346 347 348 349 | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | - - + + |
nativeDstPath, &nativeDstRest);
if ((size == 0) || (size > MAX_PATH)) {
return TCL_ERROR;
}
CharLower(nativeSrcPath);
CharLower(nativeDstPath);
|
| ︙ | |||
926 927 928 929 930 931 932 | 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 | - - + + - + |
normSrcPtr = Tcl_FSGetNormalizedPath(NULL,srcPathPtr);
normDestPtr = Tcl_FSGetNormalizedPath(NULL,destPathPtr);
if ((normSrcPtr == NULL) || (normDestPtr == NULL)) {
return TCL_ERROR;
}
|
| ︙ | |||
999 1000 1001 1002 1003 1004 1005 | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | - + |
*/
Tcl_DString native;
normPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (normPtr == NULL) {
return TCL_ERROR;
}
|
| ︙ | |||
1123 1124 1125 1126 1127 1128 1129 | 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 | - + - - + + - + |
* don't want to initialise the errorPtr yet.
*/
return TCL_ERROR;
}
end:
if (errorPtr != NULL) {
|
| ︙ | |||
1334 1335 1336 1337 1338 1339 1340 | 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 | - + |
DOTREE_POSTD, errorPtr);
}
end:
if (nativeErrfile != NULL) {
TclWinConvertError(GetLastError());
if (errorPtr != NULL) {
|
| ︙ | |||
1399 1400 1401 1402 1403 1404 1405 | 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 | - + |
/*
* There shouldn't be a problem with src, because we already checked it to
* get here.
*/
if (errorPtr != NULL) {
|
| ︙ | |||
1454 1455 1456 1457 1458 1459 1460 | 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | - + |
if (DoRemoveJustDirectory(nativeSrc, 0, NULL) == TCL_OK) {
return TCL_OK;
}
break;
}
if (errorPtr != NULL) {
|
| ︙ | |||
1713 1714 1715 1716 1717 1718 1719 | 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 | - + - + | * about the second. * * fprintf(stderr, "%d\n", data.w.cAlternateFileName[0]); * fprintf(stderr, "%d\n", ((WCHAR *) nativeName)[0]); */ Tcl_DStringInit(&dsTemp); |
| ︙ | |||
1952 1953 1954 1955 1956 1957 1958 | 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 | - + - + |
buf[2] = '/';
buf[3] = '\0';
for (i = 0; i < 26; i++) {
buf[0] = (char) ('a' + i);
if (GetVolumeInformationA(buf, NULL, 0, NULL, NULL, NULL, NULL, 0)
|| (GetLastError() == ERROR_NOT_READY)) {
|
| ︙ |
Changes to win/tclWinFile.c.
| ︙ | |||
160 161 162 163 164 165 166 | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | - + | static int NativeIsExec(const TCHAR *path); static int NativeReadReparse(const TCHAR *LinkDirectory, REPARSE_DATA_BUFFER *buffer, DWORD desiredAccess); static int NativeWriteReparse(const TCHAR *LinkDirectory, REPARSE_DATA_BUFFER *buffer); static int NativeMatchType(int isDrive, DWORD attr, const TCHAR *nativeName, Tcl_GlobTypeData *types); |
| ︙ | |||
874 875 876 877 878 879 880 | 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | - + |
* Convert to WCHAR to get out of ANSI codepage
*/
MultiByteToWideChar(CP_ACP, 0, name, -1, wName, MAX_PATH);
#endif
WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL);
TclWinNoBackslash(name);
|
| ︙ | |||
924 925 926 927 928 929 930 | 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | - + - + |
Tcl_Obj *norm = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (norm != NULL) {
/*
* Match a single file directly.
*/
|
| ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 | - + - + |
if (strpbrk(pattern, "[]\\") == NULL) {
/*
* The pattern is a simple one containing just '*' and/or '?'.
* This means we can get the OS to help us, by passing it the
* pattern.
*/
|
| ︙ | |||
1088 1089 1090 1091 1092 1093 1094 | 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 | - + |
do {
const char *utfname;
int checkDrive = 0, isDrive;
DWORD attr;
native = data.cFileName;
attr = data.dwFileAttributes;
|
| ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | - + |
* because for NTFS root volumes, the getFileAttributesProc returns a 'hidden'
* attribute when it should not.
*/
static int
WinIsDrive(
const char *name, /* Name (UTF-8) */
|
| ︙ | |||
1441 1442 1443 1444 1445 1446 1447 | 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 | - + |
WCHAR buf[MAX_PATH];
Tcl_DStringInit(bufferPtr);
wDomain = NULL;
domain = strchr(name, '@');
if (domain != NULL) {
Tcl_DStringInit(&ds);
|
| ︙ | |||
1524 1525 1526 1527 1528 1529 1530 | 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 | - - - + |
*/
static int
NativeAccess(
const TCHAR *nativePath, /* Path of file to access, native encoding. */
int mode) /* Permission setting. */
{
|
| ︙ | |||
1548 1549 1550 1551 1552 1553 1554 | 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 | - - - + + |
/*
* File exists, nothing else to check.
*/
return 0;
}
|
| ︙ | |||
1872 1873 1874 1875 1876 1877 1878 | 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 | - + |
*/
native = (WCHAR *) buffer;
if ((native[0] != '\0') && (native[1] == ':')
&& (native[2] == '\\') && (native[3] == '\\')) {
native += 2;
}
|
| ︙ | |||
2053 2054 2055 2056 2057 2058 2059 | 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 | - + |
int dev;
Tcl_DString ds;
TCHAR nativeFullPath[MAX_PATH];
TCHAR *nativePart;
const char *fullPath;
GetFullPathName(nativePath, MAX_PATH, nativeFullPath, &nativePart);
|
| ︙ | |||
2354 2355 2356 2357 2358 2359 2360 | 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 | - + |
}
if (found == 0) {
return NULL;
} else {
Tcl_DString ds;
|
| ︙ | |||
2671 2672 2673 2674 2675 2676 2677 | 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 | - + | int len; char *path; Tcl_Obj *tmpPathPtr; tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), nextCheckpoint); |
| ︙ | |||
2744 2745 2746 2747 2748 2749 2750 | 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 | - + | * Path of form /foo/bar which is a path in the root directory of the * current volume. */ const char *drive = Tcl_GetString(useThisCwd); absolutePath = Tcl_NewStringObj(drive,2); |
| ︙ | |||
2798 2799 2800 2801 2802 2803 2804 | 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 | - + | * could use the '_dgetdcwd' Win32 API to get the drive's cwd. */ absolutePath = Tcl_NewStringObj(path, 2); Tcl_AppendToObj(absolutePath, "/", 1); } Tcl_IncrRefCount(absolutePath); |
| ︙ | |||
2831 2832 2833 2834 2835 2836 2837 | 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 | - + - + |
Tcl_Obj *
TclpNativeToNormalized(
ClientData clientData)
{
Tcl_DString ds;
Tcl_Obj *objPtr;
|
| ︙ | |||
2864 2865 2866 2867 2868 2869 2870 | 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 | - + |
for (p = copy; *p != '\0'; p++) {
if (*p == '\\') {
*p = '/';
}
}
|
| ︙ | |||
2893 2894 2895 2896 2897 2898 2899 | 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 | - + |
ClientData
TclNativeCreateNativeRep(
Tcl_Obj *pathPtr)
{
char *nativePathPtr, *str;
Tcl_DString ds;
Tcl_Obj *validPathPtr;
|
| ︙ |
Changes to win/tclWinInit.c.
| ︙ | |||
172 173 174 175 176 177 178 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | - + |
*
*-------------------------------------------------------------------------
*/
void
TclpInitLibraryPath(
char **valuePtr,
|
| ︙ | |||
216 217 218 219 220 221 222 | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | - + |
Tcl_ListObjAppendElement(NULL, pathPtr,
TclGetProcessGlobalValue(&sourceLibraryDir));
*encodingPtr = NULL;
bytes = Tcl_GetStringFromObj(pathPtr, lengthPtr);
*valuePtr = ckalloc((*lengthPtr) + 1);
|
| ︙ | |||
244 245 246 247 248 249 250 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | - + |
*/
static void
AppendEnvironment(
Tcl_Obj *pathPtr,
const char *lib)
{
|
| ︙ | |||
283 284 285 286 287 288 289 | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | - + |
buf[0] = '\0';
GetEnvironmentVariableA("TCL_LIBRARY", buf, MAX_PATH);
} else {
ToUtf(wBuf, buf);
}
if (buf[0] != '\0') {
|
| ︙ | |||
307 308 309 310 311 312 313 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | - + |
*/
pathv[pathc - 1] = shortlib;
Tcl_DStringInit(&ds);
(void) Tcl_JoinPath(pathc, pathv, &ds);
objPtr = TclDStringToObj(&ds);
} else {
|
| ︙ | |||
580 581 582 583 584 585 586 | 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 | - + - + + |
*/
Tcl_DStringInit(&ds);
ptr = Tcl_GetVar2(interp, "env", "HOME", TCL_GLOBAL_ONLY);
if (ptr == NULL) {
ptr = Tcl_GetVar2(interp, "env", "HOMEDRIVE", TCL_GLOBAL_ONLY);
if (ptr != NULL) {
|
| ︙ | |||
643 644 645 646 647 648 649 | 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 683 684 685 686 | - + - + + - + - + |
*----------------------------------------------------------------------
*/
int
TclpFindVariable(
const char *name, /* Name of desired environment variable
* (UTF-8). */
|
| ︙ |
Changes to win/tclWinLoad.c.
| ︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + + | * Let the OS loader examine the binary search path for whatever * string the user gave us which hopefully refers to a file on the * binary path. */ Tcl_DString ds; |
| ︙ | |||
106 107 108 109 110 111 112 | 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 134 135 136 137 138 139 140 141 | - + - + - + - + - + | case ERROR_MOD_NOT_FOUND: Tcl_SetErrorCode(interp, "WIN_LOAD", "MOD_NOT_FOUND", NULL); goto notFoundMsg; case ERROR_DLL_NOT_FOUND: Tcl_SetErrorCode(interp, "WIN_LOAD", "DLL_NOT_FOUND", NULL); notFoundMsg: Tcl_AppendToObj(errMsg, "this library or a dependent library" |
| ︙ | |||
182 183 184 185 186 187 188 | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | - + |
proc = (void *) GetProcAddress(hInstance, symbol);
if (proc == NULL) {
Tcl_DString ds;
const char *sym2;
Tcl_DStringInit(&ds);
TclDStringAppendLiteral(&ds, "_");
|
| ︙ |
Changes to win/tclWinPipe.c.
| ︙ | |||
125 126 127 128 129 130 131 | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | - + - + |
* write. Set to 0 if no error has been
* detected. This word is shared with the
* writer thread so access must be
* synchronized with the writable object.
*/
char *writeBuf; /* Current background output buffer. Access is
* synchronized with the writable object. */
|
| ︙ | |||
166 167 168 169 170 171 172 173 174 175 | 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 | + + + + + + + + + + + + - + - - - - - - - - - - - - - - - | * exists before dereferencing this * pointer. */ } PipeEvent; /* * Declarations for functions used only in this file. */ static Tcl_DriverBlockModeProc PipeBlockModeProc; static Tcl_DriverClose2Proc PipeClose2Proc; static Tcl_DriverGetHandleProc PipeGetHandleProc; static Tcl_DriverInputProc PipeInputProc; static Tcl_DriverOutputProc PipeOutputProc; static Tcl_DriverThreadActionProc PipeThreadActionProc; static Tcl_DriverWatchProc PipeWatchProc; static Tcl_EventCheckProc PipeCheckProc; static Tcl_EventProc PipeEventProc; static Tcl_EventSetupProc PipeSetupProc; static int ApplicationType(Tcl_Interp *interp, const char *fileName, char *fullName); |
| ︙ | |||
575 576 577 578 579 580 581 | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | - + |
createMode = TRUNCATE_EXISTING;
break;
default:
createMode = OPEN_EXISTING;
break;
}
|
| ︙ | |||
670 671 672 673 674 675 676 | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | - + - + |
/*
* Write the file out, doing line translations on the way.
*/
if (contents != NULL) {
DWORD result, length;
const char *p;
|
| ︙ | |||
908 909 910 911 912 913 914 | 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | - + |
int
TclpCreateProcess(
Tcl_Interp *interp, /* Interpreter in which to leave errors that
* occurred when creating the child process.
* Error messages from the child process
* itself are sent to errorFile. */
|
| ︙ | |||
1121 1122 1123 1124 1125 1126 1127 | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | - + |
} else {
createFlags = DETACHED_PROCESS;
}
if (applType == APPL_DOS) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"DOS application process not supported on this platform",
|
| ︙ | |||
1299 1300 1301 1302 1303 1304 1305 | 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 | - + - + - + |
* words, SearchPath will not find the program "a.b.exe" if the arguments
* specified "a.b" and ".exe"). So, first look for the file as it is
* named. Then manually append the extensions, looking for a match.
*/
applType = APPL_NONE;
Tcl_DStringInit(&nameBuf);
|
| ︙ | |||
1413 1414 1415 1416 1417 1418 1419 | 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | - + | * Replace long path name of executable with short path name for * 16-bit applications. Otherwise the application may not be able to * correctly parse its own command line to separate off the * application name from the arguments. */ GetShortPathName(nativeFullPath, nativeFullPath, MAX_PATH); |
| ︙ | |||
1442 1443 1444 1445 1446 1447 1448 | 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 | - + |
*----------------------------------------------------------------------
*/
static void
BuildCommandLine(
const char *executable, /* Full path of executable (including
* extension). Replacement for argv[0]. */
|
| ︙ | |||
2044 2045 2046 2047 2048 2049 2050 | 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 | - + - + | * * Side effects: * Reads input from the actual channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
2138 2139 2140 2141 2142 2143 2144 | 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 | - + - + | * * Side effects: * Writes output on the actual channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
2627 2628 2629 2630 2631 2632 2633 | 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 | - + |
*/
/* ARGSUSED */
int
Tcl_PidObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to win/tclWinReg.c.
| ︙ | |||
94 95 96 97 98 99 100 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | - + | static DWORD lastType = REG_RESOURCE_LIST; /* * Declarations for functions defined in this file. */ static void AppendSystemError(Tcl_Interp *interp, DWORD error); |
| ︙ | |||
121 122 123 124 125 126 127 | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | - + | HKEY *keyPtr); static int ParseKeyName(Tcl_Interp *interp, char *name, char **hostNamePtr, HKEY *rootKeyPtr, char **keyNamePtr); static DWORD RecursiveDeleteKey(HKEY hStartKey, const TCHAR * pKeyName, REGSAM mode); static int RegistryObjCmd(ClientData clientData, |
| ︙ | |||
190 191 192 193 194 195 196 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | - - - + + + |
Tcl_Command cmd;
Tcl_Obj *objv[3];
/*
* Unregister the registry package. There is no Tcl_PkgForget()
*/
|
| ︙ | |||
253 254 255 256 257 258 259 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | - + - - + + |
*----------------------------------------------------------------------
*/
static int
RegistryObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
402 403 404 405 406 407 408 | 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 | - + - - + + |
Tcl_Obj *keyNameObj, /* Name of key to delete. */
REGSAM mode) /* Mode flags to pass. */
{
char *tail, *buffer, *hostName, *keyName;
const TCHAR *nativeTail;
HKEY rootKey, subkey;
DWORD result;
|
| ︙ | |||
444 445 446 447 448 449 450 | 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 | - + - + - + |
result = OpenSubKey(hostName, rootKey, keyName, mode, 0, &subkey);
if (result != ERROR_SUCCESS) {
ckfree(buffer);
if (result == ERROR_FILE_NOT_FOUND) {
return TCL_OK;
}
Tcl_SetObjResult(interp,
|
| ︙ | |||
496 497 498 499 500 501 502 | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | - + |
Tcl_Interp *interp, /* Current interpreter. */
Tcl_Obj *keyNameObj, /* Name of key. */
Tcl_Obj *valueNameObj, /* Name of value to delete. */
REGSAM mode) /* Mode flags to pass. */
{
HKEY key;
char *valueName;
|
| ︙ | |||
652 653 654 655 656 657 658 | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | - + |
REGSAM mode) /* Mode flags to pass. */
{
HKEY key;
DWORD result, type;
Tcl_DString ds;
const char *valueName;
const TCHAR *nativeValue;
|
| ︙ | |||
691 692 693 694 695 696 697 | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | - + + |
* Set the type into the result. Watch out for unknown types. If we don't
* know about the type, just use the numeric value.
*/
if (type > lastType) {
Tcl_SetObjResult(interp, Tcl_NewLongObj((int) type));
} else {
|
| ︙ | |||
725 726 727 728 729 730 731 | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | - + |
REGSAM mode) /* Mode flags to pass. */
{
HKEY key;
const char *valueName;
const TCHAR *nativeValue;
DWORD result, length, type;
Tcl_DString data, buf;
|
| ︙ | |||
803 804 805 806 807 808 809 | 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 | - + - + + |
* terminated by two null characters. Also do a bounds check in case
* we get bogus data.
*/
while ((p < end) && *((Tcl_UniChar *) p) != 0) {
Tcl_UniChar *up;
|
| ︙ | |||
941 942 943 944 945 946 947 | 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 | - + - + |
Tcl_Interp *interp, /* Current interpreter. */
Tcl_Obj *keyNameObj, /* Key to open. */
REGSAM mode, /* Access mode. */
int flags, /* 0 or REG_CREATE. */
HKEY *keyPtr) /* Returned HKEY. */
{
char *keyName, *buffer, *hostName;
|
| ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | 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 | - + - + |
Tcl_DString buf;
/*
* Attempt to open the root key on a remote host if necessary.
*/
if (hostName) {
|
| ︙ | |||
1116 1117 1118 1119 1120 1121 1122 | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | - + |
}
}
/*
* Look for a matching root name.
*/
|
| ︙ | |||
1245 1246 1247 1248 1249 1250 1251 | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | - + + |
Tcl_Interp *interp, /* Current interpreter. */
Tcl_Obj *keyNameObj, /* Name of key. */
Tcl_Obj *valueNameObj, /* Name of value to set. */
Tcl_Obj *dataObj, /* Data to be written. */
Tcl_Obj *typeObj, /* Type of data to be written. */
REGSAM mode) /* Mode flags to pass. */
{
|
| ︙ | |||
1282 1283 1284 1285 1286 1287 1288 | 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 | - + |
}
value = ConvertDWORD((DWORD) type, (DWORD) value);
result = RegSetValueEx(key, (TCHAR *) valueName, 0,
(DWORD) type, (BYTE *) &value, sizeof(DWORD));
} else if (type == REG_MULTI_SZ) {
Tcl_DString data, buf;
|
| ︙ | |||
1350 1351 1352 1353 1354 1355 1356 | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 | - + |
}
Tcl_DStringFree(&nameBuf);
RegCloseKey(key);
if (result != ERROR_SUCCESS) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
1377 1378 1379 1380 1381 1382 1383 | 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | - + - + |
*
*----------------------------------------------------------------------
*/
static int
BroadcastValue(
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
1440 1441 1442 1443 1444 1445 1446 | 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 | - + - + |
*/
static void
AppendSystemError(
Tcl_Interp *interp, /* Current interpreter. */
DWORD error) /* Result code from error. */
{
|
| ︙ |
Changes to win/tclWinSerial.c.
| ︙ | |||
107 108 109 110 111 112 113 | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - + - + - + |
DWORD writeError; /* An error caused by the last background
* write. Set to 0 if no error has been
* detected. This word is shared with the
* writer thread so access must be
* synchronized with the evWritable object. */
char *writeBuf; /* Current background output buffer. Access is
* synchronized with the evWritable object. */
|
| ︙ | |||
157 158 159 160 161 162 163 | 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 | - + - - + - - - - + - - - + + - - + - - - - - - - - - - + + + + + + + + + + + + - - |
0, /* WriteTotalTimeoutConstant */
};
/*
* Declarations for functions used only in this file.
*/
|
| ︙ | |||
882 883 884 885 886 887 888 | 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | - + - + | * * Side effects: * Reads input from the actual channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
989 990 991 992 993 994 995 | 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | - + - + | * * Side effects: * Writes output on the actual channel. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1642 1643 1644 1645 1646 1647 1648 | 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 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 | - + - + - - - + |
static int
SerialSetOptionProc(
ClientData instanceData, /* File state. */
Tcl_Interp *interp, /* For error reporting - can be NULL. */
const char *optionName, /* Which option to set? */
const char *value) /* New value for option. */
{
|
| ︙ | |||
1770 1771 1772 1773 1774 1775 1776 | 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 | - + + |
return TCL_ERROR;
}
if (argc != 2) {
badXchar:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -xchar: should be a list of"
|
| ︙ | |||
1843 1844 1845 1846 1847 1848 1849 | 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 | - + - + - + |
break;
}
if (strncasecmp(argv[i], "DTR", strlen(argv[i])) == 0) {
if (!EscapeCommFunction(infoPtr->handle,
(DWORD) (flag ? SETDTR : CLRDTR))) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ |
Changes to win/tclWinSock.c.
| ︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - - - - - + + + + + | * socket messages from the OS. * * - To ensure that message reception is always running this window is * actually owned and handled by an internal thread. This we call the * co-thread of Tcl's thread. * * - The whole structure is set up by InitSockets() which is called for each |
| ︙ | |||
225 226 227 228 229 230 231 232 233 234 235 236 237 238 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | + | static DWORD WINAPI SocketThread(LPVOID arg); static void TcpThreadActionProc(ClientData instanceData, int action); static Tcl_EventCheckProc SocketCheckProc; static Tcl_EventProc SocketEventProc; static Tcl_EventSetupProc SocketSetupProc; static Tcl_DriverBlockModeProc TcpBlockProc; static Tcl_DriverCloseProc TcpCloseProc; static Tcl_DriverClose2Proc TcpClose2Proc; static Tcl_DriverSetOptionProc TcpSetOptionProc; static Tcl_DriverGetOptionProc TcpGetOptionProc; static Tcl_DriverInputProc TcpInputProc; static Tcl_DriverOutputProc TcpOutputProc; |
| ︙ | |||
554 555 556 557 558 559 560 | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | - + |
Tcl_MutexUnlock(&socketMutex);
if (SocketsEnabled()) {
return TCL_OK;
}
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
732 733 734 735 736 737 738 | 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 783 784 785 786 787 788 789 790 791 792 793 794 | + - - - - - - - + + + + + + + - - - + + + + + - - - - - + + + + + + + - - - + + + + | /* * Accept the incoming connection request. */ len = sizeof(address); newSocket = accept(fds->fd, &(addr.sa), &len); /* |
| ︙ | |||
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 | - + + - - + + + + |
break;
case TCL_CLOSE_WRITE:
sd = SD_SEND;
break;
default:
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | - + - |
}
/* Populate new FD */
fds->fd = socket;
fds->infoPtr = infoPtr;
fds->next = NULL;
}
|
| ︙ | |||
1161 1162 1163 1164 1165 1166 1167 | 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 | - |
}
if (!TclCreateSocketAddress(interp, &myaddrlist, myaddr, myport, 1,
&errorMsg)) {
goto error;
}
if (server) {
|
| ︙ | |||
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 | + + |
*/
if (bind(sock, myaddrPtr->ai_addr, myaddrPtr->ai_addrlen)
== SOCKET_ERROR) {
TclWinConvertError((DWORD) WSAGetLastError());
goto looperror;
}
/*
* Set the socket into nonblocking mode if the connect should
* be done in the background.
*/
if (async && ioctlsocket(sock, (long) FIONBIO, &flag)
== SOCKET_ERROR) {
TclWinConvertError((DWORD) WSAGetLastError());
goto looperror;
}
/*
|
| ︙ | |||
1720 1721 1722 1723 1724 1725 1726 | 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 | - + - + - + | * * Side effects: * Consumes input from the socket. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1774 1775 1776 1777 1778 1779 1780 | 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 | + + - + + + + |
* read. We have to simulate blocking behavior here since we are always
* using non-blocking sockets.
*/
while (1) {
SendMessage(tsdPtr->hwnd, SOCKET_SELECT,
(WPARAM) UNSELECT, (LPARAM) infoPtr);
/*
|
| ︙ | |||
1857 1858 1859 1860 1861 1862 1863 | 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 | - + - + - + | * * Side effects: * Produces output on the socket. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1895 1896 1897 1898 1899 1900 1901 | 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 | + - + + + + |
return -1;
}
while (1) {
SendMessage(tsdPtr->hwnd, SOCKET_SELECT,
(WPARAM) UNSELECT, (LPARAM) infoPtr);
/*
|
| ︙ | |||
1986 1987 1988 1989 1990 1991 1992 | 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 | - + |
* system crashes. This can happen at exit time if the exit handler for
* WinSock ran before other exit handlers that want to use sockets.
*/
if (!SocketsEnabled()) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2093 2094 2095 2096 2097 2098 2099 | 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 | - + |
* system crashes. This can happen at exit time if the exit handler for
* WinSock ran before other exit handlers that want to use sockets.
*/
if (!SocketsEnabled()) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2117 2118 2119 2120 2121 2122 2123 | 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 | - + |
ret = TclWinGetSockOpt(sock, SOL_SOCKET, SO_ERROR,
(char *)&err, &optlen);
if (ret == SOCKET_ERROR) {
err = WSAGetLastError();
}
if (err) {
TclWinConvertError(err);
|
| ︙ | |||
2510 2511 2512 2513 2514 2515 2516 | 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 | - - - + + + + - - + + |
for (infoPtr = tsdPtr->socketList; infoPtr != NULL;
infoPtr = infoPtr->nextPtr) {
for (fds = infoPtr->sockets; fds != NULL; fds = fds->next) {
if (fds->fd == socket) {
/*
* Update the socket state.
*
|
| ︙ | |||
2641 2642 2643 2644 2645 2646 2647 | 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 | - + - - - + + |
Tcl_DString ds;
if (GetComputerName(tbuf, &length) != 0) {
/*
* Convert string from native to UTF then change to lowercase.
*/
|
| ︙ |
Changes to win/tclWinThrd.c.
| ︙ | |||
207 208 209 210 211 212 213 | 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 | - + - + |
*/
int
TclpThreadCreate(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread. */
ClientData clientData, /* The one argument to Main(). */
|
| ︙ |