Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch msofer-wcodes-branch Excluding Merge-Ins
This is equivalent to a diff from e7976c13e8 to b0515a16ba
|
2005-10-10
| ||
| 17:59 | * generic/tclExecute.c: fixing an error in INST_LNOT and INST_LYES. Interestingly, the error only... Closed-Leaf check-in: b0515a16ba user: msofer tags: msofer-wcodes-branch | |
|
2005-10-09
| ||
| 13:56 | * generic/tclCmdIL.c: * generic/tclInt.h: modified the TclNSVarHashTable definition to not requi... check-in: 8cc97172d4 user: msofer tags: msofer-wcodes-branch | |
|
2005-03-09
| ||
| 01:19 | msofer-wcodes-branch created to develop a compiler/engine based on wordsized instructions and operan... check-in: bfaf3421a6 user: msofer tags: msofer-wcodes-branch | |
| 01:10 | msofer-wcodes-branch created to develop a compiler/engine based on wordsized instructions and operan... check-in: cdc0f9f850 user: msofer tags: trunk | |
|
2005-03-08
| ||
| 21:52 | * win/makefile.vc: clarify necessary defined vars that can come from MSVC or the Platform SDK. check-in: e7976c13e8 user: hobbs tags: trunk | |
|
2005-03-07
| ||
| 21:38 | Minor typo fix. [Bug 1158247] check-in: 2486712c21 user: dkf tags: trunk | |
Changes to ChangeLog.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 2005-03-08 Jeff Hobbs <jeffh@ActiveState.com> * win/makefile.vc: clarify necessary defined vars that can come from MSVC or the Platform SDK. 2005-03-07 Donal K. Fellows <dkf@users.sf.net> * doc/string.n: Minor typo. [Bug 1158247] 2005-03-07 Miguel Sofer <msofer@users.sf.net> * generic/tclExecute.c: new peephole optimisation for INST_PUSH1; fixed the peephole opt in INST_POP so that it is not used when TCL_COMPILE_DEBUG is defined. 2005-03-01 David N. Welton <davidw@dedasys.com> * doc/CrtSlave.3: Changed to Tcl_Object to Tcl_Obj in the man page. 2005-02-24 Don Porter <dgp@users.sourceforge.net> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 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 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 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 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 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 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 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 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 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 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 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 |
2005-10-10 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: fixing an error in INST_LNOT and
INST_LYES. Interestingly, the error only appeared in debug builds,
but I can't figure out how it matters.
* generic/tclCompile.c (OptReduceCount): improved panic message.
*** NOTE: disabling the optimiser causes a panic in normal builds,
but is ok in debug builds. Something is very fishy.
2005-10-09 Miguel Sofer <msofer@users.sf.net>
* generic/tclCmdIL.c:
* generic/tclInt.h: modified the TclNSVarHashTable definition to
not require coordination between tcl.h and tclInt.h
* generic/tcl.h: Now unnecessary comment removed
2005-10-08 Miguel Sofer <msofer@users.sf.net>
* unix/configure:
* unix/configure.in:
* win/configure.in: reverting last patch: pilot error.
*** NOTE: win/configure.in patched, but autoconf NOT run.
2005-10-08 Miguel Sofer <msofer@users.sf.net>
* unix/configure:
* unix/configure.in:
* win/configure.in: changes that somehow got left out of the
2005-06-12 merge.
2005-06-12 Miguel Sofer <msofer@users.sf.net>
*** MERGE WITH HEAD *** (tag msofer-wcodes-20050611)
[grep for '~~~~~~' to get to HEAD's Changelog]
2005-04-16 Miguel Sofer <msofer@users.sf.net>
*** FROM HEAD ***
* generic/Var.c (Tcl_ArrayObjCmd - ARRAY_NAMES): fix Tcl_Obj leak
[Bug 1084111]
2005-04-14 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: fix for bad stack management
2005-04-14 Miguel Sofer <msofer@users.sf.net>
* generic/tclCmdIL (AppendLocals):
* generic/tclExecute.c:
* generic/tclInt.h:
* generic/tclProc.c:
* generic/tclVar.c: part 5 of variable reform. Compiled local vars
are now (1int+1ptr).
2005-04-13 Miguel Sofer <msofer@users.sf.net>
*** FROM HEAD ***
* generic/tclCompile.c:Commented out the functions
TclPrintInstruction(), TclPrintObject() and TclPrintSource() when
not debugging the compiler, as they are never called in that case.
* generic/tclCompile.c:
* generic/tclExecute.c: Commented out the code to store pointers
to literals in INST_PUSH: it breaks TclPrintInstruction.
RESTORED in a second commit, when !defined(TCL_COMPILE_DEBUG).
2005-04-12 Miguel Sofer <msofer@users.sf.net>
* generic/tclCmdIL (AppendLocals):
* generic/tclCompile.c:
* generic/tclExecute.c:
* generic/tclInt.h:
* generic/tclProc.c:
* generic/tclTrace.c:
* generic/tclVar.c: part 4 of variable reform. Compiled local vars
are half-length with respect to normal vars (missing refCount,
tracePtr and searchPtr). When a trace or search is done for the
first time on a compiled local, a new extension Var structure is
created and the local is linked to it. New flags VAR_SHORT
and VAR_EXTENDED are defined to indicate these special variable
structs.
2005-04-12 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
* generic/tclExecute.c:
* generic/tclProc.c:
* generic/tclVar.c: fixing setting of the new flags
2005-04-11 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c:
* generic/tclInt.h:
* generic/tclTrace.c:
* generic/tclVar.c: part 3 of variable reform. New flags
VAR_DIRECT_READABLE and VAR_DIRECT_WRITABLE for faster checks in
TEBC. Added code to maintain the flags when handling the variable
and its traces.
2005-04-10 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c:
* generic/tclCompile.c:
* generic/tclExecute.c:
* generic/tclInt.h:
* generic/tclProc.c:
* generic/tclVar.c: part 2 of variable reform. Removed the flags
VAR_SCALAR and VAR_UNDEFINED.
* generic/tclExecute.c: missing semicolons under TCL_COMPILE_DEBUG
* generic/tclInt.h: missing macros TclAllocObjsStorage and
TclFreeObjStorage, not needed under MEM_DEBUG for Tcl_Objs but
required for the new Var allocation model.
Thanks dgp!
*** FROM HEAD ***
* generic/tclBasic.c (TclObjInvoke): Plug memory leak. [Bug 1180368]
* generic/tcl.h (comments):
* generic/tclCmdIL.c:
* generic/tclCompile.c:
* generic/tclExecute.c:
* generic/tclInt.h:
* generic/tclNamesp.c:
* generic/tclProc.c:
* generic/tclVar.c: First part of variable reform. Change Var
struct so that sizeof(Var)==sizeof(Tcl_Obj), and use the special
obj allocator for vars. The Var struct has been reduced from
(2ints+6ptrs) to (2ints+4ptrs).
*** COMPAT: breaks both binary and (trivially) source compat for
extensions that access the Var struct - notably itcl and xotcl
* generic/tclCompile.c (optimiser):
* generic/tclExecute.c: storing pointers to literals instead of
offsets into the literal table for INST_PUSH. This is currently
implemented using NASTY CASTS (ptr->TclPSizedInt->ptr) [not used
when VM_USE_PACKED]
*** REQUIRES CLEANING: use a union for opnd, instead of casting.
2005-04-09 Miguel Sofer <msofer@users.sf.net>
* generic/tclInt.h: change of order in macros
*** FROM HEAD ***
* generic/tclListObj.c (Tcl_ListObjIndex): added missing NULL return
when getting index from an empty list.
* generic/tclExecute.c: fix possible leak of expansion Tcl_Objs
2005-04-04 Miguel Sofer <msofer@users.sf.net>
*** FROM HEAD ***
* generic/tclExecute.c: small opts in obj handling
2005-04-02 Miguel Sofer <msofer@users.sf.net>
*** FROM HEAD ***
* generic/tclVar.c: converted a few function calls to macros.
* generic/tclInt.h:
* generic/tclObj.c: Change in TclDecrRefCount and TclFreeObj, to
speed up the freeing of simple Tcl_Obj [Patch 1174551]
* generic/tclCompile.c: uninited var as arg to Tcl_Panic
* generic/tclExecute.c: leak fix in INST_STORE_SCALAR,
*** FROM HEAD ***
* doc/ListObj.3:
* generic/tclBasic.c:
* generic/tclCmdIL.c:
* generic/tclConfig.c:
* generic/tclExecute.c:
* generic/tclInt.decls:
* generic/tclInt.h:
* generic/tclIntDecls.h:
* generic/tclListObj.c:
* generic/tclStubInit.c:
* generic/tclVar.c: Changed the internal representation of lists
to (a) reduce the malloc/free calls at list creation (from 2 to
1), (b) reduce the cost of handling empty lists (we now never
create a list internal rep for them), (c) allow refcounting of the
list internal rep. The latter permits insuring that the pointers
returned by Tcl_ListObjGetElements remain valid even if the object
shimmers away from its original list type. This is [Patch 1158008]
2005-04-01 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c:
* generic/tclInt.h:
* generic/tclObj.c:
* generic/tclStringObj.c: opt in INST_*_SCALAR, sync with HEAD:
*** FROM HEAD ***
- (INST_JUMP_TRUE/FALSE): replaced "test and branch" with "compute
index into table"
*** FROM HEAD ***
- defined new internal macros for creating and setting frequently
used obj types (int,long, wideInt, double, string). Changed TEBC
to use eg 'TclNewIntObj(objPtr, i)' to avoid the function call in
'objPtr = Tcl_NewIntObj(i)'
*** FROM HEAD ***
- ExecEnv now stores two Tcl_Obj* pointing to the constants "0"
and "1", for use by TEBC.
2005-03-31 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
* generic/tclCompile.h: restoring lost line in
TclPrintInstruction, fixing yet another sign-extension
2005-03-31 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c: removing pointer-to-pc instead of jump
offsets (most of yesterday's commit): all pain, no gain.
Fix for a segfault in TclPrintInstruction (reading procPtr's
fields in non-proc bytecodes).
2005-03-30 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c: using pointer-to-pc instead of jump
offsets (not in the packed mode), two new instructions to speed up
load/store of indexed scalars, some engine tuning.
2005-03-28 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c: avoid compiling a PUSH/POP for empty
loops like 'while 1 {}' - as it creates code that the optimiser
cannot yet handle very well.
*** Currently causes test interp-34.3 to fail.***
*** NEEDS REVISITING ***
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c: A (very ugly, naïve and horribly coded)
bytecode optimiser as proof of concept. The code iterates over the
compiled code, simplifying the logic and removing unneeded
instructions. Performs the job of a few of the "runtime peephole
optimisations" in TEBC, which have now been removed. The optimiser
is located in tclCompile.c, at the end of the file.
Runtimes not yet benchmarked. Code reduction example: the body of
heapsortLset (in the heapsort benchmark) is compiled to 153
intructions instead of 184. The reduction should be larger for
code with many branches.
*** NEEDS REDESIGN ***
2005-03-23 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c: porting fix of [Bug 1165671] from HEAD
* generic/tclCompile.c: small fixes, mainly in TclPrintInstruction
2005-03-23 Don Porter <dgp@users.sourceforge.net>
* generic/tclCompile.c (OptCleanupByteCode): Operands are
not ints; they are TclPSizedInts. Storing them in int type
variables loses important bits.
2005-03-22 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.h: fixing bad macro name under VM_USE_PACKED.
2005-03-22 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c:
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c:
First (very timid) post-compile optimisations - testing the basic
infrastructure. The only real optimisation at this time is that
loop exceptions are replaced with jumps were possible, and that
noops (jumps of width 1, inserted arbitrarily for testing
purposes) are effectively removed.
Slight change in the [foreach] compilation.
Fixed the bytecode debugger.
2005-03-21 Don Porter <dgp@users.sourceforge.net>
* generic/tclCompile.h (HP_STASH): Corrections for LP64
systems to avoid errors due to sign-extension of the lower
value being stashed.
* generic/tclCompCmds.c (TclCompileLassignCmd,TclCompileLsetCmd):
Additional sign-extension corrections for LP64 systems.
2005-03-19 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
* generic/tclCompile.h: Trivial instruction numbering change
* generic/tclExecute.c: Code for jump-if-true at comparisons,
removed corresponding runtime peephole opts - as they will be
performed at compile time by the optimiser.
2005-03-19 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.h: (VM_USE_PACKED) added a check that jump
distances do not exceed the packing capability; if they do,
panic. Should not happen very often, jumps of up to 32k 32b words
are still possible. Should be replaced with a mechanism to
TCL_OUT_LINE_COMPILE instead (not trivial, as typically code will
already be emitted and ExceptionRanges created).
2005-03-19 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c:
Instruction set cleanup: one instruction INST_YES (not-not) added,
removal of unused instructions (66 are left), renumbering to ease
the code of the optimiser. Instructions that are logical negation
of each other (eg INST_LE and INST_GT) are numbered in pairs
(2n)(2n+1) to permit negation by bit-flipping (^1).
2005-03-19 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c:
* generic/tclCompExpr.c:
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c:
Massive reduction of variable-related instructions: INST_LOAD,
INST_STORE and INST_INCR perform the work of the 20 previous
INST_LOAD_*, INST_STORE_*, INST_APPEND_*, INST_LAPPEND_* and
INST_INCR_*. Variants, indices and immediate values are packed in
the operand (note that performance considerations may later cause
some changes here). This is an intermediate commit: the INST
numbering is still unchanged, with gaping holes for the removed
instructions.
Improved stack depth estimates in tclCompCmds.c.
2005-03-16 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.h:
Fixing some stupidities in the bitwise ops and limits for the
packed version - it was all wrong, but only managed to show itself
in a failure of clock-2.1464 (thanks dgp).
2005-03-16 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.h:
Enabled new packed mode: (inst+opnd) are packed in 32 bits. To
enable, set the env var
CFLAGS_DEBUG="-DVM_USE_PACKED" (resp "-g -DVM_USE_PACKED")
for the call to 'make'. If the flag is not set uses the wordcodes,
where (inst+opnd) take the size of 2 pointers.
2005-03-15 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c:
Macro reorganisation, preparing to enable the 8+24 version.
2005-03-15 Don Porter <dgp@users.sourceforge.net>
* generic/tclCompile.h: Corrected mistaken casts to (int) of
TclPSizedInt values into TclPSizedInt variables within the
TclEmitInst1 macro. Casting through the (int) type loses bits on
LP64 systems, where sizeof(int) < sizeof(void *).
2005-03-15 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c:
Attempt at fixing 64b issues; as a result, now getting plenty of
warnings for formatting issues - will fix later
2005-03-15 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c:
* generic/tclCompile.h:
* generic/tclExecute.c:
(1) new opt for the [return] compiler, can now emit INST_BREAK or
INST_CONTINUE
(2) changed logic of the [foreach] instructions, including loop
rotation optimisation
(3) newjump target in TEBC to restart without changing pc
2005-03-15 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c:
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c: rewrite of exception return handling.
[catch] does not use the ExceptionArray anymore, there are only
loop exception ranges. Compiler simplification through two new
functions TclBeginExceptRange and TclEndExceptRange. The proper
ranges for INST_BREAK and INST_CONTINUE are detected at
compile time; this info is used to *rewrite* them to INST_JUMP
when first encountered (this will disappear once we have the
optimiser).
2005-03-14 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:
- fixed INST_RETURN's stack effect (-1 instead of -2).
- insured that the bytecodes are aligned
* generic/tclCompCmds.c:
* generic/tclCompile.h:
* generic/tclExecute.c: New [catch] logic - completely
incompatible with the old one, big hurdle for older compiled
scripts. [catch] now compiles just two instructions, the catch
range is everything in between INST_BEGIN_CATCH and
INST_END_CATCH. Preparation for exception range reform (next
commit).
2005-03-13 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c:
* generic/tclCompExpr.c:
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c:
* generic/tclProc.c:
Each (instruction+operands) takes two words; instructions that
take two operands pack them into a single pointer-sized int.
Unused instructions removed from tclInstructionTable.
2005-03-11 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c:
* generic/tclCompExpr.c:
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c: First wordcode machine, instructions and
operands are pointer-sized (no other changes or optimisations).
Should run on all platforms. Seems slightly faster than the
original on my platform.
2005-03-10 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.h: storing integers in native format; for the
time being, only works in 32b platforms.
2005-03-10 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c:
* generic/tclCompExpr.c:
* generic/tclCompile.c:
* generic/tclCompile.h:
* generic/tclExecute.c: First steps, all operands are now 4 bytes
wide. Removed unnecessary instructions from TEBC,but they are
still in the table. Simplified the compiler, especially in respect
to forward jumps.
*** Compat: scripts precompiled with other tcl versions WILL bomb!
***
========
2005-03-08 Miguel Sofer <msofer@users.sf.net>
*** Branching off the HEAD ***
msofer-wcodes-branch created to develop a compiler/engine based on
wordsized instructions and operands.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2005-06-10 Donal K. Fellows <dkf@users.sf.net>
* doc/chan.n: Fold in the descriptive parts of the documentation
for all the commands that [chan] builds on top of.
2005-06-09 Vince Darley <vincentdarley@users.sourceforge.net>
* generic/tclFCmd.c: fix to race condition in file mkdir [Bug 1217375]
* doc/glob.n: improve glob documentation [Bug 1190891]
2005-06-09 Donal K. Fellows <dkf@users.sf.net>
* doc/expr.n, doc/mathfunc.n: Fix minor typos [Bug 1211078] and
add mention of distinctly-relevant [namespace path] subcommand.
2005-06-07 Don Porter <dgp@users.sourceforge.net>
* generic/tclInt.h: Reduced the Tcl_ObjTypes "index",
* generic/tclIndexObj.c: "ensembleCmd", "localVarName", and
* generic/tclNamesp.c: "levelReference" to file static scope.
* generic/tclProc.c:
* generic/tclVar.c:
* generic/tclObj.c: Restored registration of the "procbody"
Tcl_ObjType, as required by the tclcompiler application.
* generic/tclDecls.h: make genstubs
* generic/tclStubInit.c:
2005-06-07 Donal K. Fellows <dkf@users.sf.net>
* generic/tclIO.c (Tcl_ChannelTruncateProc): Stop proliferation of
* generic/tcl.h: channel type versions
* doc/CrtChannel.3: following advice from AKu
Bump patchlevel to a4 to distinguish from a3 release.
* generic/tclInt.h (INTERP_TRACE_IN_PROGRESS): Add flag so the error
* generic/tclIndexObj.c (Tcl_WrongNumArgs): messages from ensembles
* generic/tclIOCmd.c (Tcl_ReadObjCmd): can be correct.
TIP#208 IMPLEMENTATION
* library/init.tcl: Create the chan ensemble.
* tests/chan.test: Rudimentary test suite.
* doc/chan.n: General documentation.
TRUNCATION API (part of TIP#208)
* generic/tcl.h, generic/tcl.decls: Declaration of the API.
* doc/CrtChannel.3, doc/OpenFileChnl.3: Documentation of the API.
* generic/tclBasic.c (Tcl_CreateInterp): Create the mapping into Tcl.
* generic/tclIOCmd.c (TclChanTruncateObjCmd): Implementation of
Tcl-level truncation API.
* generic/tclIO.c (Tcl_TruncateChannel): Generic C-level
truncation API implementation.
* unix/tclUnixChan.c (FileTruncateProc): Basic implementation of
truncating driver.
* win/tclWinChan.c (FileTruncateProc): Added implementation of
file truncation for Windows.
* tests/chan.test (chan-15.2): Added real test of truncation.
2005-06-06 Kevin B. Kenny <kennykb@acm.org>
* win/tclWin32Dll.c: Corrected another buglet in the assembly
code for stack probing on Win32/gcc. [Bug #1213678]
* generic/tclObj,c: Added missing 'static' on definition of
UpdateStringOfBignum, and removed a 'switch' on a 'long long'
operand (which HP-UX native 'cc' seems unable to handle).
[Bug #1215775]
2005-06-04 Jeff Hobbs <jeffh@ActiveState.com>
*** 8.5a3 TAGGED FOR RELEASE ***
* unix/Makefile.in (dist): add libtommath
2005-06-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
* library/parray.tcl (parray): Only generate the sorted list of
element names once. Thanks to Andreas Leitgeb for spotting this.
2005-06-03 Daniel Steffen <das@users.sourceforge.net>
* macosx/Makefile: fixed 'embedded' target.
2005-06-02 Jeff Hobbs <jeffh@ActiveState.com>
* unix/Makefile.in (html): add BUILD_HTML_FLAGS optional var
* tools/tcltk-man2html.tcl: add a --useversion to prevent
confusion when multiple Tcl source dirs exist.
2005-06-01 Don Porter <dgp@users.sourceforge.net>
* generic/tclBasic.c: For compatibility with earlier Tcl releases,
* generic/tclResult.c: when a command procedure simply does a
* generic/tclTest.c: "return TCL_RETURN;" we must interpret that
* tests/result.test: the same as
"return Tcl_SetReturnOptions(interp, Tcl_NewObj());" [Bug 1209759].
2005-06-01 Donal K. Fellows <donal.k.fellows@man.ac.uk>
* generic/tclCompCmds.c (TclCompileSwitchCmd): Allow compilation
of -nocase -glob [switch]es (only one we know how to compile).
TIP#241 IMPLEMENTATION from Joe Mistachkin
* generic/tclCmdIL.c (Tcl_LsearchObjCmd, Tcl_LsortObjCmd):
* generic/tclCmdMZ.c (Tcl_SwitchObjCmd): Implementation of -nocase
option for [lsearch], [lsort] and [switch] commands.
* win/tclWinPort.h: Win uses nonstandard function names...
* tests/cmdIL.test, tests/lsearch.test, tests/switch.test: Tests
* doc/lsearch.n, doc/lsort.n, doc/switch.n: Docs
* generic/tclCompCmds.c (TclCompileLindexCmd): Compile the most
common case of [lindex] more efficiently.
* unix/tclUnixNotfy.c (Tcl_FinalizeNotifier): Pass the correct
number of arguments to Tcl_JoinThread.
2005-05-31 Donal K. Fellows <donal.k.fellows@man.ac.uk>
* unix/configure.in, unix/tcl.m4: Standardize generation of help
messages to always use AC_HELP_STRING and always (except for
--with-tcl and --with-tk, where the default is complex) say what
the default is.
2005-05-31 Zoran Vasiljevic <vasiljevic@users.sourceforge.net>
* unix/tclUnixNotfy.c: the notifier thread is now created as
joinable thread and it is properly joined in Tcl_FinalizeNotifier.
This is an attempt to fix the Tcl Bug #1082283.
2005-05-30 Zoran Vasiljevic <vasiljevic@users.sf.net>
* win/tclWinThrd.c: Fixed Tcl Bug #1204064.
2005-05-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
TIP #229 IMPLEMENTATION
* generic/tclNamesp.c (Tcl_FindCommand, TclResetShadowedCmdRefs)
(NamespacePathCmd, SetNsPath, UnlinkNsPath, TclInvalidateNsPath):
Implementation of the [namespace path] command and the command
name resolution engine.
* doc/info.n, doc/namespace.n: Doc updates.
* tests/namespace.test (namespace-51.*): Test updates.
* generic/tclResolve.c (BumpCmdRefEpochs, Tcl_SetNamespaceResolvers):
* generic/tclBasic.c (Tcl_CreateCommand, Tcl_CreateObjCommand):
Ensure that people don't see stale paths.
* generic/tclInt.h (Namespace, NamespacePathEntry): Structure defs.
* generic/tclCmdIL.c (InfoCommandsCmd): Updates to [info commands].
2005-05-26 Daniel Steffen <das@users.sourceforge.net>
* macosx/Makefile: moved & corrected EMBEDDED_BUILD check.
* unix/configure.in: corrected framework finalization to softlink
stub library to Versions/8.x subdir instead of Versions/Current.
* unix/configure: autoconf-2.59
2005-05-25 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tclCmdMZ.c (Tcl_TimeObjCmd): add necessary cast
2005-05-25 Don Porter <dgp@users.sourceforge.net>
TIP#182 IMPLEMENTATION [Patch 1165062]
* doc/mathfunc.n: New built-in math function bool().
* generic/tclBasic.c:
* tests/expr.test:
* tests/info.test:
2005-05-24 Don Porter <dgp@users.sourceforge.net>
* library/init.tcl: Updated [unknown] to be sure the [return]
* tests/init.test: options from an auto-loaded command are
seen correctly by the caller.
2005-05-24 Daniel Steffen <das@users.sourceforge.net>
* tests/env.test: added DYLD_FRAMEWORK_PATH to the list of env vars
that need to be handled specially.
* macosx/Makefile:
* macosx/README:
* macosx/Tcl-Info.plist.in (new file):
* unix/Makefile.in:
* unix/configure.in:
* unix/tcl.m4:
* unix/tclUnixInit.c: moved all Darwin framework build support from
macosx/Makefile into the standard unix configure/make buildsystem, the
macosx/Makefile is no longer required to build Tcl.framework (but its
functionality is still available for backwards compatibility).
* unix/configure: autoconf-2.59
* generic/tclIOUtil.c (TclLoadFile):
* generic/tclInt.h:
* unix/tcl.m4:
* unix/tclLoadDyld.c: added support for [load]ing .bundle binaries in
addition to .dylib's: .bundle's can be [unload]ed (unlike .dylib's),
and can be [load]ed from memory, e.g. directly from VFS without
needing to be written out to a temporary location first. [Bug 1202209]
* unix/configure: autoconf-2.59
* unix/tclConfig.h.in: autoheader-2.59
* generic/tclCmdMZ.c (Tcl_TimeObjCmd): change [time] called with a
count > 1 to return a string with a float value instead of a rounded
off integer. [Bug 1202178]
* doc/expr.n:
* doc/string.n: fixed roff syntax complaints from 'make html'.
2005-05-20 Don Porter <dgp@users.sourceforge.net>
* generic/tclParseExpr.c: Corrected parser to recognize all
boolean literals accepted by Tcl_GetBoolean, including prefixes
like "y" and "f", and to allow "eq" and "ne" as function names
in the proper context. [Bug 1201589].
2005-05-19 Donal K. Fellows <dkf@users.sf.net>
* generic/tclBasic.c (TclEvalObjvInternal): Rewrite for greater
clarity; although 'goto' is Bad, the contortions you have to go
through to avoid it can be worse...
2005-05-19 Daniel Steffen <das@users.sourceforge.net>
* macosx/tclMacOSXNotify.c (Tcl_InitNotifier): fixed crashing
CFRelease of runLoopSource in Tcl_InitNotifier (reported by Zoran):
CFRunLoopAddSource doesn't CFRetain, so can only CFRelease the
runLoopSource in Tcl_FinalizeNotifier.
2005-05-18 Don Porter <dgp@users.sourceforge.net>
* generic/tclBasic.c (Tcl_ExprBoolean): Rewrite as wrapper around
Tcl_ExprBooleanObj.
* generic/tclCmdMZ.c ([string is boolean/true/false]): Rewrite
dropping string-based Tcl_GetBoolean call, so that internal reps
are kept for subsequent quick boolean operations.
* generic/tclExecute.c: Dropped most special handling of the
"boolean" Tcl_ObjType, since that type should now be rarely
encountered.
* doc/BoolObj.3: Rewrite of documentation dropping many details
about the internals of Tcl_Objs. Shorter documentation focuses on
the function and use of the routines.
* generic/tclInt.h: Revision to the "boolean" Tcl_ObjType, so
* generic/tclObj.c: that only string values like "yes" and "false"
* tests/obj.test: are kept as the "boolean" Tcl_ObjType. The
string values "0" and "1" are kept as "int" Tcl_ObjType, which also
produce quick calls to Tcl_GetBooleanFromObj(). Since this internal
change means a Tcl_ConvertToType to a "boolean" Tcl_ObjType might
not produce a Tcl_Obj of type "boolean", the registration of the
"boolean" type is also removed.
***POTENTIAL INCOMPATIBILITY***
For callers of Tcl_GetObjType on the type name "boolean".
2005-05-17 Don Porter <dgp@users.sourceforge.net>
* generic/tclObj.c (TclInitObjSubsystem): Removed the
* tests/listObj.test: registration of the Tcl_ObjType's "list",
* tests/obj.test: "procbody", "index", "ensembleCommand",
"localVarName", and "levelReference". The only reason to register
a Tcl_ObjType is to have it returned by Tcl_GetObjType, and the
only reason for that is to retrieve a (Tcl_ObjType *) to pass to
Tcl_ConvertToType(). None of the types above can support a
Tcl_ConvertToType() call; they panic. Better not to offer something
than to lead users into a panic.
***POTENTIAL INCOMPATIBILITY***
For callers of Tcl_GetObjType on the type names listed above.
2005-05-15 Kevin Kenny <kennykb@users.sourceforge.net>
* win/tclWin32Dll.c: conditioned definition of
EXCEPTION_REGISTRATION structures on HAVE_NO_SEH, to fix a bug in
buildability on MSVC.
2005-05-14 Daniel Steffen <das@users.sourceforge.net>
* generic/tclInt.decls:
* generic/tclTest.c:
* generic/tclUtil.c:
* win/tclWin32Dll.c: fixed link error due to direct access by
tclTest.c to the MODULE_SCOPE tclPlatform global: renamed existing
TclWinGetPlatform() accessor to TclGetPlatform() and moved it to
generic code so that it can be used by on all platforms where
MODULE_SCOPE is enforced.
* macosx/tclMacOSXBundle.c:
* unix/tclUnixInit.c:
* unix/tcl.m4 (Darwin): made use of CoreFoundation API configurable
and added test of CoreFoundation availablility to allow building on
ppc64, replaced HAVE_CFBUNDLE by HAVE_COREFOUNDATION; test for
availability of Tiger or later OSSpinLockLock API.
* unix/tclUnixNotfy.c:
* unix/Makefile.in:
* macosx/tclMacOSXNotify.c (new file): when CoreFoundation is
available, use new CFRunLoop based notifier: allows easy integration
with other event loops on Mac OS X, in particular the TkAqua Carbon
event loop is now integrated via a standard tcl event source (instead
of TkAqua upon loading having to finalize the exsting notifier and
replace it with its custom version). [Patch 1202052]
* tests/unixNotfy.test: don't run unthreaded tests on Darwin
since notifier may be using threads even in unthreaded core.
* unix/tclUnixPort.h:
* unix/tcl.m4 (Darwin): test for thread-unsafe realpath durning
configure, as Darwin 7 and later realpath is threadsafe.
* macosx/Makefile: enable configure caching.
* unix/configure.in: wrap tclConfig.h header in #ifndef _TCLCONFIG so
that it can be included more than once without warnings from gcc4.0
(as happens e.g. when including both tclInt.h and tclPort.h)
* macosx/tclMacOSXBundle.c:
* unix/tclUnixChan.c:
* unix/tclLoadDyld.c:
* unix/tclUnixInit.c: fixed gcc 4.0 warnings.
* unix/configure: autoconf-2.59
* unix/tclConfig.h.in: autoheader-2.59
* generic/tclIntDecls.h:
* generic/tclIntPlatDecls.h:
* generic/tclStubInit.c: make genstubs
2005-05-13 Kevin Kenny <kennykb@acm.org>
* win/tclWin32Dll.c: Further rework of the SEH logic. All
EXCEPTION_REGISTRATION records are now
in the activation record rather than pushed
on the stack.
2005-05-13 Don Porter <dgp@users.sourceforge.net>
* generic/tclBasic.c: Dropped the TCL_NO_MATH configuration.
* generic/tclBinary.c: It's believed this has not been working
* generic/tclExecute.c: in a long time. Tcl needs math.h.
* unix/Makefile.in: [RFE 1200680].
2005-05-12 Kevin Kenny <kennykb@acm.org>
* doc/mathfunc.n: Changed NAME line to match the name of the page.
2005-05-11 Kevin Kenny <kennykb@acm.org>
* generic/tclStrToD.c (TclStrToD, RefineResult, ParseNaN):
Changed the code to cast 'char' to UCHAR explicitly when
using ctype macros, to silence complaints from the Solaris
compiler.
2005-05-10 Jeff Hobbs <jeffh@ActiveState.com>
* unix/tclUnixFCmd.c: add lint attr to enum to satisfy strictly
compliant compilers that don't like trailing ,s.
* tests/string.test: string-10.[21-30]
* generic/tclCmdMZ.c (Tcl_StringObjCmd): add extra checks to
prevent possible UMR in unichar cmp function for string map.
2005-05-10 Kevin Kenny <kennykb@acm.org>
* generic/tclBinary.c (FormatNumber): Fixed a bug where NaN's
resulted in reads of uninitialized memory when using 'd',
'q', or 'Q' format.
* generic/tclStrToD.c (ParseNaN, TclFormatNaN): Added code to
handle the peculiarities of HP's PA_RISC, which uses a different
'quiet' bit in NaN from everyone else.
* libtommath/tommath_superclass.h: Corrected C++-style comment.
2005-05-10 Kevin Kenny <kennykb@acm.org>
Merged all changes on kennykb-numerics-branch back into the
HEAD. TIP's 132 and 232 are now Final.
2005-05-10 Kevin Kenny <kennykb@acm.org>
[kennykb-numerics-branch] Merged changes from HEAD.
2005-05-10 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c (ExponLong, ExponWide):
* tests/expr.test (expr-23.34/35): fixed special case 'i**0' for
i>0 [Bug 1198892]
2005-05-09 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch]
* win/tclWin32Dll.c (TclpCheckStackSpace, TclWinCPUID):
Reworked structured event handling to function even
with -fomit-frame-pointers.
2005-05-08 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch]
* generic/tclStrToD.c: Made code more portable by finding a
workaround for MSVC's 'volatile' issue that
does not require conditional compilation.
* win/tclWin32Dll.c (TclWinCPUID): Removed structured event
handling from the GCC code
since (a) bad code is generated
by the instruction scheduling
with -O2, and (b) it's not
needed on any reasonably modern
CPU.
2005-05-07 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch]
* generic/tclEvent.c: Moved initialization of tclStrToD.c's
* generic/tclInt.h: static constants into a procedure called
* generic/tclStrToD.c: from TclInitSubsystems to avoid double
checked locking protocol. Cleaned up
an issue where MSVC ignored the 'volatile'
specifier, causing incorrect comparison
of an underflowed number against zero.
2005-05-06 Jeff Hobbs <jeffh@ActiveState.com>
* unix/tcl.m4, unix/configure: correct Solaris 10 (5.10) check and
add support for x86_64 Solaris cc builds.
2005-05-05 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch] Merged with HEAD.
2005-05-05 Kevin B. Kenny <kennykb@acm.org>
* win/tclWinThrd.c: Corrected a compilation error on the
--enable-threads configuration.
2005-05-05 Don Porter <dgp@users.sourceforge.net>
* generic/tclInt.decls: Converted TclMatchIsTrivial to a macro.
* generic/tclInt.h:
* generic/tclUtil.c:
* generic/tclIntDecls.h: `make genstubs`
* generic/tclStubInit.c:
* generic/tclBasic.c: Added callers of TclMatchIsTrivial where
* generic/tclCmdIL.c: a search can be done more efficiently
* generic/tclCompCmds.c:when it is recognized that a pattern match
* generic/tclDictObj.c: is really an exact match. [Patch 1076088]
* generic/tclIO.c:
* generic/tclNamesp.c:
* generic/tclVar.c:
* generic/tclCompCmds.c: Factored common efficiency trick into
a macro named CompileWord.
* generic/tclCompCmds.c: Replaced all instance of
* generic/tclCompile.c: TCL_OUT_LINE_COMPILE with TCL_ERROR.
* generic/tclInt.h: Now that we've eradicated the mistaken
* tests/appendComp.test: notion of a "compile-time error", we
can use the TCL_ERROR return code to signal any failure to produce
bytecode.
2005-05-03 Don Porter <dgp@users.sourceforge.net>
* doc/DString.3: Eliminated use of identifier "string" in Tcl's
* doc/Environment.3: public C API to avoid conflict/confusion with
* doc/Eval.3: the std::string of C++.
* doc/ExprLong.3, doc/ExprLongObj.3, doc/GetInt.3, doc/GetOpnFl.3:
* doc/ParseCmd.3, doc/RegExp.3, doc/SetResult.3, doc/StrMatch.3:
* doc/Utf.3, generic/tcl.decls, generic/tclBasic.c, generic/tclEnv.c:
* generic/tclGet.c, generic/tclParse.c, generic/tclParseExpr.c:
* generic/tclRegexp.c, generic/tclResult.c, generic/tclUtf.c:
* generic/tclUtil.c, unix/tclUnixChan.c:
* generic/tclDecls.h: `make genstubs`
2005-05-02 Don Porter <dgp@users.sourceforge.net>
* generic/tcl.decls:
* generic/tclBasic.c: Simplified implementation of Tcl_ExprString.
* tests/expr-old.test:
* generic/tclDecls.h: `make genstubs`
2005-04-30 Daniel Steffen <das@users.sourceforge.net>
* unix/tclUnixNotfy.c: applied dkf's tkMacOSXNotify.c cleanup changes.
2005-04-29 Don Porter <dgp@users.sourceforge.net>
TIP#176 IMPLEMENTATION [Patch 1165695]
* generic/tclUtil.c: Extended TclGetIntForIndex to recognize
index formats including end+integer and integer+/-integer.
* generic/tclCmdMZ.c: Extended the -start switch of [regexp]
and [regsub] to accept all index formats known by TclGetIntForIndex.
* doc/lindex.n: Updated docs to note new index formats.
* doc/linsert.n, doc/lrange.n, doc/lreplace.n, doc/lsearch.n:
* doc/lset.n, doc/lsort.n, doc/regexp.n, doc/regsub.n, doc/string.n:
* tests/cmdIL.test: Updated tests.
* tests/compile.test, tests/lindex.test, tests/linsert.test:
* tests/lrange.test, tests/lreplace.test, tests/lsearch.test:
* tests/lset.test, tests/regexp.test, tests/regexpComp.test:
* tests/string.test, tests/stringComp.test, tests/util.test:
2005-04-28 Don Porter <dgp@users.sourceforge.net>
* tests/unixInit.test (7.1): Alternative fix for the 2004-11-11 commit.
2005-04-27 Don Porter <dgp@users.sourceforge.net>
* library/init.tcl: Corrected flaw in interactive command
* tests/main.test: auto-completion. [Bug 1191409].
TIP#183 IMPLEMENTATION [Patch 577093]
* generic/tclIOUtil.c (TclGetOpenModeEx): New routine.
* generic/tclInt.h:
* generic/tclIO.c (Tcl_OpenObjCmd): Support for "b" and
* doc/open.n: "BINARY" in "access" argument to [open].
* tests/ioCmd.test:
2005-04-26 Kevin B. Kenny <kennykb@users.sourceforge.net>
* generic/tclBinary.c (FormatNumber):
Dredge the NaN out of the internal representation if
Tcl_GetDoubleFromObj returns TCL_ERROR on a NaN.
* generic/tclObj.c (Tcl_GetDoubleFromObj):
Restored silent overflow/underflow behaviour that the merge
of 2004-04-25 messed up. Thanks to Don Porter for calling
attention to this bug. Also removed an uninitialised memory
reference in this function that valgrind caught. Also changed
to return TCL_ERROR on a pure NaN.
* generic/tclStrToD.c (RefineResult):
Added a test for the initial approximation being HUGE_VAL;
this test avoids EDOM being returned from ldexp on some platforms
on input values exceeding the floating point range.
* tests/expr.test (expr-29.*, expr-30.*):
Added further tests of overflow/underflow on input conversions.
2005-04-25 Kevin B. Kenny <kennykb@users.sourceforge.net>
[kennykb-numerics-branch] Merged with HEAD.
* doc/CrtMathFunc.n: Revised documentation for TIP 232
2005-04-25 Daniel Steffen <das@users.sourceforge.net>
* compat/string.h: fixed memchr() protoype for __APPLE__ so that we
build on Mac OS X 10.1 again.
* generic/tclNotify.c (TclFinalizeNotifier): fixed notifier not being
finalized in unthreaded core (was testing for notifier initialization in
current thread by checking thread id != 0 but thread id is always 0 in
untreaded core).
* win/tclWinNotify.c (Tcl_WaitForEvent):
* unix/tclUnixNotfy.c (Tcl_WaitForEvent): don't call ScaleTimeProc for
zero wait times (as specified in TIP 233).
* unix/Makefile.in: added @PLAT_SRCS@ to SRCS and split out NOTIFY_SRCS
from UNIX_SRCS for parity with UNIX_OBJS & NOTIFY_OBJS.
* unix/tcl.m4 (Darwin): added configure checks for recently added linker
flags -single_module and -search_paths_first to allow building with
older tools (and on Mac OS X 10.1), use -single_module in SHLIB_LD and
not just T{CL,K}_SHLIB_LD_EXTRAS, added unexporting from Tk of symbols
from libtclstub to avoid duplicate symbol warnings, added PLAT_SRCS
definition for Mac OS X, defined MODULE_SCOPE to __private_extern__.
(SC_MISSING_POSIX_HEADERS): added caching of dirent.h check.
* unix/configure: autoconf-2.59
2005-04-25 Kevin B. Kenny <kennykb@users.sourceforge.net>
* library/tzdata/America/Boise:
* library/tzdata/America/Chicago:
* library/tzdata/America/Denver
* library/tzdata/America/Indianapolis:
* library/tzdata/America/Los_Angeles:
* library/tzdata/America/Louisville:
* library/tzdata/America/Managua:
* library/tzdata/America/New_York:
* library/tzdata/America/Phoenix:
* library/tzdata/America/Port-au-Prince:
* library/tzdata/America/Indiana/Knox:
* library/tzdata/America/Indiana/Marengo:
* library/tzdata/America/Indiana/Vevay:
* library/tzdata/America/Kentucky/Monticello:
* library/tzdata/America/North_Dakota/Center:
* library/tzdata/Asia/Tehran:
Olson's tzdata2005i. Corrects exact time at which Standard Time
was adopted in the US (generally, noon, Standard Time, rather than
noon, Local Mean Time). Adopts new civil rules for Nicaragua
and Iran.
2005-04-25 Don Porter <dgp@users.sourceforge.net>
* library/init.tcl: Use "ni" and "in" operators.
2005-04-25 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: fix for [Bug 1189274].
2005-04-24 Don Porter <dgp@users.sourceforge.net>
* generic/tclLiteral.c: Silence compiler warnings.
* generic/tclObj.c: [Bug 1188863].
2005-04-22 Don Porter <dgp@users.sourceforge.net>
The 2005-04-21 changes to Tcl_GetBooleanFromObj were done to bring
it into agreement with its docs. Further investigation reveals it
was the docs that were incorrect.
* doc/BoolObj.3: Corrections to the documentation of
Tcl_GetBooleanFromObj to bring it into agreement with what this
public interface has always done, including noting the difference
in function between Tcl_GetBooleanFromObj and Tcl_GetBoolean.
* generic/tclGet.c: Revised Tcl_GetBoolean to no longer be a
wrapper around Tcl_GetBooleanFromObj (different function!).
* generic/tclObj.c: Removed TclGetTruthValueFromObj routine
that was added yesterday. Revisions so that only
Tcl_GetBoolean-approved values get the "boolean" Tcl_ObjType.
This retains the fix for [Bug 1187123].
* tests/string.test: Test string-23.0 for Bug 1187123.
* generic/tclInt.h: Revert most recent change.
* generic/tclBasic.c:
* generic/tclCompCmds.c:
* generic/tclDictObj.c:
* generic/tclExecute.c:
* tests/obj.test:
2005-04-21 Don Porter <dgp@users.sourceforge.net>
* doc/GetInt.3: Convert argument "string" to "str" to agree with code.
Also clarified a few details on int and double formats.
* generic/tclGet.c: Radical code simplification. Converted
Tcl_GetFoo() routines into wrappers around Tcl_GetFooFromObj().
Reduces code duplication, and the resulting potential for inconsistency.
* generic/tclObj.c: Several changes:
- Re-ordered error detection code so all values with trailing
garbage receive a "not an integer" message instead of an
"integer too large" message.
- Removed inactive code meant to deal with strtoul* routines that
fail to parse leading signs. All of them do, and if any are
detected that do not, the correct fix is replacement with
compat/strtoul*.c, not a lot of special care by the callers.
- Tcl_GetDoubleFromObj now avoids shimmering away a "wideInt" intrep.
- Fixed Tcl_GetBooleanFromObj to agree with its documentation and
with Tcl_GetBoolean, accepting only "0" and "1" and not other
numeric strings. [Bug 1187123]
- Added new private routine TclGetTruthValueFromObj to perform
the more permissive conversion of numeric values to boolean
that is needed by the [expr] machinery.
* generic/tclInt.h (TclGetTruthValueFromObj): New routine.
* generic/tclExecute.c: Updated callers to call new routine.
* generic/tclBasic.c: Updated callers to call new routine.
* generic/tclCompCmds.c: Updated callers to call new routine.
* generic/tclDictObj.c: Updated callers to call new routine.
* tests/obj.test: Corrected bad tests that actually expected
values like "47" and "0xac" to be accepted as booleans.
* generic/tclLiteral.c: Disabled the code that forces some literals
into the "int" Tcl_ObjType during registration. We can re-enable it
if this change causes trouble, but it seems more sensible to let
Tcl's "on-demand" shimmering rule, and not try to pre-guess things.
2005-04-20 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch]
* doc/expr.n:
* doc/mathfunc.n (new file): Revised documentation for TIP 232
2005-04-20 Don Porter <dgp@users.sourceforge.net>
* generic/tclGet.c (Tcl_GetInt): Corrected error that did not
* generic/tclObj.c (Tcl_GetIntFromObj): permit 0x80000000 to be
recognized as an integer on TCL_WIDE_INT_IS_LONG systems [Bug 1090869].
2005-04-20 Kevin B. Kenny <kennykb@acm.org>
* generic/tclFileName.c: Silenced a compiler warning about
'/*' within a comment.
2005-04-19 Don Porter <dgp@users.sourceforge.net>
* generic/tclBasic.c: Added unsupported command
* generic/tclCmdAH.c: [::tcl::unsupported::EncodingDirs] to permit
* generic/tclInt.h: query/set of the encoding search path at
* generic/tclInterp.c: the script level. Updated init.tcl to make
* library/init.tcl: use of the new command. Also updated several
coding practices in init.tcl ("eq" for [string equal], etc.)
2005-04-19 Kevin B. Kenny <kennykb@acm.org>
* library/clock.tcl (Initialize): Put initialization code into a
proc to avoid inadvertently clobbering global variables.
[Bug 1185933]
* tests/clock.test (clock-48.1): Added regression test for the
above bug.
Thanks to Ulrich Ring for reporting this bug.
2005-04-16 Miguel Sofer <msofer@users.sf.net>
* generic/Var.c (Tcl_ArrayObjCmd - ARRAY_NAMES): fix Tcl_Obj leak
[Bug 1084111]
2005-04-16 Zoran Vasiljevic <vasiljevic@users.sf.net>
* generic/tclIOUtil.c: force clenaup of the interp result
in TclLoadFile(). Some implementations of TclpFindSymbol()
will seed the interp result with error message when unable
to find the requested symbol (this is not considered to
be an error).
Set of changes correcting huge memory waste (not a leak)
when a thread exits. This has been introduced in 8.4.7
within an attempt to correctly cleanup after ourselves when
Tcl library is being unloaded with the Tcl_Finalize() call.
This fixes the Tcl Bug #1178445.
* generic/tclInt.h: added prototypes for TclpFreeAllocCache()
and TclFreeAllocCache()
* generic/tclThreadAlloc.c: modified TclFinalizeThreadAlloc()
to explicitly call TclpFreeAllocCache with the NULL-ptr as
argument signalling cleanup of private tsd key used only by
the threading allocator.
* unix/tclUnixThrd.c: fixed TclpFreeAllocCache() to recognize
when being called with NULL argument. This is a signal for it
to clean up the tsd key associated with the threading allocator.
* win/tclWinThrd.c: renamed TclWinFreeAllocCache to TclpFreeAllocCache
and fixed to recognize when being called with NULL argument.
This is a signal for it to clean up the tsd key associated with the
threading allocator.
2005-04-13 Don Porter <dgp@users.sourceforge.net>
* tests/unixInit.test: Disabled obsolete tests and removed code
* tests/encoding.test: that supported them.
* generic/tclInterp.c:
* library/init.tcl: Use auto-loading to bring in Tcl Module
* library/tclIndex: support as needed. This reduces startup
* library/tm.tcl: time by delaying this initialization to
a later time.
2005-04-15 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: missing semicolons caused failure to
compile with TCL_COMPILE_DEBUG.
2005-04-13 David Gravereaux <davygrvy@pobox.com>
* generic/tclIO.c (Tcl_SetChannelBufferSize): Lowest size limit
* tests/io.test: changed from ten bytes to one byte. Need
* tests/iogt.test: for this change was proven by
Ross Cartlidge <rossc@cisco.com> where [read stdin 1] was grabbing
10 bytes followed by starting a child process that was intended to
continue reading from stdin. Even with -buffersize set to one,
nine chars were getting lost by the buffersize over reading for
the native read() caused by [read].
2005-04-13 Don Porter <dgp@users.sourceforge.net>
* unix/tclUnixInit.c (TclpGetEncodingNameFromEnvironment): Reversed
order of verifying candidate [encoding system] value, checking against
a table in memory first before calling Tcl_GetEncoding and potentially
scanning through the filesystem. Also ordered the table so that a
binary search could be used within it. Improves startup time a bit
more on some systems.
2004-04-13 Kevin B. Kenny <kennykb@acm.org>
* library/clock.n: Added a missing '--' on several [switch]
commands to improve performance of [clock format] and related
operations. [Feature Request 1182459]
2005-04-13 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
* doc/fcopy.n: Improved documentation on copying binary files,
added an example and mentioned the use of [file copy].
* doc/fconfigure.n: Improved documentation of -encoding binary
option.
This is all following comments from Steve Manning <steve@manning.net>
on comp.lang.tcl that the current documentation was not clear.
2005-04-13 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c:Commented out the functions
TclPrintInstruction(), TclPrintObject() and TclPrintSource() when
not debugging the compiler, as they are never called in that case.
2005-04-12 Don Porter <dgp@users.sourceforge.net>
* generic/tclInterp.c: Corrected bad syntax of Tcl_Panic() call.
* generic/tclUtil.c (TclGetProcessGlobalValue): More robust handling
of bad TclInitProcessGlobalValueProc behavior; an immediate panic
rather than a mysterious crash later.
* generic/tclEncoding.c: Several changes to the way the
encodingFileMap cache is maintained. Previously, it was attempted
to keep the file map filled and up to date with changes in the
encoding search path. This contributed to slow startup times since
it required an expensive "glob" operation to fill the cache. Now the
validity of items in the cache are checked at the time they are
used, so the cache is permitted to fall out of sync with the
encoding search path. Only [encoding names] and Tcl_GetEncodingNames()
now pay the full expense. [Bug 1177363]
2005-04-12 Kevin B. Kenny <kennykb@acm.org>
* compat/strstr.c: Added default definition of NULL to
accommodate building on systems with badly broken headers.
[Bug #1175161]
2005-04-11 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
* tools/tclZIC.tcl: Rewrote to take advantage of more features of
Tcl 8.5 (on which it was dependent anyway). Also added a [package
require] line to formalize the relationship.
2005-04-11 Kevin Kenny <kennykb@users.sf.net>
[kennykb-numerics-branch] Merged with HEAD. Updated to libtommath 0.35.
* generic/tclBasic.c: Attempted to repeat changes that applied
to tclExecute.c in Miguel Sofer's commit of 2005-04-01, together
with (possibly) a few more uses of his new object creation macros.
Also plugged a memory leak in TclObjInvoke. [Bug 1180368]
2005-04-10 Kevin Kenny <kennykb@acm.org>
* library/tzdata/America/Montevideo:
* library/tzdata/Asia/Almaty:
* library/tzdata/Asia/Aqtau:
* library/tzdata/Asia/Aqtobe:
* library/tzdata/Asia/Baku:
* library/tzdata/Asia/Jerusalem:
* library/tzdata/Asia/Oral:
* library/tzdata/Asia/Qyzylorda:
* library/tzdata/Indian/Chagos:
* library/tzdata/Indian/Cocos: Olson's tzdata2005h
2005-04-10 Don Porter <dgp@users.sourceforge.net>
* generic/tclBasic.c (TclObjInvoke): Plug memory leak. [Bug 1180368]
2005-04-09 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: fix possible leak of expansion Tcl_Objs
2005-04-09 Daniel Steffen <das@users.sourceforge.net>
* macosx/README: updated requirements for OS & developer tool
versions + other small fixes/cleanup.
* generic/tclListObj.c (Tcl_ListObjIndex): added missing NULL return
when getting index from an empty list.
* unix/tcl.m4 (Darwin): added -single_module linker flag to
TCL_SHLIB_LD_EXTRAS and TK_SHLIB_LD_EXTRAS.
* unix/configure: autoconf-2.59
2005-04-08 Don Porter <dgp@users.sourceforge.net>
* generic/tclInt.h (TclGetEncodingFromObj): New function to
* generic/tclEncoding.c (TclGetEncodingFromObj): retrieve a
Tcl_Encoding value, as well as cache it in the internal rep
of a new "encoding" Tcl_ObjType.
* generic/tclCmdAH.c (Tcl_EncodingObjCmd): Updated to call
new function so that Tcl_Encoding's used by [encoding convert*]
routines are not freed too quickly. [Bug 1077262]
2005-04-08 Donal K. Fellows <dkf@users.sf.net>
* generic/tclCompCmds.c (TclCompileSwitchCmd): Rewritten to be
able to handle the other form of [switch] and generate slightly
simpler (but longer) code.
2005-04-06 Donal K. Fellows <dkf@users.sf.net>
* doc/upvar.n, doc/unset.n, doc/tell.n, doc/tclvars.n, doc/subst.n:
* doc/seek.n, doc/scan.n, doc/regsub.n, doc/registry.n, doc/regexp.n:
* doc/read.n, doc/puts.n, doc/pkgMkIndex.n, doc/open.n, doc/lreplace.n:
* doc/lrange.n, doc/load.n, doc/llength.n, doc/linsert.n, doc/lindex.n:
* doc/lappend.n, doc/info.n, doc/gets.n, doc/format.n, doc/flush.n:
* doc/fileevent.n, doc/file.n, doc/fblocked.n, doc/close.n:
* doc/array.n, doc/Utf.3, doc/TraceVar.3, doc/StrMatch.3, doc/RegExp.3:
* doc/PrintDbl.3, doc/OpenTcp.3, doc/OpenFileChnl.3, doc/Object.3:
* doc/Notifier.3, doc/LinkVar.3, doc/IntObj.3, doc/Interp.3:
* doc/GetOpnFl.3, doc/GetIndex.3, doc/Eval.3, doc/CrtMathFnc.3:
* doc/CrtFileHdlr.3, doc/CrtCommand.3, doc/CrtChannel.3:
* doc/Backslash.3: Purge old .VS/.VE macro instances.
* tools/man2html2.tcl (IPmacro): Rewrote to understand what .IP
really is (.IP and .TP are really just two ways of doing the same
thing). Change below made this relevant.
* doc/re_syntax.n: Change some uses of .TP to .IP to work around
bugs in various *roff implementations. Also reworded the atom
descriptions slightly.
2005-04-05 Don Porter <dgp@users.sourceforge.net>
* generic/tclExecute.c (ExprSrandFunc): Replaced incursions into the
* generic/tclUtil.c (TclGetIntForIndex): intreps of numeric types
with simpler calls of Tcl_GetIntFromObj and Tcl_GetLongFromObj,
now that those routines are better behaved wrt shimmering.
[Patch 1177219]
2005-04-05 Miguel Sofer <msofer@users.sf.net>
* generic/tclInt.h:
* generic/tclObj.c: Change in TclDecrRefCount and TclFreeObj, to
speed up the freeing of simple Tcl_Obj [Patch 1174551]
2005-04-04 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: small opts in obj handling
2005-04-02 Miguel Sofer <msofer@users.sf.net>
* generic/tclVar.c: converted a few function calls to macros.
2005-04-01 Miguel Sofer <msofer@users.sf.net>
* doc/ListObj.3:
* generic/tclBasic.c:
* generic/tclCmdIL.c:
* generic/tclConfig.c:
* generic/tclExecute.c:
* generic/tclInt.decls:
* generic/tclInt.h:
* generic/tclIntDecls.h:
* generic/tclListObj.c:
* generic/tclStubInit.c:
* generic/tclVar.c: Changed the internal representation of lists
to (a) reduce the malloc/free calls at list creation (from 2 to
1), (b) reduce the cost of handling empty lists (we now never
create a list internal rep for them), (c) allow refcounting of the
list internal rep. The latter permits insuring that the pointers
returned by Tcl_ListObjGetElements remain valid even if the object
shimmers away from its original list type. This is [Patch 1158008]
* generic/tclExecute.c:
* generic/tclInt.h:
* generic/tclObj.c:
* generic/tclStringObj.c:
(1) defined new internal macros for creating and setting
frequently used obj types (int,long, wideInt, double,
string). Changed TEBC to use eg 'TclNewIntObj(objPtr, i)' to avoid
the function call in 'objPtr = Tcl_NewIntObj(i)'
(2) ExecEnv now stores two Tcl_Obj* pointing to the constants "0"
and "1", for use by TEBC.
(3) slight reduction in cost of INST_START_CMD
2005-03-31 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c (INST_JUMP_TRUE/FALSE): replaced
"test and branch" with "compute index into table"
2005-03-30 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
* doc/FileSystem.3: Defined loadHandle argument. [Bug 1172401]
2005-03-29 Jeff Hobbs <jeffh@ActiveState.com>
* win/tcl.m4, win/configure: do not require cygpath in macros to
allow msys alone as an alternative.
2005-03-24 Don Porter <dgp@users.sourceforge.net>
* generic/tclCompile.h: Move the TclInterpReady() declaration from
* generic/tclInt.h: tclCompile.h to tclInt.h. Should have
been done as part of the 1115904 bug fix on 2005-03-18.
* generic/tclThreadTest.c: Stop providing the phony package
"Thread 1.0" when the [::testthread] command is defined. It's
never used by anything, and conflicts with loading the real
"Thread" package.
2005-03-18 Don Porter <dgp@users.sourceforge.net>
* generic/tclCompCmds.c (TclCompileIncrCmd): Corrected checks
for immediate operand usage to permit leading space and sign
characters. Restores more efficient bytecode for [incr x -1]
that got lost in the CONST string reforms of Tcl 8.4. [Bug 1165671]
* generic/tclBasic.c (Tcl_EvalEx): Restored recursion limit
* generic/tclParse.c (TclSubstTokens): testing in nested command
* tests/basic.test (basic-46.4): substitutions within direct
* tests/parse.test (parse-19.*): script evaluation (Tcl_EvalEx)
that got lost in the parser reforms of Tcl 8.1. Added tests for
correct behavior. [Bug 1115904]
2005-03-15 Vince Darley <vincentdarley@users.sourceforge.net>
* generic/tclFileName.c:
* win/tclWinFile.c:
* tests/winFCMd.test: fix to 'file pathtype' and 'file norm'
failures on reserved filenames like 'COM1:', etc.
2005-03-15 Pat Thoyts <patthoyts@users.sourceforge.net>
* unix/tcl.m4: Updated the OpenBSD configuration and regenerated
* unix/configure: the configure script.
2005-03-15 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch] Merged with HEAD.
* generic/tclBasic.c (many):
* generic/tclCompExpr.c (CompileMathFuncCall):
* generic/tclCompile.h:
* generic/tclExecute.c (many):
* generic/tclParseExpr.c (ParsePrimaryExpr):
* tests/compExpr-old.test:
* tests/compExpr.test:
* tests/compile.test:
* tests/expr-old.test:
* tests/expr.test:
* tests/for.test:
* tests/parseExpr.test:
Initial implementation of TIP #232.
* generic/tclObj.c (Tcl_DbNewBignumObj): Fixed typo that broke
--enable-symbols=mem build
* tests/binary.test (binary-40.3, binary-40.6): Corrected tests
to allow NaN(7ffffffffffff).
2005-03-14 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: fixed INST_PUSH1's debugging code (wrong
obj ref passed to TRACE_WITH_OBJ).
2005-03-14 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c: fixed INST_RETURN's stack effect in
tclInstructionTable (-1 instead of -2)
2005-03-10 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompCmds.c: removed debugging line
2005-03-10 Don Porter <dgp@users.sourceforge.net>
* generic/tclTrace.c (TclCheckInterpTraces): Corrected mistaken
cast of ClientData to (TraceCommandInfo *) when not warranted.
Thanks to Yuri Victorovich for the report. [Bug 1153871]
* generic/tcl.h: Moved flag values TCL_TRACE_ENTER_EXEC and
* generic/tclInt.h: TCL_TRACE_LEAVE_EXEC from public interface
into private. Should be used only by internal workings of
execution traces.
2005-03-09 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch] Merged from HEAD.
* doc/PrintDbl.3:
* doc/tclVars.n: Documented new semantics for tcl_precision.
* generic/tclExecute.c (Tcl_ExecuteByteCode): Removed the check
for division-by-zero on IEEE-754 machines.
* generic/tclUtil.c (Tcl_PrintDouble): Corrected bug where numbers
in the range [1e-4 .. 1.) were printed incorrectly.
* tests/compExpr-old.test (compExpr-old-11.13): Revised test
case for division by zero
* tests/expr-old.test (expr-34.11, expr-34.12): Revised test
cases for overflow in pow() to deal with infinities.
* tests/expr.test (expr-11.13, expr-29.1, expr-29.2): Revised
test case for division by zero and for underflow on input
conversions.
* tests/parseExpr.test (parseExpr-16.11): Revised test case for
overflow on input conversion.
* tests/string.test (string-6.38 deleted): Removed test case
for underflow on input conversion, which is no longer an error.
* tests/util.test (util-10.*): Added test case for the bug in
tclUtil.c.
2005-03-08 Jeff Hobbs <jeffh@ActiveState.com>
* win/makefile.vc: clarify necessary defined vars that can come
from MSVC or the Platform SDK.
2005-03-07 Donal K. Fellows <dkf@users.sf.net>
* doc/string.n: Minor typo. [Bug 1158247]
2005-03-07 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: new peephole optimisation for INST_PUSH1;
fixed the peephole opt in INST_POP so that it is not used when
TCL_COMPILE_DEBUG is defined.
2005-03-04 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch]
* generic/tclCmdMZ.c: Changed [scan] to treat out-of-range
floating point values as infinities and zeroes.
* generic/tclExecute.c: Changed [expr] to be permissive about
infinities, allowing them to propagate.
* generic/tclGet.c: Changed Tcl_GetDouble to be permissive about
over/underflow.
* generic/tclObj.c: Changed SetDoubleFromAny to be permissive
about over/underflow.
* generic/tclParseExpr.c: Made [expr] permissive about input
numbers out of range.
2005-03-03 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch]
* generic/tclInt.h:
* generic/tclStrToD.c (Tcl_DoubleDigits, TclFormatNaN):
* generic/tclUtil.c (Tcl_PrintDouble):
Changed the signature of TclDoubleDigits so that it
accepts a pointer to the signum of the argument, and
returns the signum via that pointer. Added very
hacky code to handle IEEE signed zeroes in Tcl_DoubleDigits.
(It can't be done other than as a hack until C9x;
C89 simply doesn't deal with the concept of -0.0).
Added output conversion of tagged NaN values.
* generic/tclBinary.c (FormatNumber):
Changed to allow [binary format] to handle NaN.
* tests/binary.test (binary-60.1):
Added a quick-n-dirty test to make sure that NaN's
can be scanned and formatted.
* generic/tclParseExpr.c (GetLexeme, ParseMaxDoubleLength):
Modified so that tagged NaN (e.g., NaN(DEADBEEF)) can
be recognized.
2005-03-02 Kevin B. Kenny <kennykb@acm.org>
[kennykb-numerics-branch] Merged with HEAD as of 2005-02-23.
* generic/tclExecute.c:
Broadened test for NaN to work on Windows.
* generic/tclInt.h:
* generic/tclStrToD.c (Tcl_DoubleDigits):
* generic/tclUtil.c (Tcl_PrintDouble, TclPrecTraceProc):
Added Tcl_DoubleDigits to format 'double' numbers
with the minimum number of significant digits to
yield correct rounding. Modified tcl_precision to
accept 0 as a precision (meaning "minimum digits"), and
made 0 the default. [TIP #132]
* generic/tclObj.c:
Made NaN's throw an error in Tcl_GetDoubleFromObj.
* unix/Makefile.in:
* win/Makefile.in:
* win/makefile.vc:
Added libtommath/bn_mp_init_set.c to the build.
* libtommath/tommath.h (mp_iseven):
Fixed a bug that caused zero to test 'odd'.
* generic/tommath.h:
Regenerated.
* tests/binary.test:
* tests/expr-old.test:
* tests/expr.test:
* tests/scan.test:
Corrected a number of tests that depended on
tcl_precision, and removed the {eformat} condition
from tests that no longer require it.
* tests/util.test:
Corrected a number of tests that depended on
tcl_precision, and removed the {eformat} condition
from tests that no longer require it. Added a series
of tests for correct rounding in Tcl_PrintDouble. [TIP
#132].
2005-03-01 David N. Welton <davidw@dedasys.com>
* doc/CrtSlave.3: Changed to Tcl_Object to Tcl_Obj in the man
page.
2005-02-24 Don Porter <dgp@users.sourceforge.net>
|
| ︙ | ︙ | |||
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 | * doc/binary.n: Made the documentation of sign bit masking and [binary scan] consistent. [Bug 1117017] 2005-02-08 David N. Welton <davidw@dedasys.com> * doc/CrtChannel.3: Typo: return->returns. 2005-02-06 David N. Welton <davidw@dedasys.com> * doc/Thread.3: One-word grammar fix. 2005-02-05 David N. Welton <davidw@dedasys.com> * doc/Thread.3: Fixed sentence describing flags for Tcl_CreateThread. * doc/FileSystem.3: Cleaned up typo in Tcl_FSNewNativePath documentation. * generic/tclPathObj.c: Cleaned up typo in comment. 2005-02-02 Mo DeJong <mdejong@users.sourceforge.net> * generic/tclProc.c (TclInitCompiledLocals): Add check for type of the framePtr->procPtr->bodyPtr passed to TclInitCompiledLocals and panic if it is not the correct type. If the body of the proc is not of the compiled byte code type then the code will crash. This was discovered while tracking down a crash in Itcl, that crash is fixed by Itcl patch 1115085. 2005-02-01 Don Porter <dgp@users.sourceforge.net> * generic/tclExecute.c (TclCompEvalObj): Removed stray statement left behind in prior code reorganization. 2005-01-31 Don Porter <dgp@users.sourceforge.net> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 | * doc/binary.n: Made the documentation of sign bit masking and [binary scan] consistent. [Bug 1117017] 2005-02-08 David N. Welton <davidw@dedasys.com> * doc/CrtChannel.3: Typo: return->returns. 2005-02-06 Kevin B. Kenny <kennykb@acm.org> [kennykb-numerics-branch] * generic/tclStrToD.c (TclStrToD, SafeLdExp): Added code to manage the FPU precision on gcc+x86. Enabled fast conversion of floats with small exponents now that precision is correct. * tests/expr.test: Corrected test for the smallest representible value to the right IEEE values. 2005-02-06 David N. Welton <davidw@dedasys.com> * doc/Thread.3: One-word grammar fix. 2005-02-05 David N. Welton <davidw@dedasys.com> * doc/Thread.3: Fixed sentence describing flags for Tcl_CreateThread. * doc/FileSystem.3: Cleaned up typo in Tcl_FSNewNativePath documentation. * generic/tclPathObj.c: Cleaned up typo in comment. 2005-02-03 Kevin B. Kenny <kennykb@acm.org> [kennykb-numerics-branch] * generic/tclStrToD.c (TclStrToD, RefineResult, SafeLdExp): Added code to ensure that 'ldexp' is never called with a value that will underflow. * tests/expr.test: Added tests for the smallest representible value, and rounding between it and zero. (The tests reflect current behaviour; plan is to change the specification of Tcl so that input conversion of doubles underflows silently.) 2005-02-02 Mo DeJong <mdejong@users.sourceforge.net> * generic/tclProc.c (TclInitCompiledLocals): Add check for type of the framePtr->procPtr->bodyPtr passed to TclInitCompiledLocals and panic if it is not the correct type. If the body of the proc is not of the compiled byte code type then the code will crash. This was discovered while tracking down a crash in Itcl, that crash is fixed by Itcl patch 1115085. 2005-02-01 Kevin B. Kenny <kennykb@acm.org> [kennykb-numerics-branch] Merged with HEAD as of today. * generic/tclInt.decls: Changed numbers of new stubs to resolve a conflict. * generic/tclInt.h: Added new TclStrToD routine that replaces the native 'strtod' thro ughout Tcl. * generic/tclCmdMZ (Tcl_StringObjCmd): * generic/tclGet.c (Tcl_GetDouble): * generic/tclObj.c (SetBooleanFromAny, SetDoubleFromAny): * generic/tclParseExpr.c (GetLexeme): * generic/tclScan.c (Tcl_ScanObjCmd): Replaced all uses of the native 'strtod' with a TclStrToD routine that performs correct rounding and handles denormals. * generic/tclStrToD.c: (new file) New scanning function for extracting 'double' from a string that rounds correctly, and handles denormals and infinities. * unix/Makefile.in: * win/Makefile.in: * win/makefile.vc: Added tclStrToD.c and the tommath routines that support it. These changes represent a partial implementation of TIP #132. Output conversion of floating point numbers, and proper handling of infinities within expressions, still need to be addressed. 2005-02-01 Don Porter <dgp@users.sourceforge.net> * generic/tclExecute.c (TclCompEvalObj): Removed stray statement left behind in prior code reorganization. 2005-01-31 Don Porter <dgp@users.sourceforge.net> |
| ︙ | ︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 204 | * generic/tclFileName.c: 2005-01-21 Donal K. Fellows <donal.k.fellows@man.ac.uk> * doc/FileSystem.3: Add missing ARGUMENTS section definitions for arguments to Tcl_FSLink. [Bug 1106272] 2005-01-19 Donal K. Fellows <donal.k.fellows@man.ac.uk> TIP#235 IMPLEMENTATION * doc/Ensemble.3: Documentation for the new public API. * generic/tclNamesp.c (Tcl_CreateEnsemble,...): Rename of * generic/tcl.decls: existing API into TIPped form. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 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 | * generic/tclFileName.c: 2005-01-21 Donal K. Fellows <donal.k.fellows@man.ac.uk> * doc/FileSystem.3: Add missing ARGUMENTS section definitions for arguments to Tcl_FSLink. [Bug 1106272] 2005-01-21 Kevin B. Kenny <kennykb@acm.org> [kennykb-numerics-branch] * unix/Makefile.in: Updated Makefile to build libtommath on Unix as well as Windows. [Bug 1106865] * generic/tclTestObj.c (TestbignumobjCmd): Silenced a compiler warning about a mismatched 'const'. 2005-01-20 Kevin B. Kenny <kennykb@acm.org> [kennykb-numerics-branch] Development checkpoint. * compat/strtoll.c: Reverted to HEAD. * compat/strtoull.c: * doc/Ensemble.3: * generic/tclBasic.c: * generic/tclCmdIL.c: * generic/tclNamesp.c: * generic/tclPathObj.c: * generic/tclPort.h: * unix/configure: * unix/configure.in: * unix/tcl.m4: * win/configure: * win/configure.in: * win/rules.vc: * win/tcl.m4: * generic/tcl.h: Added declarations for bignum types, and for a 'bignumValue' in the Tcl_Obj structure. * generic/tclInt.h: Added declarations of interface procedures for memory allocation in libtommath. * generic/tcl.decls: Added new interface to bignum objects. * generic/tclInt.decls: Added internal stubs for bignum routines used by the test code in tclTestObj.c. * generic/tclDecls/h: Regen. * generic/tclIntDecls.h: * generic/tclStubInit.h: * tools/fix_tommath_h.tcl: (New file) Script to edit libtommath/tommath.h and produce generic/tommath.h so that storage classes, allocation routines, and data types conform to Tcl's conventions. * generic/tommath.h: (New file) Generated by the above. * generic/tclTomMath.h: (New file) Additional declarations to be included in tommath.h when building Tcl. * generic/tclTomMathInterface.c: (New file) Small 'glue' routines adapting tommath's API to Tcl. * libtommath/bn_fast_s_mp_mul_digs.c: * libtommath/bn_mp_mul_d.c: * libtommath/bn_mp_read_radix.c: * libtommath/tommath.h: Applied suggested changes from Tom St Denis that correct an off-by-one error in single-digit multiplication (leading to a pointer smash if uncorrected) and change the string argument to 'mp_read_radix' from 'char*' to 'const char*'. * libtommath/bn_mp_radix_size.c: Local patch to ensure that sufficient memory is requested even if the number has a single digit. * libtommath/bn_mp_read_radix.c: Local patch to return MP_VAL if the input string contains an invalid character. * generic/tclObj.c: Added accessor functions for bignums. * generic/tclTestObj.c: Added a 'testbignumobj' command to exercise the accessor functions for bignums. * win/Makefile.in: Added rules for making libtommath. 2005-01-19 Donal K. Fellows <donal.k.fellows@man.ac.uk> TIP#235 IMPLEMENTATION * doc/Ensemble.3: Documentation for the new public API. * generic/tclNamesp.c (Tcl_CreateEnsemble,...): Rename of * generic/tcl.decls: existing API into TIPped form. |
| ︙ | ︙ | |||
317 318 319 320 321 322 323 | * generic/tclDate.c: Regen * generic/tclGetDate.y (TclDatelex): Fixed a problem where a four-digit group with >=2 leading zeroes appeared to be a two-digit group, leading to misinterpreting the time 0012 as 1200. [Bug # 1090413] * library/clock.tcl: Added code to interpret correctly months | | | | | 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 | * generic/tclDate.c: Regen * generic/tclGetDate.y (TclDatelex): Fixed a problem where a four-digit group with >=2 leading zeroes appeared to be a two-digit group, leading to misinterpreting the time 0012 as 1200. [Bug # 1090413] * library/clock.tcl: Added code to interpret correctly months outside the range 01-12 as reduced modulo 12 with a corresponding adjustment to the year. [Bug 1092789] * tests/clock.test: Added regression test cases for the above two bugs. * unix/Makefile.in: Added --no-lines to the 'bison' command line * win/Makefile.in: to help constrain the number of diffs in a cvs checkin. 2004-12-24 Miguel Sofer <msofer@users.sf.net> * generic/tclCompile.c: * generic/tclCompile.h: * generic/tclExecute.c: * generic/tclInt.h: |
| ︙ | ︙ | |||
641 642 643 644 645 646 647 | reworked as an initializer of a ProcessGlobalValue. * unix/tclUnixTest.c: Update implementations of [testfindexecutable], [testgetdefenc], and [testsetdefenc]. * tests/unixInit.test: Corrected tests to operate properly even when a value of TCL_LIBRARY is required to find encodings. | | | 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 | reworked as an initializer of a ProcessGlobalValue. * unix/tclUnixTest.c: Update implementations of [testfindexecutable], [testgetdefenc], and [testsetdefenc]. * tests/unixInit.test: Corrected tests to operate properly even when a value of TCL_LIBRARY is required to find encodings. * generic/tclInt.decls: New internal stubs: TclGetEncodingSearchPath, TclSetEncodingSearchPath, TclpGetEncodingNameFromEnvironment. These are candidates for public exposure by future TIPs. * generic/tclIntDecls.h: make genstubs * generic/tclStubInit.c: |
| ︙ | ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | * tests/tm.test: Expanded on the testsuite entered by Donal. * library/tm.tcl: Even found bugs, these have been corrected. 2004-10-26 Kevin Kenny <kennykb@acm.org> * tests/format.test (format-19.1): Additional regression test for | | | 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 | * tests/tm.test: Expanded on the testsuite entered by Donal. * library/tm.tcl: Even found bugs, these have been corrected. 2004-10-26 Kevin Kenny <kennykb@acm.org> * tests/format.test (format-19.1): Additional regression test for Bug 868489. 2004-10-27 Donal K. Fellows <donal.k.fellows@man.ac.uk> * doc/*.n: Many small general documentation fixes. 2004-10-26 David Gravereaux <davygrvy@pobox.com> |
| ︙ | ︙ | |||
1976 1977 1978 1979 1980 1981 1982 | that all storage in the Bison parser is now on the C stack, eliminating any need for mutex protection around [clock scan]. Also, changed the Makefiles so that 'make gendate' is available on Windows as well as Unix. * generic/tclCmdAH.c (Tcl_FormatObjCmd): Removed some grubby * generic/tclObj.c (SetBooleanFromAny): work-around code | | | | 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 | that all storage in the Bison parser is now on the C stack, eliminating any need for mutex protection around [clock scan]. Also, changed the Makefiles so that 'make gendate' is available on Windows as well as Unix. * generic/tclCmdAH.c (Tcl_FormatObjCmd): Removed some grubby * generic/tclObj.c (SetBooleanFromAny): work-around code that was needed only because of Bug 868489. * generic/tclBasic.c (TclObjInvoke): Removed three unused variables to silence a compiler warning in VC++. 2004-09-27 Vince Darley <vincentdarley@users.sourceforge.net> * doc/FileSystem.3: fix to small typo. |
| ︙ | ︙ | |||
3390 3391 3392 3393 3394 3395 3396 | * tests/namespace.c (namespace-17.10): testing for interference between varname caching and name resolver. 2004-05-25 Kevin Kenny <kennykb@acm.org> * tests/winFCmd.test: Correct test for the presence of a CD-ROM so | | | | | 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 | * tests/namespace.c (namespace-17.10): testing for interference between varname caching and name resolver. 2004-05-25 Kevin Kenny <kennykb@acm.org> * tests/winFCmd.test: Correct test for the presence of a CD-ROM so that it doesn't misdetect some other sort of filesystem with a write-protected root as being a CD-ROM drive. [Bug 918267] 2004-05-25 Don Porter <dgp@users.sourceforge.net> * tests/winPipe.test: Protect against path being set * tests/unixInit.test: Unset path when done. * tests/unload.test (unload-3.1): Verify [pkgb_sub] does not exist. Delete interps when done. |
| ︙ | ︙ | |||
3537 3538 3539 3540 3541 3542 3543 | datastructures. Also got rid of all trailing whitespace lines from the test suite! 2004-05-19 Andreas Kupries <andreask@activestate.com> * generic/tclIO.c: Fixed [SF Tcl Bug 943274]. This is the same problem * generic/tclIO.h: as [SF Tcl Bug 462317], see ChangeLog entry | | | | | | | | | | | 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 | datastructures. Also got rid of all trailing whitespace lines from the test suite! 2004-05-19 Andreas Kupries <andreask@activestate.com> * generic/tclIO.c: Fixed [SF Tcl Bug 943274]. This is the same problem * generic/tclIO.h: as [SF Tcl Bug 462317], see ChangeLog entry 2001-09-26. The fix done at that time is incomplete. It is possible to get around it if the actual read operation is defered and not executed in the event handler itself. Instead of tracking if we are in an read caused by a synthesized fileevent we now track if the OS has delivered a true event = actual data and bypass the driver if a read finds that there is no actual data waiting. The flag is cleared by a short or full read. ***POTENTIAL INCOMPATIBILITY*** for channel drivers. 2004-05-17 Vince Darley <vincentdarley@users.sourceforge.net> * generic/tclPathObj.c: fix to (Bug 956063) in 'file dirname'. * tests/cmdAH.test: added test for this bug. |
| ︙ | ︙ | |||
3664 3665 3666 3667 3668 3669 3670 | * generic/tclInt.decls: Promoted TclpLocaltime and TclpGmtime * generic/tclIntDecls.h: from Unix-specific stubs to the generic * generic/tclIntPlatDecls.h: internal Stubs table. Reran 'genstubs' * generic/tclStubInit.c: * unix/tclUnixPort.h: * generic/tclClock.c: Changed a buggy 'GMT' timezone specification | | | | | | | | 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 | * generic/tclInt.decls: Promoted TclpLocaltime and TclpGmtime * generic/tclIntDecls.h: from Unix-specific stubs to the generic * generic/tclIntPlatDecls.h: internal Stubs table. Reran 'genstubs' * generic/tclStubInit.c: * unix/tclUnixPort.h: * generic/tclClock.c: Changed a buggy 'GMT' timezone specification to the correct 'GMT0'. [Bug #922848] * unix/tclUnixThrd.c: Moved TclpGmtime and TclpLocaltime to unix/tclUnixTime.c where they belong. * unix/tclUnixTime.c (TclpGmtime, TclpLocaltime, TclpGetTimeZone, ThreadSafeGMTime [removed], ThreadSafeLocalTime [removed], SetTZIfNecessary, CleanupMemory): Restructured to make sure that the same mutex protects all calls to localtime, gmtime, and tzset. Added a check in front of those calls to make sure that the TZ env var hasn't changed since the last call to tzset, and repeat tzset if necessary. [Bug #942078] Removed a buggy test of the Daylight Saving Time information in 'gettimeofday' in favor of applying 'localtime' to a known value. [Bug #922848] |
| ︙ | ︙ |
Changes to README.
1 | README: Tcl | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
README: Tcl
This is the Tcl 8.5a4 source distribution.
Tcl/Tk is also available through NetCVS:
http://tcl.sourceforge.net/
You can get any source release of Tcl from the file distributions
link at the above URL.
RCS: @(#) $Id: README,v 1.54.2.1 2005/06/13 01:45:34 msofer Exp $
Contents
--------
1. Introduction
2. Documentation
3. Compiling and installing Tcl
4. Development tools
|
| ︙ | ︙ |
Changes to changes.
1 2 | Recent user-visible changes to Tcl: | | | 1 2 3 4 5 6 7 8 9 10 | Recent user-visible changes to Tcl: RCS: @(#) $Id: changes,v 1.94.2.1 2005/06/13 01:45:35 msofer Exp $ 1. No more [command1] [command2] construct for grouping multiple commands on a single command line. 2. Semi-colon now available for grouping commands on a line. 3. For a command to span multiple lines, must now use backslash-return |
| ︙ | ︙ | |||
6345 6346 6347 6348 6349 6350 6351 | by 'glob' (darley) Doc improvements [759545,926590,935853,1017072,1018486,1022527,1027849, 1032243,1047928,1048005,1058446,1062647,1065732,1073334,etc.] Test suite expansion [1036649,1001997,etc.] --- Released 8.5a2, December 7, 2004 --- See ChangeLog for details --- | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 |
by 'glob' (darley)
Doc improvements [759545,926590,935853,1017072,1018486,1022527,1027849,
1032243,1047928,1048005,1058446,1062647,1065732,1073334,etc.]
Test suite expansion [1036649,1001997,etc.]
--- Released 8.5a2, December 7, 2004 --- See ChangeLog for details ---
2004-12-13 (bug fix)[1083082] encoding memory leaks (ade,porter)
2004-12-13 (bug fix)[1082349] restored C++ extension support (porter)
2004-12-14 (bug fix)[1081541] workaround automake-ism "$U" (porter)
2004-12-15 (new feature) CallFrames on execution, not C, stack (sofer)
2004-12-16 (bug fix)[1085023] [interp limit] support in [vwait], etc. (fellows)
2004-12-29 (bug fix)[1090413] make [clock scan 0030] work (morian,kenny)
2004-12-29 (bug fix)[1092789] make [clock scan 10000] work (porter,kenny)
2004-12-29 (platform support)[1092952,1091967] MSVC7, gcc OPT compiles (hobbs)
2005-01-06 (performance)[1020491] [http::mapReply] (fellows)
=> http 2.5.1
2005-01-09 (bug fix)[1095909] stopped use of readdir_r (english)
2005-01-10 (enhancement)[1081595] stopped use of TCL_DBGX (english)
2005-01-17 (bug fix)[1100542] [glob] of Windows shares (schar,darley)
2005-01-19 (new feature)[TIP 235] C API for ensembles (fellows)
2005-01-21 (new feature)[TIP 233] virtual time (kupries)
2005-01-25 (bug fix)[1101670] [auto_reset] update for [namespace] (porter)
2005-01-27 (new feature)[TIP 218] Tcl_Channel API update for threads (kupries)
2005-01-27 (bug fix)[1109484] Tcl_Expr* updates for Tcl_WideInt (hobbs)
2005-01-28 (platform support)[1021871] Solaris gcc 64-bit support (hobbs)
2005-02-10 (bug fix)[1119369] Tcl_EvalObjEx: avoid shimmer loss of List intrep
(sofer,macdonald)
2005-02-11 (platform support) correct gcc builds for AIX-4+, HP-UX-11 (hobbs)
2005-02-24 (bug fix)[1119798] prevent [source $directory] (porter,mpettigr)
=> tcltest 2.2.8
2005-03-10 (bug fix)[1153871] bad ClientData cast (porter,victorovich)
2005-03-15 (platform support) OpenBSD ports patch (thoyts)
2005-03-18 (bug fix)[1115904] restore recursion limit in direct eval (porter)
2005-03-24 (bug fix) stop conflict between Tcltest and Thread packages (porter)
2005-03-29 (platform support) allow msys builds without cygwin (hobbs)
2005-04-01 (internal change)[1158008] internal rep of "list" Tcl_Obj's
now uses a refcounted struct (sofer)
***POTENTIAL INCOMPATIBILITY***
For any code that goes poking into the internals of "list" Tcl_Obj's
2005-04-05 (performance)[1174551] Tcl_DecrRefCount of Tcl_Obj "chains" (sofer)
2005-04-08 (performance)[1077262] better Tcl_Encoding cache lifetimes (porter)
2005-04-10 (bug fix)[1180368] [interp invokehidden] mem leak (kenny,porter)
2005-04-12 (performance)[1177363] startup encoding file scan (porter)
2005-04-12 (performance)[1182459] [clock format] (kenny)
2005-04-13 (bug fix) min buffer size dropped from 10 to 1 byte (gravereaux)
2005-04-16 (bug fix)[1178445] fix memory waste at thread exit (vasiljevic)
2004-04-16 (bug fix)[1084111] [array names] memory leak (ade,sofer)
2005-04-19 (bug fix)[1185933] [clock] init clobbered global vars (ring,kenny)
2005-04-19 (new feature) [::tcl::unsupported::EncodingDirs] - unsupported
command to set search path for encoding files (porter)
2005-04-20 (bug fix)[1090869] Tcl_GetInt accept 0x80000000, 64-bit
(porter,singh)
2005-04-22 (bug fix)[1187123] [string is boolean] respect EIAS (porter)
2005-04-25 (enhancement) update to tzdata2005i (kenny)
2005-04-25 (platform support) builds on Mac OS X 10.1 (steffen)
2005-04-27 (new feature)[TIP 183] [open $f {... BINARY ...}] (porter)
2005-04-29 (new feature)[TIP 176] simple index arithmetic (porter)
2005-05-06 (platform support) x86_64 Solarix cc and Solaris 10 builds (hobbs)
2005-05-10 (bug fix)[1198892] [expr {i**0}] error (kaitschu,markus)
2005-05-10 (new feature)[TIP 132] floating-point conversion to string (kenny)
***POTENTIAL INCOMPATIBILITY***
For scripts that rely on (tcl_precision==12) number formatting
2005-05-10 (new feature)[TIP 232] math functions as commands (kenny)
***POTENTIAL INCOMPATIBILITY***
Tcl_GetMathFuncInfo functioning is reduced; routine is now deprecated
2005-05-13 (feature removed) TCL_NO_MATH compiler directive (porter)
2005-05-14 (platform support) Mac OSX: configurable CoreFoundation API
(steffen)
2005-05-14 (platform support) Mac OSX: use realpath when threadsafe (steffen)
2005-05-17 (feature removed) Tcl_ObjType's "list", "procbody", "index",
"ensembleCommand", "localVarName", "levelReference, "boolean" are no
longer registered (porter)
***POTENTIAL INCOMPATIBILITY***
For any callers of Tcl_GetObjType on those strings
2005-05-20 (bug fix)[1201589] boolean literal prefix in expressions (porter)
2005-05-24 (platform support) Darwin build support merged into unix (steffen)
2005-05-24 (new feature)[1202209] Mac OSX: support [load] of .bundle binaries
Can support [load] from memory as well (steffen)
2005-05-24 (new feature)[1202178] [time] returns non-integer result (steffen)
2005-05-25 (new feature)[TIP 182] [expr {bool(...)}] (mistachkin,porter)
2005-05-30 (new feature)[TIP 229] [namespace path] (fellows)
2005-05-31 (bug fix)[1082283] Unix: notifier thread now joinable (vasiljevic)
2005-06-01 (new feature)[TIP 241] -nocase: lsort, lsearch, switch (mistachkin)
2005-06-01 (bug fix)[1209759] "return TCL_RETURN;" could cause panic (porter)
Documentation improvements [1075433,1085127,1117017,1124160,1149605,etc.]
--- Released 8.5a3, June 4, 2004 --- See ChangeLog for details ---
|
Changes to compat/string.h.
1 2 3 4 5 6 7 8 9 10 11 | /* * string.h -- * * Declarations of ANSI C library procedures for string handling. * * Copyright (c) 1991-1993 The Regents of the University of California. * Copyright (c) 1994-1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* * string.h -- * * Declarations of ANSI C library procedures for string handling. * * Copyright (c) 1991-1993 The Regents of the University of California. * Copyright (c) 1994-1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: string.h,v 1.5.4.1 2005/06/13 01:45:35 msofer Exp $ */ #ifndef _STRING #define _STRING #include <tcl.h> /* * The following #include is needed to define size_t. (This used to * include sys/stdtypes.h but that doesn't exist on older versions * of SunOS, e.g. 4.0.2, so I'm trying sys/types.h now.... hopefully * it exists everywhere) */ #include <sys/types.h> #ifdef __APPLE__ extern VOID * memchr _ANSI_ARGS_((CONST VOID *s, int c, size_t n)); #else extern char * memchr _ANSI_ARGS_((CONST VOID *s, int c, size_t n)); #endif extern int memcmp _ANSI_ARGS_((CONST VOID *s1, CONST VOID *s2, size_t n)); extern char * memcpy _ANSI_ARGS_((VOID *t, CONST VOID *f, size_t n)); #ifdef NO_MEMMOVE #define memmove(d, s, n) bcopy ((s), (d), (n)) #else extern char * memmove _ANSI_ARGS_((VOID *t, CONST VOID *f, |
| ︙ | ︙ |
Changes to compat/strstr.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * strstr.c -- * * Source code for the "strstr" library routine. * * Copyright (c) 1988-1993 The Regents of the University of California. * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* * strstr.c -- * * Source code for the "strstr" library routine. * * Copyright (c) 1988-1993 The Regents of the University of California. * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: strstr.c,v 1.4.4.1 2005/06/13 01:45:35 msofer Exp $ */ #include "tcl.h" #ifndef NULL #define NULL 0 #endif /* *---------------------------------------------------------------------- * * strstr -- * * Locate the first instance of a substring in a string. |
| ︙ | ︙ |
Changes to compat/strtoll.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * strtoll.c -- * * Source code for the "strtoll" library procedure. * * Copyright (c) 1988 The Regents of the University of California. * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * strtoll.c -- * * Source code for the "strtoll" library procedure. * * Copyright (c) 1988 The Regents of the University of California. * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: strtoll.c,v 1.7.4.1 2005/06/13 01:45:35 msofer Exp $ */ #include "tclInt.h" #include <ctype.h> #define TCL_WIDEINT_MAX (((Tcl_WideUInt)Tcl_LongAsWide(-1))>>1) |
| ︙ | ︙ |
Changes to compat/strtoull.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * strtoull.c -- * * Source code for the "strtoull" library procedure. * * Copyright (c) 1988 The Regents of the University of California. * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * strtoull.c -- * * Source code for the "strtoull" library procedure. * * Copyright (c) 1988 The Regents of the University of California. * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: strtoull.c,v 1.7.4.1 2005/06/13 01:45:35 msofer Exp $ */ #include "tclInt.h" #include <ctype.h> /* * The table below is used to convert from ASCII digits to a |
| ︙ | ︙ |
Changes to doc/Async.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Async.3,v 1.8.2.1 2005/06/13 01:45:35 msofer Exp $ '\" .so man.macros .TH Tcl_AsyncCreate 3 7.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_AsyncCreate, Tcl_AsyncMark, Tcl_AsyncInvoke, Tcl_AsyncDelete, Tcl_AsyncReady \- handle asynchronous events .SH SYNOPSIS |
| ︙ | ︙ |
Changes to doc/Backslash.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Backslash.3,v 1.5.4.1 2005/06/13 01:45:35 msofer Exp $ '\" .so man.macros .TH Tcl_Backslash 3 "8.1" Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_Backslash \- parse a backslash sequence .SH SYNOPSIS |
| ︙ | ︙ | |||
26 27 28 29 30 31 32 | If \fIcountPtr\fR isn't NULL, \fI*countPtr\fR gets filled in with number of characters in the backslash sequence, including the backslash character. .BE .SH DESCRIPTION .PP | < < < < | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | If \fIcountPtr\fR isn't NULL, \fI*countPtr\fR gets filled in with number of characters in the backslash sequence, including the backslash character. .BE .SH DESCRIPTION .PP The use of \fBTcl_Backslash\fR is deprecated in favor of \fBTcl_UtfBackslash\fR. .PP This is a utility procedure provided for backwards compatibility with non-internationalized Tcl extensions. It parses a backslash sequence and returns the low byte of the Unicode character corresponding to the sequence. \fBTcl_Backslash\fR modifies \fI*countPtr\fR to contain the number of characters in the backslash sequence. .PP See the Tcl manual entry for information on the valid backslash sequences. All of the sequences described in the Tcl manual entry are supported by \fBTcl_Backslash\fR. .SH "SEE ALSO" Tcl(n), Tcl_UtfBackslash(3) .SH KEYWORDS backslash, parse |
Changes to doc/BoolObj.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | > | | | | < < | < < | < < | | | | | < < | < | | > | > | > | > > | > > | > > | > > > > > > > > > > | > > > | | | < < < | > | | < < < < < | < < > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" Contributions from Don Porter, NIST, 2005. (not subject to US copyright) '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: BoolObj.3,v 1.5.4.1 2005/06/13 01:45:36 msofer Exp $ '\" .so man.macros .TH Tcl_BooleanObj 3 8.5 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj \- store/retrieve boolean value in a Tcl_Obj .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp Tcl_Obj * \fBTcl_NewBooleanObj\fR(\fIboolValue\fR) .sp \fBTcl_SetBooleanObj\fR(\fIobjPtr, boolValue\fR) .sp int \fBTcl_GetBooleanFromObj\fR(\fIinterp, objPtr, boolPtr\fR) .SH ARGUMENTS .AS Tcl_Interp boolValue in/out .AP int boolValue in Integer value to be stored as a boolean value in a Tcl_Obj. .AP Tcl_Obj *objPtr in/out Points to the Tcl_Obj in which to store, or from which to retrieve a boolean value. .AP Tcl_Interp *interp in/out If a boolean value cannot be retrieved, an error message is left in the interpreter's result object unless \fIinterp\fR is NULL. .AP int *boolPtr out Points to place where \fBTcl_GetBooleanFromObj\fR stores the boolean value (0 or 1) obtained from \fIobjPtr\fR. .BE .SH DESCRIPTION .PP These procedures are used to pass boolean values to and from Tcl as Tcl_Obj's. When storing a boolean value into a Tcl_Obj, any non-zero integer value in \fIboolValue\fR is taken to be the boolean value \fB1\fR, and the integer value \fB0\fR is taken to be the boolean value \fB0\fR. .PP \fBTcl_NewBooleanObj\fR creates a new Tcl_Obj, stores the boolean value \fIboolValue\fR in it, and returns a pointer to the new Tcl_Obj. The new Tcl_Obj has reference count of zero. .PP \fBTcl_SetBooleanObj\fR accepts \fIobjPtr\fR, a pointer to an existing Tcl_Obj, and stores in the Tcl_Obj \fI*objPtr\fR the boolean value \fIboolValue\fR. This is a write operation on \fI*objPtr\fR, so \fIobjPtr\fR must be unshared. Attempts to write to a shared Tcl_Obj will panic. A successful write of \fIboolValue\fR into \fI*objPtr\fR implies the freeing of any former value stored in \fI*objPtr\fR. .PP \fBTcl_GetBooleanFromObj\fR attempts to retrive a boolean value from the value stored in \fI*objPtr\fR. If \fIobjPtr\fR holds a string value recognized by \fBTcl_GetBoolean\fR, then the recognized boolean value is written at the address given by \fIboolPtr\fR. If \fIobjPtr\fR holds any value recognized as a number by Tcl, then if that value is zero a 0 is written at the address given by \fIboolPtr\fR and if that value is non-zero a 1 is written at the address given by \fIboolPtr\fR. In all cases where a value is written at the address given by \fIboolPtr\fR, \fBTcl_GetBooleanFromObj\fR returns \fBTCL_OK\fR. If the value of \fIobjPtr\fR does not meet any of the conditions above, then \fBTCL_ERROR\fR is returned and an error message is left in the interpreter's result unless \fIinterp\fR is NULL. \fBTcl_GetBooleanFromObj\fR may also make changes to the internal fields of \fI*objPtr\fR so that future calls to \fBTcl_GetBooleanFromObj\fR on the same \fIobjPtr\fR can be performed more efficiently. .PP Note that the routines \fBTcl_GetBooleanFromObj\fR and \fBTcl_GetBoolean\fR are not functional equivalents. The set of values for which \fBTcl_GetBooleanFromObj\fR will return \fBTCL_OK\fR is strictly larger than the set of values for which \fBTcl_GetBoolean\fR will do the same. For example, the value "5" passed to \fBTcl_GetBooleanFromObj\fR will lead to a \fBTCL_OK\fR return (and the boolean value 1), while the same value passed to \fBTcl_GetBoolean\fR will lead to a \fBTCL_ERROR\fR return. .SH "SEE ALSO" Tcl_NewObj, Tcl_IsShared, Tcl_GetBoolean .SH KEYWORDS boolean, object |
Changes to doc/Concat.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Concat.3,v 1.7.4.1 2005/06/13 01:45:36 msofer Exp $ '\" .so man.macros .TH Tcl_Concat 3 7.5 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_Concat \- concatenate a collection of strings .SH SYNOPSIS |
| ︙ | ︙ | |||
40 41 42 43 44 45 46 | .PP \fBTcl_Concat\fR eliminates leading and trailing white space as it copies strings from \fBargv\fR to the result. If an element of \fBargv\fR consists of nothing but white space, then that string is ignored entirely. This white-space removal was added to make the output of the \fBconcat\fR command cleaner-looking. .PP | < < < | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | .PP \fBTcl_Concat\fR eliminates leading and trailing white space as it copies strings from \fBargv\fR to the result. If an element of \fBargv\fR consists of nothing but white space, then that string is ignored entirely. This white-space removal was added to make the output of the \fBconcat\fR command cleaner-looking. .PP The result string is dynamically allocated using \fBTcl_Alloc\fR; the caller must eventually release the space by calling \fBTcl_Free\fR. .SH "SEE ALSO" Tcl_ConcatObj .SH KEYWORDS concatenate, strings |
Changes to doc/CrtChannel.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" Copyright (c) 1997-2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" Copyright (c) 1997-2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: CrtChannel.3,v 1.27.2.1 2005/06/13 01:45:36 msofer Exp $ .so man.macros .TH Tcl_CreateChannel 3 8.4 Tcl "Tcl Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChannelName, Tcl_GetChannelHandle, Tcl_GetChannelMode, Tcl_GetChannelBufferSize, Tcl_SetChannelBufferSize, Tcl_NotifyChannel, Tcl_BadChannelOption, Tcl_ChannelName, Tcl_ChannelVersion, Tcl_ChannelBlockModeProc, Tcl_ChannelCloseProc, Tcl_ChannelClose2Proc, Tcl_ChannelInputProc, Tcl_ChannelOutputProc, Tcl_ChannelSeekProc, Tcl_ChannelWideSeekProc, Tcl_ChannelTruncateProc, Tcl_ChannelSetOptionProc, Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc, Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc, Tcl_ChannelHandlerProc, Tcl_ChannelThreadActionProc, Tcl_IsChannelShared, Tcl_IsChannelRegistered, Tcl_CutChannel, Tcl_SpliceChannel, Tcl_IsChannelExisting, Tcl_ClearChannelHandlers, Tcl_GetChannelThread, Tcl_ChannelBuffered \- procedures for creating and manipulating channels .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp Tcl_Channel \fBTcl_CreateChannel\fR(\fItypePtr, channelName, instanceData, mask\fR) .sp ClientData \fBTcl_GetChannelInstanceData\fR(\fIchannel\fR) .sp Tcl_ChannelType * \fBTcl_GetChannelType\fR(\fIchannel\fR) .sp const char * \fBTcl_GetChannelName\fR(\fIchannel\fR) .sp int \fBTcl_GetChannelHandle\fR(\fIchannel, direction, handlePtr\fR) .sp Tcl_ThreadId \fBTcl_GetChannelThread\fR(\fIchannel\fR) .sp int \fBTcl_GetChannelMode\fR(\fIchannel\fR) .sp int \fBTcl_GetChannelBufferSize\fR(\fIchannel\fR) .sp \fBTcl_SetChannelBufferSize\fR(\fIchannel, size\fR) .sp \fBTcl_NotifyChannel\fR(\fIchannel, mask\fR) .sp int \fBTcl_BadChannelOption\fR(\fIinterp, optionName, optionList\fR) .sp int \fBTcl_IsChannelShared\fR(\fIchannel\fR) .sp int \fBTcl_IsChannelRegistered\fR(\fIinterp, channel\fR) .sp int \fBTcl_IsChannelExisting\fR(\fIchannelName\fR) .sp void \fBTcl_CutChannel\fR(\fIchannel\fR) .sp void \fBTcl_SpliceChannel\fR(\fIchannel\fR) .sp void \fBTcl_ClearChannelHandlers\fR(\fIchannel\fR) .sp int \fBTcl_ChannelBuffered\fR(\fIchannel\fR) .sp const char * \fBTcl_ChannelName\fR(\fItypePtr\fR) .sp |
| ︙ | ︙ | |||
92 93 94 95 96 97 98 | .sp Tcl_DriverOutputProc * \fBTcl_ChannelOutputProc\fR(\fItypePtr\fR) .sp Tcl_DriverSeekProc * \fBTcl_ChannelSeekProc\fR(\fItypePtr\fR) .sp | < > > > > | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | .sp Tcl_DriverOutputProc * \fBTcl_ChannelOutputProc\fR(\fItypePtr\fR) .sp Tcl_DriverSeekProc * \fBTcl_ChannelSeekProc\fR(\fItypePtr\fR) .sp Tcl_DriverWideSeekProc * \fBTcl_ChannelWideSeekProc\fR(\fItypePtr\fR) .sp Tcl_DriverThreadActionProc * \fBTcl_ChannelThreadActionProc\fR(\fItypePtr\fR) .sp .VS 8.5 Tcl_DriverTruncateProc * \fBTcl_ChannelTruncateProc\fR(\fItypePtr\fR) .VE 8.5 .sp Tcl_DriverSetOptionProc * \fBTcl_ChannelSetOptionProc\fR(\fItypePtr\fR) .sp Tcl_DriverGetOptionProc * \fBTcl_ChannelGetOptionProc\fR(\fItypePtr\fR) .sp |
| ︙ | ︙ | |||
234 235 236 237 238 239 240 | \fBTcl_GetChannelHandle\fR places the OS-specific device handle associated with \fIchannel\fR for the given \fIdirection\fR in the location specified by \fIhandlePtr\fR and returns \fBTCL_OK\fR. If the channel does not have a device handle for the specified direction, then \fBTCL_ERROR\fR is returned instead. Different channel drivers will return different types of handle. Refer to the manual entries for each driver to determine what type of handle is returned. | < < | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | \fBTcl_GetChannelHandle\fR places the OS-specific device handle associated with \fIchannel\fR for the given \fIdirection\fR in the location specified by \fIhandlePtr\fR and returns \fBTCL_OK\fR. If the channel does not have a device handle for the specified direction, then \fBTCL_ERROR\fR is returned instead. Different channel drivers will return different types of handle. Refer to the manual entries for each driver to determine what type of handle is returned. .PP \fBTcl_GetChannelThread\fR returns the id of the thread currently managing the specified \fIchannel\fR. This allows channel drivers to send their file events to the correct event queue even for a multi-threaded core. .PP \fBTcl_GetChannelMode\fR returns an OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR, indicating whether the channel is open for input and output. .PP \fBTcl_GetChannelBufferSize\fR returns the size, in bytes, of buffers allocated to store input or output in \fIchannel\fR. If the value was not set |
| ︙ | ︙ | |||
272 273 274 275 276 277 278 | error message. .PP \fBTcl_ChannelBuffered\fR returns the number of bytes of input currently buffered in the internal buffer (push back area) of the channel itself. It does not report about the data in the overall buffers for the stack of channels the supplied channel is part of. .PP | < | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | error message. .PP \fBTcl_ChannelBuffered\fR returns the number of bytes of input currently buffered in the internal buffer (push back area) of the channel itself. It does not report about the data in the overall buffers for the stack of channels the supplied channel is part of. .PP \fBTcl_IsChannelShared\fR checks the refcount of the specified \fIchannel\fR and returns whether the \fIchannel\fR was shared among multiple interpreters (result == 1) or not (result == 0). .PP \fBTcl_IsChannelRegistered\fR checks whether the specified \fIchannel\fR is registered in the given \fIinterp\fRreter (result == 1) or not (result == 0). |
| ︙ | ︙ | |||
307 308 309 310 311 312 313 | \fBTCL_CHANNEL_VERSION_4\fR (or higher), and \fBTcl_DriverThreadActionProc\fR is defined for it. .VE 8.5 .PP \fBTcl_ClearChannelHandlers\fR removes all channelhandlers and event scripts associated with the specified \fIchannel\fR, thus shutting down all event processing for this channel. | < | | | | | | | | | | | | | | | > | > > < | > | | | 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 |
\fBTCL_CHANNEL_VERSION_4\fR (or higher), and
\fBTcl_DriverThreadActionProc\fR is defined for it.
.VE 8.5
.PP
\fBTcl_ClearChannelHandlers\fR removes all channelhandlers and event
scripts associated with the specified \fIchannel\fR, thus shutting
down all event processing for this channel.
.SH TCL_CHANNELTYPE
.PP
A channel driver provides a \fBTcl_ChannelType\fR structure that contains
pointers to functions that implement the various operations on a channel;
these operations are invoked as needed by the generic layer. The structure
was versioned starting in Tcl 8.3.2/8.4 to correct a problem with stacked
channel drivers. See the \fBOLD CHANNEL TYPES\fR section below for
details about the old structure.
.PP
The \fBTcl_ChannelType\fR structure contains the following fields:
.CS
typedef struct Tcl_ChannelType {
char *\fItypeName\fR;
Tcl_ChannelTypeVersion \fIversion\fR;
Tcl_DriverCloseProc *\fIcloseProc\fR;
Tcl_DriverInputProc *\fIinputProc\fR;
Tcl_DriverOutputProc *\fIoutputProc\fR;
Tcl_DriverSeekProc *\fIseekProc\fR;
Tcl_DriverSetOptionProc *\fIsetOptionProc\fR;
Tcl_DriverGetOptionProc *\fIgetOptionProc\fR;
Tcl_DriverWatchProc *\fIwatchProc\fR;
Tcl_DriverGetHandleProc *\fIgetHandleProc\fR;
Tcl_DriverClose2Proc *\fIclose2Proc\fR;
Tcl_DriverBlockModeProc *\fIblockModeProc\fR;
Tcl_DriverFlushProc *\fIflushProc\fR;
Tcl_DriverHandlerProc *\fIhandlerProc\fR;
Tcl_DriverWideSeekProc *\fIwideSeekProc\fR;
.VS 8.5
Tcl_DriverThreadActionProc *\fIthreadActionProc\fR;
Tcl_DriverTruncateProc *\fItruncateProc\fR;
.VE 8.5
} Tcl_ChannelType;
.CE
.PP
The driver must provide implementations for all functions except
\fIblockModeProc\fR, \fIseekProc\fR, \fIsetOptionProc\fR,
\fIgetOptionProc\fR, and \fIclose2Proc\fR, which may be specified as
NULL. Other functions that can not be implemented for this type of
device should return \fBEINVAL\fR when invoked to indicate that they
are not implemented, except in the case of \fIflushProc\fR and
\fIhandlerProc\fR, which should specified as NULL if not otherwise defined.
.PP
The user should only use the above structure for \fBTcl_ChannelType\fR
instantiation. When referencing fields in a \fBTcl_ChannelType\fR
structure, the following functions should be used to obtain the values:
\fBTcl_ChannelName\fR, \fBTcl_ChannelVersion\fR,
\fBTcl_ChannelBlockModeProc\fR, \fBTcl_ChannelCloseProc\fR,
\fBTcl_ChannelClose2Proc\fR, \fBTcl_ChannelInputProc\fR,
\fBTcl_ChannelOutputProc\fR, \fBTcl_ChannelSeekProc\fR,
\fBTcl_ChannelWideSeekProc\fR, \fBTcl_ChannelThreadActionProc\fR,
.VS 8.5
\fBTcl_ChannelTruncateProc\fR,
.VE 8.5
\fBTcl_ChannelSetOptionProc\fR, \fBTcl_ChannelGetOptionProc\fR,
\fBTcl_ChannelWatchProc\fR, \fBTcl_ChannelGetHandleProc\fR,
\fBTcl_ChannelFlushProc\fR, or \fBTcl_ChannelHandlerProc\fR.
.PP
The change to the structures was made in such a way that standard channel
types are binary compatible. However, channel types that use stacked
channels (i.e. TLS, Trf) have new versions to correspond to the above change
|
| ︙ | ︙ | |||
379 380 381 382 383 384 385 | This value can be retrieved with \fBTcl_ChannelName\fR, which returns a pointer to the string. .SS VERSION .PP The \fIversion\fR field should be set to the version of the structure that you require. \fBTCL_CHANNEL_VERSION_2\fR is the minimum recommended. | < < > | > | | | > | 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 | This value can be retrieved with \fBTcl_ChannelName\fR, which returns a pointer to the string. .SS VERSION .PP The \fIversion\fR field should be set to the version of the structure that you require. \fBTCL_CHANNEL_VERSION_2\fR is the minimum recommended. \fBTCL_CHANNEL_VERSION_3\fR must be set to specifiy the \fIwideSeekProc\fR member. .VS 8.5 \fBTCL_CHANNEL_VERSION_4\fR must be set to specifiy the \fIthreadActionProc\fR and \fItruncateProc\fR members (includes \fIwideSeekProc\fR). .VE 8.5 If it is not set to any of these, then this \fBTcl_ChannelType\fR is assumed to have the original structure. See \fBOLD CHANNEL TYPES\fR for more details. While Tcl will recognize and function with either structures, stacked channels must be of at least \fBTCL_CHANNEL_VERSION_2\fR to function correctly. .PP This value can be retrieved with \fBTcl_ChannelVersion\fR, which returns one of .VS 8.5 \fBTCL_CHANNEL_VERSION_4\fR, .VE 8.5 \fBTCL_CHANNEL_VERSION_3\fR, \fBTCL_CHANNEL_VERSION_2\fR or \fBTCL_CHANNEL_VERSION_1\fR. .SS BLOCKMODEPROC .PP The \fIblockModeProc\fR field contains the address of a function called by the generic layer to set blocking and nonblocking mode on the device. \fIBlockModeProc\fR should match the following prototype: .PP |
| ︙ | ︙ | |||
596 597 598 599 600 601 602 | function should set this variable to a POSIX error code if an error occurs. The function should store an \fBEINVAL\fR error code if the channel type does not implement seeking. .PP The return value is the new access point or -1 in case of error. If an error occurred, the function should not move the access point. .PP | < | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | function should set this variable to a POSIX error code if an error occurs. The function should store an \fBEINVAL\fR error code if the channel type does not implement seeking. .PP The return value is the new access point or -1 in case of error. If an error occurred, the function should not move the access point. .PP If there is a non-NULL \fIseekProc\fR field, the \fIwideSeekProc\fR field may contain the address of an alternative function to use which handles wide (i.e. larger than 32-bit) offsets, so allowing seeks within files larger than 2GB. The \fIwideSeekProc\fR will be called in preference to the \fIseekProc\fR, but both must be defined if the \fIwideSeekProc\fR is defined. \fIWideSeekProc\fR must match the following prototype: |
| ︙ | ︙ | |||
621 622 623 624 625 626 627 | \fIseekProc\fR above, except that the type of offsets and the return type are different. .PP The \fIseekProc\fR value can be retrieved with \fBTcl_ChannelSeekProc\fR, which returns a pointer to the function, and similarly the \fIwideSeekProc\fR can be retrieved with \fBTcl_ChannelWideSeekProc\fR. | < | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | \fIseekProc\fR above, except that the type of offsets and the return type are different. .PP The \fIseekProc\fR value can be retrieved with \fBTcl_ChannelSeekProc\fR, which returns a pointer to the function, and similarly the \fIwideSeekProc\fR can be retrieved with \fBTcl_ChannelWideSeekProc\fR. .SS SETOPTIONPROC .PP The \fIsetOptionProc\fR field contains the address of a function called by the generic layer to set a channel type specific option on a channel. \fIsetOptionProc\fR must match the following prototype: .PP .CS |
| ︙ | ︙ | |||
796 797 798 799 800 801 802 | when this channel was created. The \fIinterestMask\fR is an OR-ed combination of \fBTCL_READABLE\fR or \fBTCL_WRITABLE\fR; it indicates what type of event occurred on this channel. .PP This value can be retrieved with \fBTcl_ChannelHandlerProc\fR, which returns a pointer to the function. | < | | > | | > > > > > > > > > > > > > > > > > | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
when this channel was created. The \fIinterestMask\fR is an OR-ed
combination of \fBTCL_READABLE\fR or \fBTCL_WRITABLE\fR; it indicates what
type of event occurred on this channel.
.PP
This value can be retrieved with \fBTcl_ChannelHandlerProc\fR, which returns
a pointer to the function.
.SS "THREADACTIONPROC"
.PP
The \fIthreadActionProc\fR field contains the address of the function
called by the generic layer when a channel is created, closed, or
going to move to a different thread, i.e. whenever thread-specific
driver state might have to initialized or updated. It can be NULL.
The action \fITCL_CHANNEL_THREAD_REMOVE\fR is used to notify the
driver that it should update or remove any thread-specific data it
might be maintaining for the channel.
.PP
The action \fITCL_CHANNEL_THREAD_INSERT\fR is used to notify the
driver that it should update or initialize any thread-specific data it
might be maintaining using the calling thread as the associate. See
\fBTcl_CutChannel\fR and \fBTcl_SpliceChannel\fR for more detail.
.PP
.CS
typedef void Tcl_DriverThreadActionProc(
ClientData \fIinstanceData\fR,
int \fIaction\fR);
.CE
.PP
\fIInstanceData\fR is the same as the value passed to
\fBTcl_CreateChannel\fR when this channel was created.
.PP
These values can be retrieved with \fBTcl_ChannelThreadActionProc\fR,
which returns a pointer to the function.
.SS "TRUNCATEPROC"
.PP
The \fItruncateProc\fR field contains the address of the function
called by the generic layer when a channel is truncated to some
length. It can be NULL.
.PP
.CS
typedef int Tcl_DriverTruncateProc(
ClientData \fIinstanceData\fR,
Tcl_WideInt \fIlength\fR);
.CE
.PP
\fIInstanceData\fR is the same as the value passed to
\fBTcl_CreateChannel\fR when this channel was created, and
\fIlength\fR is the new length of the underlying file, which should
not be negative. The result should be 0 on success or an errno code
(suitable for use with \fBTcl_SetErrno\fR) on failure.
.PP
These values can be retrieved with \fBTcl_ChannelTruncateProc\fR,
which returns a pointer to the function.
.SH TCL_BADCHANNELOPTION
.PP
This procedure generates a "bad option" error message in an
(optional) interpreter. It is used by channel drivers when
an invalid Set/Get option is requested. Its purpose is to concatenate
the generic options list to the specific ones and factorize
the generic options error message string.
|
| ︙ | ︙ | |||
880 881 882 883 884 885 886 | .PP It is still possible to create channel with the above structure. The internal channel code will determine the version. It is imperative to use the new \fBTcl_ChannelType\fR structure if you are creating a stacked channel driver, due to problems with the earlier stacked channel implementation (in 8.2.0 to 8.3.1). .PP | < > < | 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 |
.PP
It is still possible to create channel with the above structure. The
internal channel code will determine the version. It is imperative to use
the new \fBTcl_ChannelType\fR structure if you are creating a stacked
channel driver, due to problems with the earlier stacked channel
implementation (in 8.2.0 to 8.3.1).
.PP
Prior to 8.4.0 (i.e. during the later releases of 8.3 and early part
of the 8.4 development cycle) the \fBTcl_ChannelType\fR structure
contained the following fields:
.PP
.CS
typedef struct Tcl_ChannelType {
char *\fItypeName\fR;
Tcl_ChannelTypeVersion \fIversion\fR;
Tcl_DriverCloseProc *\fIcloseProc\fR;
Tcl_DriverInputProc *\fIinputProc\fR;
Tcl_DriverOutputProc *\fIoutputProc\fR;
Tcl_DriverSeekProc *\fIseekProc\fR;
Tcl_DriverSetOptionProc *\fIsetOptionProc\fR;
Tcl_DriverGetOptionProc *\fIgetOptionProc\fR;
Tcl_DriverWatchProc *\fIwatchProc\fR;
Tcl_DriverGetHandleProc *\fIgetHandleProc\fR;
Tcl_DriverClose2Proc *\fIclose2Proc\fR;
Tcl_DriverBlockModeProc *\fIblockModeProc\fR;
Tcl_DriverFlushProc *\fIflushProc\fR;
Tcl_DriverHandlerProc *\fIhandlerProc\fR;
Tcl_DriverTruncateProc *\fItruncateProc\fR;
} Tcl_ChannelType;
.CE
.PP
When the above structure is registered as a channel type, the
\fIversion\fR field should always be \fBTCL_CHANNEL_VERSION_2\fR.
.SH "SEE ALSO"
Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3), Tcl_QueueEvent(3), Tcl_StackChannel(3), Tcl_GetStdChannel(3)
.SH KEYWORDS
blocking, channel driver, channel registration, channel type, nonblocking
|
Changes to doc/CrtCommand.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: CrtCommand.3,v 1.10.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_CreateCommand 3 "" Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_CreateCommand \- implement new commands in C .SH SYNOPSIS |
| ︙ | ︙ | |||
91 92 93 94 95 96 97 | data structure that describes what to do when the command procedure is invoked. \fIArgc\fR and \fIargv\fR describe the arguments to the command, \fIargc\fR giving the number of arguments (including the command name) and \fIargv\fR giving the values of the arguments as strings. The \fIargv\fR array will contain \fIargc\fR+1 values; the first \fIargc\fR values point to the argument strings, and the last value is NULL. | < < < < | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | data structure that describes what to do when the command procedure is invoked. \fIArgc\fR and \fIargv\fR describe the arguments to the command, \fIargc\fR giving the number of arguments (including the command name) and \fIargv\fR giving the values of the arguments as strings. The \fIargv\fR array will contain \fIargc\fR+1 values; the first \fIargc\fR values point to the argument strings, and the last value is NULL. Note that the argument strings should not be modified as they may point to constant strings or may be shared with other parts of the interpreter. .PP Note that the argument strings are encoded in normalized UTF-8 since version 8.1 of Tcl. .PP \fIProc\fR must return an integer code that is expected to be one of \fBTCL_OK\fR, \fBTCL_ERROR\fR, \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR. See the Tcl overview man page for details on what these codes mean. Most normal commands will only return \fBTCL_OK\fR or \fBTCL_ERROR\fR. In addition, \fIproc\fR must set the interpreter result to point to a string value; |
| ︙ | ︙ |
Changes to doc/CrtFileHdlr.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: CrtFileHdlr.3,v 1.3.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_CreateFileHandler 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_CreateFileHandler, Tcl_DeleteFileHandler \- associate procedure callbacks with files or devices (Unix only) .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp \fBTcl_CreateFileHandler\fR(\fIfd, mask, proc, clientData\fR) .sp \fBTcl_DeleteFileHandler\fR(\fIfd\fR) .SH ARGUMENTS .AS Tcl_FileProc clientData .AP int fd in Unix file descriptor for an open file or device. .AP int mask in Conditions under which \fIproc\fR should be called: OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR, and \fBTCL_EXCEPTION\fR. May be set to 0 to temporarily disable a handler. .AP Tcl_FileProc *proc in Procedure to invoke whenever the file or device indicated by \fIfile\fR meets the conditions specified by \fImask\fR. .AP ClientData clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION .PP \fBTcl_CreateFileHandler\fR arranges for \fIproc\fR to be invoked in the future whenever I/O becomes possible on a file or an exceptional condition exists for the file. The file is indicated by \fIfd\fR, and the conditions of interest are indicated by \fImask\fR. For example, if \fImask\fR is \fBTCL_READABLE\fR, \fIproc\fR will be called when the file is readable. The callback to \fIproc\fR is made by \fBTcl_DoOneEvent\fR, so \fBTcl_CreateFileHandler\fR is only useful in programs that dispatch events through \fBTcl_DoOneEvent\fR or through Tcl commands such as \fBvwait\fR. |
| ︙ | ︙ | |||
85 86 87 88 89 90 91 | correctly, the application may need to use non-blocking I/O operations on the files for which handlers are declared. Otherwise the application may block if it reads or writes too much data; while waiting for the I/O to complete the application won't be able to service other events. Use \fBTcl_SetChannelOption\fR with \fB\-blocking\fR to set the channel into blocking or nonblocking mode as required. .PP | < < | 81 82 83 84 85 86 87 88 89 90 91 92 | correctly, the application may need to use non-blocking I/O operations on the files for which handlers are declared. Otherwise the application may block if it reads or writes too much data; while waiting for the I/O to complete the application won't be able to service other events. Use \fBTcl_SetChannelOption\fR with \fB\-blocking\fR to set the channel into blocking or nonblocking mode as required. .PP Note that these interfaces are only supported by the Unix implementation of the Tcl notifier. .SH KEYWORDS callback, file, handler |
Changes to doc/CrtMathFnc.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
'\"
'\" Copyright (c) 1989-1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: CrtMathFnc.3,v 1.11.4.1 2005/06/13 01:45:37 msofer Exp $
'\"
.so man.macros
.TH Tcl_CreateMathFunc 3 8.4 Tcl "Tcl Library Procedures"
.BS
.SH NAME
Tcl_CreateMathFunc, Tcl_GetMathFuncInfo, Tcl_ListMathFuncs \- Define, query and enumerate math functions for expressions
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
.sp
void
\fBTcl_CreateMathFunc\fR(\fIinterp, name, numArgs, argTypes, proc, clientData\fR)
.sp
int
\fBTcl_GetMathFuncInfo\fR(\fIinterp, name, numArgsPtr, argTypesPtr, procPtr,
clientDataPtr\fR)
.sp
Tcl_Obj *
\fBTcl_ListMathFuncs\fR(\fIinterp, pattern\fR)
.SH ARGUMENTS
.AS Tcl_ValueType *clientDataPtr out
.AP Tcl_Interp *interp in
Interpreter in which new function will be defined.
.AP "const char" *name in
Name for new function.
.AP int numArgs in
|
| ︙ | ︙ | |||
62 63 64 65 66 67 68 | passing to \fITcl_StringMatch\fR), or NULL to not apply any filter. .BE .SH DESCRIPTION .PP Tcl allows a number of mathematical functions to be used in expressions, such as \fBsin\fR, \fBcos\fR, and \fBhypot\fR. | > > | > > > > > | > | < < < < < < < < < | > | | | > > > < | | 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 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 |
passing to \fITcl_StringMatch\fR), or NULL to not apply any filter.
.BE
.SH DESCRIPTION
.PP
Tcl allows a number of mathematical functions to be used in
expressions, such as \fBsin\fR, \fBcos\fR, and \fBhypot\fR.
These functions are represented by commands in the namespace,
\fBtcl::mathfunc\fR. The \fBTcl_CreateMathFunc\fR function is
an obsolete way for applications to add additional functions
to those already provided by Tcl or to replace existing functions.
It should not be used by new applications, which should create
math functions using \fBTcl_CreateObjCommand\fR to create a command
in the \fBtcl::mathfunc\fR namespace.
.PP
In the \fBTcl_CreateMathFunc\fR interface,
\fIName\fR is the name of the function as it will appear in expressions.
If \fIname\fR doesn't already exist in the \fB::tcl::mathfunc\fR
namespace, then a new command is created in that namespace.
If \fIname\fR does exist, then the existing function is replaced.
\fINumArgs\fR and \fIargTypes\fR describe the arguments to the function.
Each entry in the \fIargTypes\fR array must be
one of \fBTCL_INT\fR, \fBTCL_DOUBLE\fR, \fBTCL_WIDE_INT\fR,
or \fBTCL_EITHER\fR to indicate whether the corresponding argument must be an
integer, a double-precision floating value, a wide (64-bit) integer,
or any, respectively.
.PP
Whenever the function is invoked in an expression Tcl will invoke
\fIproc\fR. \fIProc\fR should have arguments and result that match
the type \fBTcl_MathProc\fR:
.CS
typedef int Tcl_MathProc(
ClientData \fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
Tcl_Value *\fIargs\fR,
Tcl_Value *\fIresultPtr\fR);
.CE
.PP
When \fIproc\fR is invoked the \fIclientData\fR and \fIinterp\fR
arguments will be the same as those passed to \fBTcl_CreateMathFunc\fR.
\fIArgs\fR will point to an array of \fInumArgs\fR Tcl_Value structures,
which describe the actual arguments to the function:
.CS
typedef struct Tcl_Value {
Tcl_ValueType \fItype\fR;
long \fIintValue\fR;
double \fIdoubleValue\fR;
Tcl_WideInt \fIwideValue\fR;
} Tcl_Value;
.CE
.PP
The \fItype\fR field indicates the type of the argument and is
one of \fBTCL_INT\fR, \fBTCL_DOUBLE\fR or \fBTCL_WIDE_INT\fR.
It will match the \fIargTypes\fR value specified for the function unless
the \fIargTypes\fR value was \fBTCL_EITHER\fR. Tcl converts
the argument supplied in the expression to the type requested in
\fIargTypes\fR, if that is necessary.
Depending on the value of the \fItype\fR field, the \fIintValue\fR,
\fIdoubleValue\fR or \fIwideValue\fR
field will contain the actual value of the argument.
.PP
\fIProc\fR should compute its result and store it either as an integer
in \fIresultPtr->intValue\fR or as a floating value in
\fIresultPtr->doubleValue\fR.
It should set also \fIresultPtr->type\fR to one of
\fBTCL_INT\fR, \fBTCL_DOUBLE\fR or \fBTCL_WIDE_INT\fR
to indicate which value was set.
Under normal circumstances \fIproc\fR should return \fBTCL_OK\fR.
If an error occurs while executing the function, \fIproc\fR should
return \fBTCL_ERROR\fR and leave an error message in the interpreter's result.
.PP
\fBTcl_GetMathFuncInfo\fR retrieves the values associated with
function \fIname\fR that were passed to a preceding
\fBTcl_CreateMathFunc\fR call. Normally, the return code is
\fBTCL_OK\fR but if the named function does not exist, \fBTCL_ERROR\fR
is returned and an error message is placed in the interpreter's
result.
.PP
If an error did not occur, the array reference placed in the variable
pointed to by \fIargTypesPtr\fR is newly allocated, and should be
released by passing it to \fBTcl_Free\fR. Some functions (the
standard set implemented in the core, and those defined by placing
commands in the \fBtcl::mathfunc\fR namespace) do not have
argument type information; attempting to retrieve values for
them causes a NULL to be stored in the variable pointed to by
\fIprocPtr\fR and the variable pointed to by \fIclientDataPtr\fR
will not be modified. The variable pointed to by \fInumArgsPointer\fR
will contain -1, and no argument types will be stored in the variable
pointed to by \fIargTypesPointer\fR.
.PP
\fBTcl_ListMathFuncs\fR returns a Tcl object containing a list of all
the math functions defined in the interpreter whose name matches
\fIpattern\fR. In the case of an error, NULL is returned and an error
message is left in the interpreter result, and otherwise the returned
object will have a reference count of zero.
.SH KEYWORDS
expression, mathematical function
.SH "SEE ALSO"
expr(n), info(n), Tcl_CreateObjCommand(3), Tcl_Free(3), Tcl_NewListObj(3)
|
Changes to doc/CrtObjCmd.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: CrtObjCmd.3,v 1.11.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_CreateObjCommand 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_CreateObjCommand, Tcl_DeleteCommand, Tcl_DeleteCommandFromToken, Tcl_GetCommandInfo, Tcl_GetCommandInfoFromToken, Tcl_SetCommandInfo, Tcl_SetCommandInfoFromToken, Tcl_GetCommandName, Tcl_GetCommandFullName, Tcl_GetCommandFromObj \- implement new commands in C .SH SYNOPSIS |
| ︙ | ︙ | |||
26 27 28 29 30 31 32 | .sp int \fBTcl_GetCommandInfo\fR(\fIinterp, cmdName, infoPtr\fR) .sp int \fBTcl_SetCommandInfo\fR(\fIinterp, cmdName, infoPtr\fR) .sp | < < < < | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | .sp int \fBTcl_GetCommandInfo\fR(\fIinterp, cmdName, infoPtr\fR) .sp int \fBTcl_SetCommandInfo\fR(\fIinterp, cmdName, infoPtr\fR) .sp int \fBTcl_GetCommandInfoFromToken\fR(\fItoken, infoPtr\fR) .sp int \fBTcl_SetCommandInfoFromToken\fR(\fItoken, infoPtr\fR) .sp const char * \fBTcl_GetCommandName\fR(\fIinterp, token\fR) .sp void \fBTcl_GetCommandFullName\fR(\fIinterp, token, objPtr\fR) .sp Tcl_Command \fBTcl_GetCommandFromObj\fR(\fIinterp, objPtr\fR) |
| ︙ | ︙ | |||
95 96 97 98 99 100 101 |
\fIproc\fR should have arguments and result that match the type
\fBTcl_ObjCmdProc\fR:
.CS
typedef int Tcl_ObjCmdProc(
ClientData \fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIobjc\fR,
| < | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
\fIproc\fR should have arguments and result that match the type
\fBTcl_ObjCmdProc\fR:
.CS
typedef int Tcl_ObjCmdProc(
ClientData \fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIobjc\fR,
Tcl_Obj *const \fIobjv\fR[]);
.CE
When \fIproc\fR is invoked, the \fIclientData\fR and \fIinterp\fR parameters
will be copies of the \fIclientData\fR and \fIinterp\fR arguments given to
\fBTcl_CreateObjCommand\fR. Typically, \fIclientData\fR points to an
application-specific data structure that describes what to do when the
command procedure is invoked. \fIObjc\fR and \fIobjv\fR describe the
|
| ︙ | ︙ | |||
121 122 123 124 125 126 127 | compilers to report any such attempted assignment as an error. However, it is acceptable to modify the internal representation of any individual object argument. For instance, the user may call \fBTcl_GetIntFromObj\fR on \fIobjv\fR[\fB2\fR] to obtain the integer representation of that object; that call may change the type of the object that \fIobjv\fR[\fB2\fR] points at, but will not change where \fIobjv\fR[\fB2\fR] points. | < | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | compilers to report any such attempted assignment as an error. However, it is acceptable to modify the internal representation of any individual object argument. For instance, the user may call \fBTcl_GetIntFromObj\fR on \fIobjv\fR[\fB2\fR] to obtain the integer representation of that object; that call may change the type of the object that \fIobjv\fR[\fB2\fR] points at, but will not change where \fIobjv\fR[\fB2\fR] points. .PP \fIproc\fR must return an integer code that is either \fBTCL_OK\fR, \fBTCL_ERROR\fR, \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR. See the Tcl overview man page for details on what these codes mean. Most normal commands will only return \fBTCL_OK\fR or \fBTCL_ERROR\fR. In addition, if \fIproc\fR needs to return a non-empty result, |
| ︙ | ︙ |
Changes to doc/CrtSlave.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: CrtSlave.3,v 1.15.2.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_CreateSlave 3 7.6 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_IsSafe, Tcl_MakeSafe, Tcl_CreateSlave, Tcl_GetSlave, Tcl_GetMaster, Tcl_GetInterpPath, Tcl_CreateAlias, Tcl_CreateAliasObj, Tcl_GetAlias, Tcl_GetAliasObj, Tcl_ExposeCommand, Tcl_HideCommand \- manage multiple Tcl interpreters, aliases and hidden commands .SH SYNOPSIS |
| ︙ | ︙ |
Changes to doc/DString.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: DString.3,v 1.11.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_DString 3 7.4 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_DStringInit, Tcl_DStringAppend, Tcl_DStringAppendElement, Tcl_DStringStartSublist, Tcl_DStringEndSublist, Tcl_DStringLength, Tcl_DStringValue, Tcl_DStringSetLength, Tcl_DStringTrunc, Tcl_DStringFree, Tcl_DStringResult, Tcl_DStringGetResult \- manipulate dynamic strings .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp \fBTcl_DStringInit\fR(\fIdsPtr\fR) .sp char * \fBTcl_DStringAppend\fR(\fIdsPtr, bytes, length\fR) .sp char * \fBTcl_DStringAppendElement\fR(\fIdsPtr, element\fR) .sp \fBTcl_DStringStartSublist\fR(\fIdsPtr\fR) .sp \fBTcl_DStringEndSublist\fR(\fIdsPtr\fR) .sp int \fBTcl_DStringLength\fR(\fIdsPtr\fR) |
| ︙ | ︙ | |||
43 44 45 46 47 48 49 | \fBTcl_DStringResult\fR(\fIinterp, dsPtr\fR) .sp \fBTcl_DStringGetResult\fR(\fIinterp, dsPtr\fR) .SH ARGUMENTS .AS Tcl_DString newLength in/out .AP Tcl_DString *dsPtr in/out Pointer to structure that is used to manage a dynamic string. | | | > > | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | \fBTcl_DStringResult\fR(\fIinterp, dsPtr\fR) .sp \fBTcl_DStringGetResult\fR(\fIinterp, dsPtr\fR) .SH ARGUMENTS .AS Tcl_DString newLength in/out .AP Tcl_DString *dsPtr in/out Pointer to structure that is used to manage a dynamic string. .AP "const char" *bytes in Pointer to characters to append to dynamic string. .AP "const char" *element in Pointer to characters to append as list element to dynamic string. .AP int length in Number of bytes from \fIbytes\fR to add to dynamic string. If -1, add all characters up to null terminating character. .AP int newLength in New length for dynamic string, not including null terminating character. .AP Tcl_Interp *interp in/out Interpreter whose result is to be set from or moved to the dynamic string. |
| ︙ | ︙ | |||
73 74 75 76 77 78 79 | anything already in it is discarded. If the structure has been used previously, \fBTcl_DStringFree\fR should be called first to free up any memory allocated for the old string. .PP \fBTcl_DStringAppend\fR adds new information to a dynamic string, allocating more memory for the string if needed. | | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
anything already in it is discarded.
If the structure has been used previously, \fBTcl_DStringFree\fR should
be called first to free up any memory allocated for the old
string.
.PP
\fBTcl_DStringAppend\fR adds new information to a dynamic string,
allocating more memory for the string if needed.
If \fIlength\fR is less than zero then everything in \fIbytes\fR
is appended to the dynamic string; otherwise \fIlength\fR
specifies the number of bytes to append.
\fBTcl_DStringAppend\fR returns a pointer to the characters of
the new string. The string can also be retrieved from the
\fIstring\fR field of the Tcl_DString structure.
.PP
\fBTcl_DStringAppendElement\fR is similar to \fBTcl_DStringAppend\fR
except that it doesn't take a \fIlength\fR argument (it appends
all of \fIelement\fR) and it converts the string to a proper list element
before appending.
\fBTcl_DStringAppendElement\fR adds a separator space before the
new list element unless the new list element is the first in a
list or sub-list (i.e. either the current string is empty, or it
contains the single character ``{'', or the last two characters of
the current string are `` {'').
\fBTcl_DStringAppendElement\fR returns a pointer to the
|
| ︙ | ︙ |
Changes to doc/Ensemble.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 2005 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 2005 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Ensemble.3,v 1.1.6.1 2005/06/13 01:45:37 msofer Exp $ '\" '\" This documents the C API introduced in TIP#235 '\" .so man.macros .TH Tcl_Ensemble 3 8.5 Tcl "Tcl Library Procedures" .BS .SH NAME |
| ︙ | ︙ |
Changes to doc/Environment.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1997-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | '\" '\" Copyright (c) 1997-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Environment.3,v 1.4.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_PutEnv 3 "7.5" Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_PutEnv \- procedures to manipulate the environment .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp int \fBTcl_PutEnv\fR(\fIassignment\fR) .SH ARGUMENTS .AS "const char" *assignment .AP "const char" *assignnment in Info about environment variable in the format NAME=value. The \fIassignment\fR argument is in the system encoding. .BE .SH DESCRIPTION .PP \fBTcl_PutEnv\fR sets an environment variable. The information is passed in a single string of the form NAME=value. This procedure is intended to be a stand-in for the UNIX \fBputenv\fR system call. All |
| ︙ | ︙ |
Changes to doc/Eval.3.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" Copyright (c) 2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" Copyright (c) 2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Eval.3,v 1.18.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_Eval 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_EvalObjEx, Tcl_EvalFile, Tcl_EvalObjv, Tcl_Eval, Tcl_EvalEx, Tcl_GlobalEval, Tcl_GlobalEvalObj, Tcl_VarEval, Tcl_VarEvalVA \- execute Tcl scripts .SH SYNOPSIS |
| ︙ | ︙ | |||
35 36 37 38 39 40 41 | int \fBTcl_GlobalEval\fR(\fIinterp, script\fR) .sp int \fBTcl_GlobalEvalObj\fR(\fIinterp, objPtr\fR) .sp int | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | int \fBTcl_GlobalEval\fR(\fIinterp, script\fR) .sp int \fBTcl_GlobalEvalObj\fR(\fIinterp, objPtr\fR) .sp int \fBTcl_VarEval\fR(\fIinterp, part, part, ... \fB(char *) NULL\fR) .sp int \fBTcl_VarEvalVA\fR(\fIinterp, argList\fR) .SH ARGUMENTS .AS Tcl_Interp **termPtr .AP Tcl_Interp *interp in Interpreter in which to execute the script. The interpreter's result is |
| ︙ | ︙ | |||
63 64 65 66 67 68 69 | value of a single word in the command to execute. .AP int numBytes in The number of bytes in \fIscript\fR, not including any null terminating character. If \-1, then all characters up to the first null byte are used. .AP "const char" *script in Points to first byte of script to execute (null-terminated and UTF-8). | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | value of a single word in the command to execute. .AP int numBytes in The number of bytes in \fIscript\fR, not including any null terminating character. If \-1, then all characters up to the first null byte are used. .AP "const char" *script in Points to first byte of script to execute (null-terminated and UTF-8). .AP char *part in String forming part of a Tcl script. .AP va_list argList in An argument list which must have been initialized using \fBTCL_VARARGS_START\fR, and cleared using \fBva_end\fR. .BE .SH DESCRIPTION |
| ︙ | ︙ | |||
96 97 98 99 100 101 102 | result; it can be retrieved using \fBTcl_GetObjResult\fR. .PP \fBTcl_EvalFile\fR reads the file given by \fIfileName\fR and evaluates its contents as a Tcl script. It returns the same information as \fBTcl_EvalObjEx\fR. If the file couldn't be read then a Tcl error is returned to describe why the file couldn't be read. | < < | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | result; it can be retrieved using \fBTcl_GetObjResult\fR. .PP \fBTcl_EvalFile\fR reads the file given by \fIfileName\fR and evaluates its contents as a Tcl script. It returns the same information as \fBTcl_EvalObjEx\fR. If the file couldn't be read then a Tcl error is returned to describe why the file couldn't be read. The eofchar for files is '\\32' (^Z) for all platforms. If you require a ``^Z'' in code for string comparison, you can use ``\\032'' or ``\\u001a'', which will be safely substituted by the Tcl interpreter into ``^Z''. .PP \fBTcl_EvalObjv\fR executes a single pre-parsed command instead of a script. The \fIobjc\fR and \fIobjv\fR arguments contain the values of the words for the Tcl command, one word in each object in \fIobjv\fR. \fBTcl_EvalObjv\fR evaluates the command and returns a completion code and result just like \fBTcl_EvalObjEx\fR. .PP |
| ︙ | ︙ |
Changes to doc/ExprLong.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: ExprLong.3,v 1.9.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_ExprLong 3 7.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString \- evaluate an expression .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp int \fBTcl_ExprLong\fR(\fIinterp, expr, longPtr\fR) .sp int \fBTcl_ExprDouble\fR(\fIinterp, expr, doublePtr\fR) .sp int \fBTcl_ExprBoolean\fR(\fIinterp, expr, booleanPtr\fR) .sp int \fBTcl_ExprString\fR(\fIinterp, expr\fR) .SH ARGUMENTS .AS Tcl_Interp *booleanPtr out .AP Tcl_Interp *interp in Interpreter in whose context to evaluate \fIexpr\fR. .AP "const char" *expr in Expression to be evaluated. .AP long *longPtr out Pointer to location in which to store the integer value of the expression. .AP int *doublePtr out Pointer to location in which to store the floating-point value of the expression. .AP int *booleanPtr out Pointer to location in which to store the 0/1 boolean value of the expression. .BE .SH DESCRIPTION .PP These four procedures all evaluate the expression given by the \fIexpr\fR argument and return the result in one of four different forms. The expression can have any of the forms accepted by the \fBexpr\fR command. Note that these procedures have been largely replaced by the object-based procedures \fBTcl_ExprLongObj\fR, \fBTcl_ExprDoubleObj\fR, \fBTcl_ExprBooleanObj\fR, and \fBTcl_ExprObj\fR. Those object-based procedures evaluate an expression held in a Tcl object instead of a string. |
| ︙ | ︙ | |||
92 93 94 95 96 97 98 | the value was zero and 1 otherwise. If the expression's actual value is a non-numeric string then it must be one of the values accepted by \fBTcl_GetBoolean\fR such as ``yes'' or ``no'', or else an error occurs. .PP \fBTcl_ExprString\fR returns the value of the expression as a string stored in the interpreter's result. | < < < < < < | 92 93 94 95 96 97 98 99 100 101 102 103 104 | the value was zero and 1 otherwise. If the expression's actual value is a non-numeric string then it must be one of the values accepted by \fBTcl_GetBoolean\fR such as ``yes'' or ``no'', or else an error occurs. .PP \fBTcl_ExprString\fR returns the value of the expression as a string stored in the interpreter's result. .SH "SEE ALSO" Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj .SH KEYWORDS boolean, double, evaluate, expression, integer, object, string |
Changes to doc/ExprLongObj.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: ExprLongObj.3,v 1.3.18.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_ExprLongObj 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj \- evaluate an expression .SH SYNOPSIS |
| ︙ | ︙ | |||
25 26 27 28 29 30 31 | \fBTcl_ExprBooleanObj\fR(\fIinterp, objPtr, booleanPtr\fR) .sp int \fBTcl_ExprObj\fR(\fIinterp, objPtr, resultPtrPtr\fR) .SH ARGUMENTS .AS Tcl_Interp **resultPtrPtr out .AP Tcl_Interp *interp in | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | \fBTcl_ExprBooleanObj\fR(\fIinterp, objPtr, booleanPtr\fR) .sp int \fBTcl_ExprObj\fR(\fIinterp, objPtr, resultPtrPtr\fR) .SH ARGUMENTS .AS Tcl_Interp **resultPtrPtr out .AP Tcl_Interp *interp in Interpreter in whose context to evaluate \fIobjPtr\fR. .AP Tcl_Obj *objPtr in Pointer to an object containing the expression to evaluate. .AP long *longPtr out Pointer to location in which to store the integer value of the expression. .AP int *doublePtr out Pointer to location in which to store the floating-point value of the |
| ︙ | ︙ |
Changes to doc/FileSystem.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 2001 Vincent Darley '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 2001 Vincent Darley '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: FileSystem.3,v 1.52.2.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Filesystem 3 8.4 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_FSRegister, Tcl_FSUnregister, Tcl_FSData, Tcl_FSMountsChanged, Tcl_FSGetFileSystemForPath, Tcl_FSGetPathType, Tcl_FSCopyFile, Tcl_FSCopyDirectory, Tcl_FSCreateDirectory, Tcl_FSDeleteFile, Tcl_FSRemoveDirectory, Tcl_FSRenameFile, Tcl_FSListVolumes, Tcl_FSEvalFile, Tcl_FSLoadFile, Tcl_FSMatchInDirectory, Tcl_FSLink, Tcl_FSLstat, Tcl_FSUtime, Tcl_FSFileAttrsGet, Tcl_FSFileAttrsSet, Tcl_FSFileAttrStrings, Tcl_FSStat, Tcl_FSAccess, Tcl_FSOpenFileChannel, Tcl_FSGetCwd, Tcl_FSChdir, Tcl_FSPathSeparator, Tcl_FSJoinPath, Tcl_FSSplitPath, Tcl_FSEqualPaths, Tcl_FSGetNormalizedPath, Tcl_FSJoinToPath, Tcl_FSConvertToPathType, Tcl_FSGetInternalRep, Tcl_FSGetTranslatedPath, Tcl_FSGetTranslatedStringPath, Tcl_FSNewNativePath, Tcl_FSGetNativePath, Tcl_FSFileSystemInfo, Tcl_AllocStatBuf \- procedures to interact with any filesystem .SH SYNOPSIS |
| ︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 | .AP Tcl_PackageInitProc **proc1Ptr out Filled with the init function for this code. .AP Tcl_PackageInitProc **proc2Ptr out Filled with the safe-init function for this code. .AP ClientData *clientDataPtr out Filled with the clientData value to pass to this code's unload function when it is called. .AP Tcl_FSUnloadFileProc **unloadProcPtr out Filled with the function to use to unload this piece of code. .AP utimbuf *tval in The access and modification times in this structure are read and used to set those values for a given file. .AP "const char" *modeString in Specifies how the file is to be accessed. May have any of the values | > > | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | .AP Tcl_PackageInitProc **proc1Ptr out Filled with the init function for this code. .AP Tcl_PackageInitProc **proc2Ptr out Filled with the safe-init function for this code. .AP ClientData *clientDataPtr out Filled with the clientData value to pass to this code's unload function when it is called. .AP Tcl_LoadHandle *handlePtr out Filled with an abstract token representing the loaded file. .AP Tcl_FSUnloadFileProc **unloadProcPtr out Filled with the function to use to unload this piece of code. .AP utimbuf *tval in The access and modification times in this structure are read and used to set those values for a given file. .AP "const char" *modeString in Specifies how the file is to be accessed. May have any of the values |
| ︙ | ︙ | |||
1410 1411 1412 1413 1414 1415 1416 | .CE .PP Returns a standard Tcl completion code. If an error occurs, an error message is left in the \fIinterp\fR's result. The function dynamically loads a binary code file into memory. On a successful load, the \fIhandlePtr\fR should be filled with a token for the dynamically loaded file, and the \fIunloadProcPtr\fR should be filled in with the address of a procedure. | | | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 | .CE .PP Returns a standard Tcl completion code. If an error occurs, an error message is left in the \fIinterp\fR's result. The function dynamically loads a binary code file into memory. On a successful load, the \fIhandlePtr\fR should be filled with a token for the dynamically loaded file, and the \fIunloadProcPtr\fR should be filled in with the address of a procedure. The unload procedure will be called with the given \fBTcl_LoadHandle\fR as its only parameter when Tcl needs to unload the file. For example, for the native filesystem, the \fBTcl_LoadHandle\fR returned is currently a token which can be used in the private \fBTclpFindSymbol\fR to access functions in the new code. Each filesystem is free to define the \fBTcl_LoadHandle\fR as it requires. Finally, if the filesystem determines it cannot support the file load action, calling \fBTcl_SetErrno(EXDEV)\fR and returning a non-\fBTCL_OK\fR |
| ︙ | ︙ |
Changes to doc/GetIndex.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
'\"
'\" Copyright (c) 1997 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: GetIndex.3,v 1.16.4.1 2005/06/13 01:45:37 msofer Exp $
'\"
.so man.macros
.TH Tcl_GetIndexFromObj 3 8.1 Tcl "Tcl Library Procedures"
.BS
.SH NAME
Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct \- lookup string in table of keywords
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_GetIndexFromObj\fR(\fIinterp, objPtr, tablePtr, msg, flags,
indexPtr\fR)
.sp
int
\fBTcl_GetIndexFromObjStruct\fR(\fIinterp, objPtr, structTablePtr, offset,
msg, flags, indexPtr\fR)
.SH ARGUMENTS
.AS "const char" *structTablePtr in/out
.AP Tcl_Interp *interp in
Interpreter to use for error reporting; if NULL, then no message is
provided on errors.
.AP Tcl_Obj *objPtr in/out
The string value of this object is used to search through \fItablePtr\fR.
|
| ︙ | ︙ | |||
82 83 84 85 86 87 88 | arguments (e.g. during a reinvocation of a Tcl command), it returns the matching index immediately without having to redo the lookup operation. Note: \fBTcl_GetIndexFromObj\fR assumes that the entries in \fItablePtr\fR are static: they must not change between invocations. If the value of \fIobjPtr\fR is the empty string, \fBTcl_GetIndexFromObj\fR will treat it as a non-matching value and return \fBTCL_ERROR\fR. | < < | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | arguments (e.g. during a reinvocation of a Tcl command), it returns the matching index immediately without having to redo the lookup operation. Note: \fBTcl_GetIndexFromObj\fR assumes that the entries in \fItablePtr\fR are static: they must not change between invocations. If the value of \fIobjPtr\fR is the empty string, \fBTcl_GetIndexFromObj\fR will treat it as a non-matching value and return \fBTCL_ERROR\fR. .PP \fBTcl_GetIndexFromObjStruct\fR works just like \fBTcl_GetIndexFromObj\fR, except that instead of treating \fItablePtr\fR as an array of string pointers, it treats it as a pointer to the first string in a series of strings that have \fIoffset\fR bytes between them (i.e. that there is a pointer to the first array of characters at \fItablePtr\fR, a pointer to the second array of characters at \fItablePtr\fR+\fIoffset\fR bytes, etc.) This is particularly useful when processing things like \fBTk_ConfigurationSpec\fR, whose string keys are in the same place in each of several array elements. .SH "SEE ALSO" Tcl_WrongNumArgs .SH KEYWORDS index, object, table lookup |
Changes to doc/GetInt.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | | | | | | | | | > | | | | | > | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: GetInt.3,v 1.7.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_GetInt 3 "" Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean \- convert from string to integer, double, or boolean .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp int \fBTcl_GetInt\fR(\fIinterp, src, intPtr\fR) .sp int \fBTcl_GetDouble\fR(\fIinterp, src, doublePtr\fR) .sp int \fBTcl_GetBoolean\fR(\fIinterp, src, boolPtr\fR) .SH ARGUMENTS .AS Tcl_Interp *doublePtr out .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP "const char" *src in Textual value to be converted. .AP int *intPtr out Points to place to store integer value converted from \fIsrc\fR. .AP double *doublePtr out Points to place to store double-precision floating-point value converted from \fIsrc\fR. .AP int *boolPtr out Points to place to store boolean value (0 or 1) converted from \fIsrc\fR. .BE .SH DESCRIPTION .PP These procedures convert from strings to integers or double-precision floating-point values or booleans (represented as 0- or 1-valued integers). Each of the procedures takes a \fIsrc\fR argument, converts it to an internal form of a particular type, and stores the converted value at the location indicated by the procedure's third argument. If all goes well, each of the procedures returns \fBTCL_OK\fR. If \fIsrc\fR doesn't have the proper syntax for the desired type then \fBTCL_ERROR\fR is returned, an error message is left in the interpreter's result, and nothing is stored at *\fIintPtr\fR or *\fIdoublePtr\fR or *\fIboolPtr\fR. .PP \fBTcl_GetInt\fR expects \fIsrc\fR to consist of a collection of integer digits, optionally signed and optionally preceded by white space. If the first two characters of \fIsrc\fR after the optional white space and sign are ``0x'' then \fIsrc\fR is expected to be in hexadecimal form; otherwise, if the first such character is ``0'' then \fIsrc\fR is expected to be in octal form; otherwise, \fIsrc\fR is expected to be in decimal form. .PP \fBTcl_GetDouble\fR expects \fIsrc\fR to consist of a floating-point number, which is: white space; a sign; a sequence of digits; a decimal point; a sequence of digits; the letter ``e''; a signed decimal exponent ; and more white space. Any of the fields may be omitted, except that the digits either before or after the decimal point must be present and if the ``e'' is present then it must be followed by the exponent number. .PP \fBTcl_GetBoolean\fR expects \fIsrc\fR to specify a boolean value. If \fIsrc\fR is any of \fB0\fR, \fBfalse\fR, \fBno\fR, or \fBoff\fR, then \fBTcl_GetBoolean\fR stores a zero value at \fI*boolPtr\fR. If \fIsrc\fR is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or \fBon\fR, then 1 is stored at \fI*boolPtr\fR. Any of these values may be abbreviated, and upper-case spellings are also acceptable. .SH KEYWORDS boolean, conversion, double, floating-point, integer |
Changes to doc/GetOpnFl.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: GetOpnFl.3,v 1.8.4.1 2005/06/13 01:45:37 msofer Exp $ .so man.macros .TH Tcl_GetOpenFile 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_GetOpenFile \- Return a FILE* for a channel registered in the given interpreter (Unix only) .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp int \fBTcl_GetOpenFile\fR(\fIinterp, chanID, write, checkUsage, filePtr\fR) .sp .SH ARGUMENTS .AS Tcl_Interp checkUsage out .AP Tcl_Interp *interp in Tcl interpreter from which file handle is to be obtained. .AP "const char" *chanID in String identifying channel, such as \fBstdin\fR or \fBfile4\fR. .AP int write in Non-zero means the file will be used for writing, zero means it will be used for reading. .AP int checkUsage in If non-zero, then an error will be generated if the file wasn't opened for the access indicated by \fIwrite\fR. .AP ClientData *filePtr out Points to word in which to store pointer to FILE structure for the file given by \fIchanID\fR. .BE .SH DESCRIPTION .PP \fBTcl_GetOpenFile\fR takes as argument a file identifier of the form returned by the \fBopen\fR command and returns at \fI*filePtr\fR a pointer to the FILE structure for the file. The \fIwrite\fR argument indicates whether the FILE pointer will be used for reading or writing. In some cases, such as a channel that connects to a pipeline of subprocesses, different FILE pointers will be returned for reading and writing. \fBTcl_GetOpenFile\fR normally returns \fBTCL_OK\fR. If an error occurs in \fBTcl_GetOpenFile\fR (e.g. \fIchanID\fR didn't make any sense or \fIcheckUsage\fR was set and the file wasn't opened for the access specified by \fIwrite\fR) then \fBTCL_ERROR\fR is returned and the interpreter's result will contain an error message. In the current implementation \fIcheckUsage\fR is ignored and consistency checks are always performed. .PP Note that this interface is only supported on the Unix platform. .SH KEYWORDS channel, file handle, permissions, pipeline, read, write |
Changes to doc/IntObj.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: IntObj.3,v 1.6.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_IntObj 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_NewIntObj, Tcl_NewLongObj, Tcl_NewWideIntObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_SetWideIntObj, Tcl_GetIntFromObj, Tcl_GetLongFromObj, Tcl_GetWideIntFromObj \- manipulate Tcl objects as integers and wide integers .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp Tcl_Obj * \fBTcl_NewIntObj\fR(\fIintValue\fR) .sp Tcl_Obj * \fBTcl_NewLongObj\fR(\fIlongValue\fR) .sp Tcl_Obj * \fBTcl_NewWideIntObj\fR(\fIwideValue\fR) .sp \fBTcl_SetIntObj\fR(\fIobjPtr, intValue\fR) .sp \fBTcl_SetLongObj\fR(\fIobjPtr, longValue\fR) .sp \fBTcl_SetWideIntObj\fR(\fIobjPtr, wideValue\fR) .sp int \fBTcl_GetIntFromObj\fR(\fIinterp, objPtr, intPtr\fR) .sp int \fBTcl_GetLongFromObj\fR(\fIinterp, objPtr, longPtr\fR) .sp int \fBTcl_GetWideIntFromObj\fR(\fIinterp, objPtr, widePtr\fR) .SH ARGUMENTS .AS Tcl_WideInt longValue in/out .AP int intValue in Integer value used to initialize or set an integer object. .AP long longValue in Long integer value used to initialize or set an integer object. .AP Tcl_WideInt wideValue in Wide integer value (minimum 64-bits wide where supported by the compiler) used to initialize or set a wide integer object. .AP Tcl_Obj *objPtr in/out For \fBTcl_SetIntObj\fR, \fBTcl_SetLongObj\fR, and \fBTcl_SetWideIntObj\fR, this points to the object to be converted to integer type. For \fBTcl_GetIntFromObj\fR, \fBTcl_GetLongFromObj\fR, and \fBTcl_GetWideIntFromObj\fR, this refers to the object from which to get an integer or long integer value; if \fIobjPtr\fR does not already point to an integer object (or a wide integer object in the case of \fBTcl_SetWideIntObj\fR and \fBTcl_GetWideIntFromObj\fR), an attempt will be made to convert it to one. .AP Tcl_Interp *interp in/out If an error occurs during conversion, an error message is left in the interpreter's result object unless \fIinterp\fR is NULL. .AP int *intPtr out Points to place to store the integer value obtained by \fBTcl_GetIntFromObj\fR from \fIobjPtr\fR. .AP long *longPtr out Points to place to store the long integer value obtained by \fBTcl_GetLongFromObj\fR from \fIobjPtr\fR. .AP Tcl_WideInt *widePtr out Points to place to store the wide integer value obtained by \fBTcl_GetWideIntFromObj\fR from \fIobjPtr\fR. .BE .SH DESCRIPTION .PP These procedures are used to create, modify, and read integer and wide integer Tcl objects from C code. \fBTcl_NewIntObj\fR, \fBTcl_NewLongObj\fR, \fBTcl_SetIntObj\fR, and \fBTcl_SetLongObj\fR create a new object of integer type or modify an existing object to have integer type, and \fBTcl_NewWideIntObj\fR and \fBTcl_SetWideIntObj\fR create a new object of wide integer type or modify an existing object to have wide integer type. \fBTcl_NewIntObj\fR and \fBTcl_SetIntObj\fR set the object to have the integer value given by \fIintValue\fR, \fBTcl_NewLongObj\fR and \fBTcl_SetLongObj\fR set the object to have the long integer value given by \fIlongValue\fR, and \fBTcl_NewWideIntObj\fR and \fBTcl_SetWideIntObj\fR set the object to have the wide integer value given by \fIwideValue\fR. \fBTcl_NewIntObj\fR, \fBTcl_NewLongObj\fR and \fBTcl_NewWideIntObj\fR return a pointer to a newly created object with reference count zero. These procedures set the object's type to be integer and assign the integer value to the object's internal representation \fIlongValue\fR or \fIwideValue\fR member (as appropriate). \fBTcl_SetIntObj\fR, \fBTcl_SetLongObj\fR and \fBTcl_SetWideIntObj\fR invalidate any old string representation and, if the object is not already an integer object, free any old internal representation. .PP \fBTcl_GetIntFromObj\fR and \fBTcl_GetLongFromObj\fR attempt to return an integer value from the Tcl object \fIobjPtr\fR, and \fBTcl_GetWideIntFromObj\fR attempts to return a wide integer value from the Tcl object \fIobjPtr\fR. If the object is not already an integer object, or a wide integer object in the case of \fBTcl_GetWideIntFromObj\fR they will attempt to convert it to one. If an error occurs during conversion, they return \fBTCL_ERROR\fR and leave an error message in the interpreter's result object unless \fIinterp\fR is NULL. Also, if the long integer held in the object's internal representation \fIlongValue\fR member can not be represented in a (non-long) integer, \fBTcl_GetIntFromObj\fR returns \fBTCL_ERROR\fR and leaves an error message in the interpreter's result object unless \fIinterp\fR is NULL. Otherwise, all three procedures return \fBTCL_OK\fR and store the integer, long integer value or wide integer in the address given by \fIintPtr\fR, \fIlongPtr\fR and \fIwidePtr\fR respectively. If the object is not already an integer or wide integer object, the conversion will free any old internal representation. .SH "SEE ALSO" Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult .SH KEYWORDS integer, integer object, integer type, internal representation, object, object type, string representation |
Changes to doc/Interp.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Interp.3,v 1.7.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_Interp 3 7.5 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_Interp \- client-visible fields of interpreter structures .SH SYNOPSIS |
| ︙ | ︙ | |||
56 57 58 59 60 61 62 | being returned by the command. The \fIresult\fR field must always point to a valid string. If a command wishes to return no result then \fIinterp->result\fR should point to an empty string. Normally, results are assumed to be statically allocated, which means that the contents will not change before the next time \fBTcl_Eval\fR is called or some other command procedure is invoked. | < < < < | 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 | being returned by the command. The \fIresult\fR field must always point to a valid string. If a command wishes to return no result then \fIinterp->result\fR should point to an empty string. Normally, results are assumed to be statically allocated, which means that the contents will not change before the next time \fBTcl_Eval\fR is called or some other command procedure is invoked. In this case, the \fIfreeProc\fR field must be zero. Alternatively, a command procedure may dynamically allocate its return value (e.g. using \fBTcl_Alloc\fR) and store a pointer to it in \fIinterp->result\fR. In this case, the command procedure must also set \fIinterp->freeProc\fR to the address of a procedure that can free the value, or \fBTCL_DYNAMIC\fR if the storage was allocated directly by Tcl or by a call to \fBTcl_Alloc\fR. If \fIinterp->freeProc\fR is non-zero, then Tcl will call \fIfreeProc\fR to free the space pointed to by \fIinterp->result\fR before it invokes the next command. If a client procedure overwrites \fIinterp->result\fR when \fIinterp->freeProc\fR is non-zero, then it is responsible for calling \fIfreeProc\fR to free the old \fIinterp->result\fR (the \fBTcl_FreeResult\fR macro should be used for this purpose). .PP \fIFreeProc\fR should have arguments and result that match the \fBTcl_FreeProc\fR declaration above: it receives a single argument which is a pointer to the result value to free. In most applications \fBTCL_DYNAMIC\fR is the only non-zero value ever used for \fIfreeProc\fR. However, an application may store a different procedure address in \fIfreeProc\fR in order to use an alternate memory allocator or in order to do other cleanup when the result memory is freed. .PP As part of processing each command, \fBTcl_Eval\fR initializes \fIinterp->result\fR and \fIinterp->freeProc\fR just before calling the command procedure for |
| ︙ | ︙ |
Changes to doc/LinkVar.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: LinkVar.3,v 1.9.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_LinkVar 3 7.5 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_LinkVar, Tcl_UnlinkVar, Tcl_UpdateLinkedVar \- link Tcl variable to C variable .SH SYNOPSIS |
| ︙ | ︙ | |||
29 30 31 32 33 34 35 | Also used by \fBTcl_LinkVar\fR to return error messages. .AP "const char" *varName in Name of global variable. .AP char *addr in Address of C variable that is to be linked to \fIvarName\fR. .AP int type in Type of C variable. Must be one of \fBTCL_LINK_INT\fR, \fBTCL_LINK_DOUBLE\fR, | < < | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | Also used by \fBTcl_LinkVar\fR to return error messages. .AP "const char" *varName in Name of global variable. .AP char *addr in Address of C variable that is to be linked to \fIvarName\fR. .AP int type in Type of C variable. Must be one of \fBTCL_LINK_INT\fR, \fBTCL_LINK_DOUBLE\fR, \fBTCL_LINK_WIDE_INT\fR, \fBTCL_LINK_BOOLEAN\fR, or \fBTCL_LINK_STRING\fR, optionally OR'ed with \fBTCL_LINK_READ_ONLY\fR to make Tcl variable read-only. .BE .SH DESCRIPTION .PP \fBTcl_LinkVar\fR uses variable traces to keep the Tcl variable |
| ︙ | ︙ | |||
68 69 70 71 72 73 74 | The C variable is of type \fBdouble\fR. Any value written into the Tcl variable must have a proper real form acceptable to \fBTcl_GetDoubleFromObj\fR; attempts to write non-real values into \fIvarName\fR will be rejected with Tcl errors. .TP \fBTCL_LINK_WIDE_INT\fR | < < < < | 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 | The C variable is of type \fBdouble\fR. Any value written into the Tcl variable must have a proper real form acceptable to \fBTcl_GetDoubleFromObj\fR; attempts to write non-real values into \fIvarName\fR will be rejected with Tcl errors. .TP \fBTCL_LINK_WIDE_INT\fR The C variable is of type \fBTcl_WideInt\fR (which is an integer type at least 64-bits wide on all platforms that can support it.) Any value written into the Tcl variable must have a proper integer form acceptable to \fBTcl_GetWideIntFromObj\fR; attempts to write non-integer values into \fIvarName\fR will be rejected with Tcl errors. .TP \fBTCL_LINK_BOOLEAN\fR The C variable is of type \fBint\fR. If its value is zero then it will read from Tcl as ``0''; otherwise it will read from Tcl as ``1''. Whenever \fIvarName\fR is modified, the C variable will be set to a 0 or 1 value. Any value written into the Tcl variable must have a proper boolean form acceptable to \fBTcl_GetBooleanFromObj\fR; attempts to write non-boolean values into \fIvarName\fR will be rejected with Tcl errors. .TP \fBTCL_LINK_STRING\fR The C variable is of type \fBchar *\fR. If its value is not NULL then it must be a pointer to a string allocated with \fBTcl_Alloc\fR or \fBckalloc\fR. Whenever the Tcl variable is modified the current C string will be freed and new memory will be allocated to hold a copy of the variable's new value. If the C variable contains a NULL pointer then the Tcl variable will read as ``NULL''. .PP If the \fBTCL_LINK_READ_ONLY\fR flag is present in \fItype\fR then the |
| ︙ | ︙ |
Changes to doc/ListObj.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: ListObj.3,v 1.8.4.2 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_ListObj 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_ListObjAppendList, Tcl_ListObjAppendElement, Tcl_NewListObj, Tcl_SetListObj, Tcl_ListObjGetElements, Tcl_ListObjLength, Tcl_ListObjIndex, Tcl_ListObjReplace \- manipulate Tcl objects as lists .SH SYNOPSIS |
| ︙ | ︙ | |||
147 148 149 150 151 152 153 | The new list object returned by \fBTcl_NewListObj\fR has reference count zero. .PP \fBTcl_ListObjGetElements\fR returns a count and a pointer to an array of the elements in a list object. It returns the count by storing it in the address \fIobjcPtr\fR. Similarly, it returns the array pointer by storing it in the address \fIobjvPtr\fR. | | | > | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | The new list object returned by \fBTcl_NewListObj\fR has reference count zero. .PP \fBTcl_ListObjGetElements\fR returns a count and a pointer to an array of the elements in a list object. It returns the count by storing it in the address \fIobjcPtr\fR. Similarly, it returns the array pointer by storing it in the address \fIobjvPtr\fR. The memory pointed to is managed by Tcl and should not be freed or written to by the caller. If the list is empty, 0 is stored at \fIobjcPtr\fR and NULL at \fIobjvPtr\fR. If \fIlistPtr\fR is not already a list object, \fBTcl_ListObjGetElements\fR will attempt to convert it to one; if the conversion fails, it returns \fBTCL_ERROR\fR and leaves an error message in the interpreter's result object if \fIinterp\fR is not NULL. Otherwise it returns \fBTCL_OK\fR after storing the count and array pointer. .PP \fBTcl_ListObjLength\fR returns the number of elements in the list object |
| ︙ | ︙ |
Changes to doc/Notifier.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1998-1999 Scriptics Corporation '\" Copyright (c) 1995-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1998-1999 Scriptics Corporation '\" Copyright (c) 1995-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Notifier.3,v 1.13.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Notifier 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_CreateEventSource, Tcl_DeleteEventSource, Tcl_SetMaxBlockTime, Tcl_QueueEvent, Tcl_ThreadQueueEvent, Tcl_ThreadAlert, Tcl_GetCurrentThread, Tcl_DeleteEvents, Tcl_InitNotifier, Tcl_FinalizeNotifier, Tcl_WaitForEvent, Tcl_AlertNotifier, Tcl_SetTimer, Tcl_ServiceAll, Tcl_ServiceEvent, Tcl_GetServiceMode, Tcl_SetServiceMode \- the event queue and notifier interfaces .SH SYNOPSIS |
| ︙ | ︙ | |||
23 24 25 26 27 28 29 | \fBTcl_DeleteEventSource\fR(\fIsetupProc, checkProc, clientData\fR) .sp void \fBTcl_SetMaxBlockTime\fR(\fItimePtr\fR) .sp void \fBTcl_QueueEvent\fR(\fIevPtr, position\fR) | < | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | \fBTcl_DeleteEventSource\fR(\fIsetupProc, checkProc, clientData\fR) .sp void \fBTcl_SetMaxBlockTime\fR(\fItimePtr\fR) .sp void \fBTcl_QueueEvent\fR(\fIevPtr, position\fR) .sp void \fBTcl_ThreadQueueEvent\fR(\fIthreadId, evPtr, position\fR) .sp void \fBTcl_ThreadAlert\fR(\fIthreadId\fR) .sp |
| ︙ | ︙ | |||
63 64 65 66 67 68 69 | \fBTcl_ServiceEvent\fR(\fIflags\fR) .sp int \fBTcl_GetServiceMode\fR() .sp int \fBTcl_SetServiceMode\fR(\fImode\fR) | < | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | \fBTcl_ServiceEvent\fR(\fIflags\fR) .sp int \fBTcl_GetServiceMode\fR() .sp int \fBTcl_SetServiceMode\fR(\fImode\fR) .SH ARGUMENTS .AS Tcl_EventDeleteProc *deleteProc .AP Tcl_EventSetupProc *setupProc in Procedure to invoke to prepare for event wait in \fBTcl_DoOneEvent\fR. .AP Tcl_EventCheckProc *checkProc in Procedure for \fBTcl_DoOneEvent\fR to invoke after waiting for |
| ︙ | ︙ |
Changes to doc/Object.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Object.3,v 1.10.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_Obj 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_NewObj, Tcl_DuplicateObj, Tcl_IncrRefCount, Tcl_DecrRefCount, Tcl_IsShared, Tcl_InvalidateStringRep \- manipulate Tcl objects .SH SYNOPSIS |
| ︙ | ︙ | |||
125 126 127 128 129 130 131 |
void *\fIptr1\fR;
void *\fIptr2\fR;
} \fItwoPtrValue\fR;
} \fIinternalRep\fR;
} Tcl_Obj;
.CE
The \fIbytes\fR and the \fIlength\fR members together hold
| < < | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
void *\fIptr1\fR;
void *\fIptr2\fR;
} \fItwoPtrValue\fR;
} \fIinternalRep\fR;
} Tcl_Obj;
.CE
The \fIbytes\fR and the \fIlength\fR members together hold
an object's UTF-8 string representation,
which is a \fIcounted string\fR not containing null bytes (UTF-8 null
characters should be encoded as a two byte sequence: 192, 128.)
\fIbytes\fR points to the first byte of the string representation.
The \fIlength\fR member gives the number of bytes.
The byte array must always have a null byte after the last data byte,
at offset \fIlength\fR;
this allows string representations
to be treated as conventional null-terminated C strings.
C programs use \fBTcl_GetStringFromObj\fR and \fBTcl_GetString\fR to get
an object's string representation.
If \fIbytes\fR is NULL,
the string representation is invalid.
.PP
An object's type manages its internal representation.
The member \fItypePtr\fR points to the Tcl_ObjType structure
|
| ︙ | ︙ |
Changes to doc/OpenFileChnl.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | '\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: OpenFileChnl.3,v 1.29.4.1 2005/06/13 01:45:37 msofer Exp $ .so man.macros .TH Tcl_OpenFileChannel 3 8.3 Tcl "Tcl Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME Tcl_OpenFileChannel, Tcl_OpenCommandChannel, Tcl_MakeFileChannel, Tcl_GetChannel, Tcl_GetChannelNames, Tcl_GetChannelNamesEx, Tcl_RegisterChannel, Tcl_UnregisterChannel, Tcl_DetachChannel, Tcl_IsStandardChannel, Tcl_Close, Tcl_ReadChars, Tcl_Read, Tcl_GetsObj, Tcl_Gets, Tcl_WriteObj, Tcl_WriteChars, Tcl_Write, Tcl_Flush, Tcl_Seek, Tcl_Tell, Tcl_TruncateChannel, Tcl_GetChannelOption, Tcl_SetChannelOption, Tcl_Eof, Tcl_InputBlocked, Tcl_InputBuffered, Tcl_OutputBuffered, Tcl_Ungets, Tcl_ReadRaw, Tcl_WriteRaw \- buffered I/O facilities using channels .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp Tcl_Channel \fBTcl_OpenFileChannel\fR(\fIinterp, fileName, mode, permissions\fR) .sp |
| ︙ | ︙ | |||
85 86 87 88 89 90 91 | \fBTcl_Flush\fR(\fIchannel\fR) .sp int \fBTcl_InputBlocked\fR(\fIchannel\fR) .sp int \fBTcl_InputBuffered\fR(\fIchannel\fR) | < < > > > > > | 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 | \fBTcl_Flush\fR(\fIchannel\fR) .sp int \fBTcl_InputBlocked\fR(\fIchannel\fR) .sp int \fBTcl_InputBuffered\fR(\fIchannel\fR) .sp int \fBTcl_OutputBuffered\fR(\fIchannel\fR) .sp Tcl_WideInt \fBTcl_Seek\fR(\fIchannel, offset, seekMode\fR) .sp Tcl_WideInt \fBTcl_Tell\fR(\fIchannel\fR) .sp .VS 8.5 int \fBTcl_TruncateChannel\fR(\fIchannel, length\fR) .VE 8.5 .sp int \fBTcl_GetChannelOption\fR(\fIinterp, channel, optionName, optionValue\fR) .sp int \fBTcl_SetChannelOption\fR(\fIinterp, channel, optionName, newValue\fR) .sp |
| ︙ | ︙ | |||
194 195 196 197 198 199 200 201 202 203 204 205 206 207 | How far to move the access point in the channel at which the next input or output operation will be applied, measured in bytes from the position given by \fIseekMode\fR. May be either positive or negative. .AP int seekMode in Relative to which point to seek; used with \fIoffset\fR to calculate the new access point for the channel. Legal values are \fBSEEK_SET\fR, \fBSEEK_CUR\fR, and \fBSEEK_END\fR. .AP "const char" *optionName in The name of an option applicable to this channel, such as \fB\-blocking\fR. May have any of the values accepted by the \fBfconfigure\fR command. .AP Tcl_DString *optionValue in Where to store the value of an option or a list of all options and their values. Must have been initialized by the caller. .AP "const char" *newValue in | > > | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | How far to move the access point in the channel at which the next input or output operation will be applied, measured in bytes from the position given by \fIseekMode\fR. May be either positive or negative. .AP int seekMode in Relative to which point to seek; used with \fIoffset\fR to calculate the new access point for the channel. Legal values are \fBSEEK_SET\fR, \fBSEEK_CUR\fR, and \fBSEEK_END\fR. .AP Tcl_WideInt length in The (non-negative) length to truncate the channel the channel to. .AP "const char" *optionName in The name of an option applicable to this channel, such as \fB\-blocking\fR. May have any of the values accepted by the \fBfconfigure\fR command. .AP Tcl_DString *optionValue in Where to store the value of an option or a list of all options and their values. Must have been initialized by the caller. .AP "const char" *newValue in |
| ︙ | ︙ | |||
589 590 591 592 593 594 595 596 597 598 599 600 601 602 | code that can be retrieved with \fBTcl_GetErrno\fR. After an error, the access point may or may not have been moved. .SH TCL_TELL .PP \fBTcl_Tell\fR returns the current access point for a channel. The returned value is \-1 if the channel does not support seeking. .SH TCL_GETCHANNELOPTION .PP \fBTcl_GetChannelOption\fR retrieves, in \fIoptionValue\fR, the value of one of the options currently in effect for a channel, or a list of all options and their values. The \fIchannel\fR argument identifies the channel for which to query an option or retrieve all options and their values. | > > > > > > > > | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | code that can be retrieved with \fBTcl_GetErrno\fR. After an error, the access point may or may not have been moved. .SH TCL_TELL .PP \fBTcl_Tell\fR returns the current access point for a channel. The returned value is \-1 if the channel does not support seeking. .SH TCL_TRUNCATECHANNEL .PP .VS 8.5 \fBTcl_TruncateChannel\fR truncates the file underlying \fIchannel\fR to a given \fIlength\fR of bytes. It returns \fBTCL_OK\fR if the operation succeeded, and \fBTCL_ERROR\fR otherwise. .VE 8.5 .SH TCL_GETCHANNELOPTION .PP \fBTcl_GetChannelOption\fR retrieves, in \fIoptionValue\fR, the value of one of the options currently in effect for a channel, or a list of all options and their values. The \fIchannel\fR argument identifies the channel for which to query an option or retrieve all options and their values. |
| ︙ | ︙ | |||
639 640 641 642 643 644 645 | .SH TCL_INPUTBUFFERED .PP \fBTcl_InputBuffered\fR returns the number of bytes of input currently buffered in the internal buffers for a channel. If the channel is not open for reading, this function always returns zero. .SH TCL_OUTPUTBUFFERED | < < | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | .SH TCL_INPUTBUFFERED .PP \fBTcl_InputBuffered\fR returns the number of bytes of input currently buffered in the internal buffers for a channel. If the channel is not open for reading, this function always returns zero. .SH TCL_OUTPUTBUFFERED \fBTcl_OutputBuffered\fR returns the number of bytes of output currently buffered in the internal buffers for a channel. If the channel is not open for writing, this function always returns zero. .SH "PLATFORM ISSUES" .PP The handles returned from \fBTcl_GetChannelHandle\fR depend on the platform and the channel type. On Unix platforms, the handle is always a Unix file descriptor as returned from the \fBopen\fR system call. On Windows platforms, the handle is a file \fBHANDLE\fR when |
| ︙ | ︙ |
Changes to doc/OpenTcp.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996-7 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1996-7 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: OpenTcp.3,v 1.8.4.1 2005/06/13 01:45:37 msofer Exp $ .so man.macros .TH Tcl_OpenTcpClient 3 8.0 Tcl "Tcl Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME Tcl_OpenTcpClient, Tcl_MakeTcpClientChannel, Tcl_OpenTcpServer \- procedures to open channels using TCP sockets .SH SYNOPSIS |
| ︙ | ︙ | |||
159 160 161 162 163 164 165 | .PP The newly created channel is not registered in the supplied interpreter; to register it, use \fBTcl_RegisterChannel\fR. If one of the standard channels, \fBstdin, stdout\fR or \fBstderr\fR was previously closed, the act of creating the new channel also assigns it as a replacement for the standard channel. | < < | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | .PP The newly created channel is not registered in the supplied interpreter; to register it, use \fBTcl_RegisterChannel\fR. If one of the standard channels, \fBstdin, stdout\fR or \fBstderr\fR was previously closed, the act of creating the new channel also assigns it as a replacement for the standard channel. .SH "PLATFORM ISSUES" .PP On Unix platforms, the socket handle is a Unix file descriptor as returned by the \fBsocket\fR system call. On the Windows platform, the socket handle is a \fBSOCKET\fR as defined in the WinSock API. .SH "SEE ALSO" Tcl_OpenFileChannel(3), Tcl_RegisterChannel(3), vwait(n) .SH KEYWORDS client, server, TCP |
Changes to doc/ParseCmd.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: ParseCmd.3,v 1.18.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_ParseCommand 3 8.3 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_ParseCommand, Tcl_ParseExpr, Tcl_ParseBraces, Tcl_ParseQuotedString, Tcl_ParseVarName, Tcl_ParseVar, Tcl_FreeParse, Tcl_EvalTokens, Tcl_EvalTokensStandard \- parse Tcl scripts and expressions .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp int \fBTcl_ParseCommand\fR(\fIinterp, start, numBytes, nested, parsePtr\fR) .sp int \fBTcl_ParseExpr\fR(\fIinterp, start, numBytes, parsePtr\fR) .sp int \fBTcl_ParseBraces\fR(\fIinterp, start, numBytes, parsePtr, append, termPtr\fR) .sp int \fBTcl_ParseQuotedString\fR(\fIinterp, start, numBytes, parsePtr, append, termPtr\fR) .sp int \fBTcl_ParseVarName\fR(\fIinterp, start, numBytes, parsePtr, append\fR) .sp const char * \fBTcl_ParseVar\fR(\fIinterp, start, termPtr\fR) .sp \fBTcl_FreeParse\fR(\fIusedParsePtr\fR) .sp Tcl_Obj * \fBTcl_EvalTokens\fR(\fIinterp, tokenPtr, numTokens\fR) .sp int \fBTcl_EvalTokensStandard\fR(\fIinterp, tokenPtr, numTokens\fR) .SH ARGUMENTS .AS Tcl_Interp *usedParsePtr out .AP Tcl_Interp *interp out For procedures other than \fBTcl_FreeParse\fR, \fBTcl_EvalTokens\fR and \fBTcl_EvalTokensStandard\fR, used only for error reporting; if NULL, then no error messages are left after errors. For \fBTcl_EvalTokens\fR and \fBTcl_EvalTokensStandard\fR, determines the context for evaluating the script and also is used for error reporting; must not be NULL. .AP "const char" *start in Pointer to first character in string to parse. .AP int numBytes in Number of bytes in string to parse, not including any terminating null character. If less than 0 then the script consists of all characters following \fIstart\fR up to the first null character. .AP int nested in Non-zero means that the script is part of a command substitution so an unquoted close bracket should be treated as a command terminator. If zero, close brackets have no special meaning. .AP int append in Non-zero means that \fI*parsePtr\fR already contains valid tokens; the new tokens should be appended to those already present. Zero means that |
| ︙ | ︙ | |||
116 117 118 119 120 121 122 |
If an error occurred in parsing the command then
\fBTCL_ERROR\fR is returned, an error message is left in \fIinterp\fR's
result, and no information is left at \fI*parsePtr\fR.
.PP
\fBTcl_ParseBraces\fR parses a string or command argument
enclosed in braces such as
\fB{hello}\fR or \fB{string \\t with \\t tabs}\fR
| | | | | | | | | | 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 |
If an error occurred in parsing the command then
\fBTCL_ERROR\fR is returned, an error message is left in \fIinterp\fR's
result, and no information is left at \fI*parsePtr\fR.
.PP
\fBTcl_ParseBraces\fR parses a string or command argument
enclosed in braces such as
\fB{hello}\fR or \fB{string \\t with \\t tabs}\fR
from the beginning of its argument \fIstart\fR.
The first character of \fIstart\fR must be \fB{\fR.
If the braced string was parsed successfully,
\fBTcl_ParseBraces\fR returns \fBTCL_OK\fR,
fills in the structure pointed to by \fIparsePtr\fR
with information about the structure of the string
(see below for details),
and stores a pointer to the character just after the terminating \fB}\fR
in the location given by \fI*termPtr\fR.
If an error occurs while parsing the string
then \fBTCL_ERROR\fR is returned,
an error message is left in \fIinterp\fR's result,
and no information is left at \fI*parsePtr\fR or \fI*termPtr\fR.
.PP
\fBTcl_ParseQuotedString\fR parses a double-quoted string such as
\fB"sum is [expr $a+$b]"\fR
from the beginning of the argument \fIstart\fR.
The first character of \fIstart\fR must be \fB"\fR.
If the double-quoted string was parsed successfully,
\fBTcl_ParseQuotedString\fR returns \fBTCL_OK\fR,
fills in the structure pointed to by \fIparsePtr\fR
with information about the structure of the string
(see below for details),
and stores a pointer to the character just after the terminating \fB"\fR
in the location given by \fI*termPtr\fR.
If an error occurs while parsing the string
then \fBTCL_ERROR\fR is returned,
an error message is left in \fIinterp\fR's result,
and no information is left at \fI*parsePtr\fR or \fI*termPtr\fR.
.PP
\fBTcl_ParseVarName\fR parses a Tcl variable reference such as
\fB$abc\fR or \fB$x([expr $index + 1])\fR from the beginning of its
\fIstart\fR argument.
The first character of \fIstart\fR must be \fB$\fR.
If a variable name was parsed successfully, \fBTcl_ParseVarName\fR
returns \fBTCL_OK\fR and fills in the structure pointed to by
\fIparsePtr\fR with information about the structure of the variable name
(see below for details). If an error
occurs while parsing the command then \fBTCL_ERROR\fR is returned, an
error message is left in \fIinterp\fR's result (if \fIinterp\fR isn't
NULL), and no information is left at \fI*parsePtr\fR.
.PP
\fBTcl_ParseVar\fR parse a Tcl variable reference such as \fB$abc\fR
or \fB$x([expr $index + 1])\fR from the beginning of its \fIstart\fR
argument. The first character of \fIstart\fR must be \fB$\fR. If
the variable name is parsed successfully, \fBTcl_ParseVar\fR returns a
pointer to the string value of the variable. If an error occurs while
parsing, then NULL is returned and an error message is left in
\fIinterp\fR's result.
.PP
The information left at \fI*parsePtr\fR
by \fBTcl_ParseCommand\fR, \fBTcl_ParseExpr\fR, \fBTcl_ParseBraces\fR,
|
| ︙ | ︙ | |||
291 292 293 294 295 296 297 |
.VS 8.5
This token has the same meaning as \fBTCL_TOKEN_WORD\fR, except that
the command parser notes this word began with the expansion
prefix \fB{expand}\fR, indicating that after substitution,
the list value of this word should be expanded to form multiple
arguments in command evaluation. This
token type can only be created by Tcl_ParseCommand.
| | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
.VS 8.5
This token has the same meaning as \fBTCL_TOKEN_WORD\fR, except that
the command parser notes this word began with the expansion
prefix \fB{expand}\fR, indicating that after substitution,
the list value of this word should be expanded to form multiple
arguments in command evaluation. This
token type can only be created by Tcl_ParseCommand.
.VE 8.5
.TP
\fBTCL_TOKEN_TEXT\fR
The token describes a range of literal text that is part of a word.
The \fInumComponents\fR field is always 0.
.TP
\fBTCL_TOKEN_BS\fR
The token describes a backslash sequence such as \fB\en\fR or \fB\e0xa3\fR.
|
| ︙ | ︙ | |||
427 428 429 430 431 432 433 | .PP After \fBTcl_ParseQuotedString\fR returns, the array of tokens pointed to by the \fItokenPtr\fR field of the Tcl_Parse structure depends on the contents of the quoted string. It will consist of one or more \fBTCL_TOKEN_TEXT\fR, \fBTCL_TOKEN_BS\fR, \fBTCL_TOKEN_COMMAND\fR, and \fBTCL_TOKEN_VARIABLE\fR sub-tokens. The array always contains at least one token; | | | | 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 | .PP After \fBTcl_ParseQuotedString\fR returns, the array of tokens pointed to by the \fItokenPtr\fR field of the Tcl_Parse structure depends on the contents of the quoted string. It will consist of one or more \fBTCL_TOKEN_TEXT\fR, \fBTCL_TOKEN_BS\fR, \fBTCL_TOKEN_COMMAND\fR, and \fBTCL_TOKEN_VARIABLE\fR sub-tokens. The array always contains at least one token; for example, if the argument \fIstart\fR is empty, the array returned consists of a single \fBTCL_TOKEN_TEXT\fR token with a zero \fIsize\fR field. Only the token information in the Tcl_Parse structure is modified: the \fIcommentStart\fR, \fIcommentSize\fR, \fIcommandStart\fR, and \fIcommandSize\fR fields are not modified. .PP After \fBTcl_ParseVarName\fR returns, the first token pointed to by the \fItokenPtr\fR field of the Tcl_Parse structure always has type \fBTCL_TOKEN_VARIABLE\fR. It is followed by the sub-tokens that make up the variable name as described above. The total length of the variable name is contained in the \fIsize\fR field of the first token. As in \fBTcl_ParseExpr\fR, only the token information in the Tcl_Parse structure is modified by \fBTcl_ParseVarName\fR: the \fIcommentStart\fR, \fIcommentSize\fR, \fIcommandStart\fR, and \fIcommandSize\fR fields are not modified. .PP All of the character pointers in the Tcl_Parse and Tcl_Token structures refer to characters in the \fIstart\fR argument passed to \fBTcl_ParseCommand\fR, \fBTcl_ParseExpr\fR, \fBTcl_ParseBraces\fR, \fBTcl_ParseQuotedString\fR, and \fBTcl_ParseVarName\fR. .PP There are additional fields in the Tcl_Parse structure after the \fInumTokens\fR field, but these are for the private use of \fBTcl_ParseCommand\fR, \fBTcl_ParseExpr\fR, \fBTcl_ParseBraces\fR, \fBTcl_ParseQuotedString\fR, and \fBTcl_ParseVarName\fR; they should not be referenced by code outside of these procedures. .SH KEYWORDS backslash substitution, braces, command, expression, parse, token, variable substitution |
Changes to doc/PrintDbl.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: PrintDbl.3,v 1.5.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_PrintDouble 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_PrintDouble \- Convert floating value to string .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp \fBTcl_PrintDouble\fR(\fIinterp, value, dst\fR) .SH ARGUMENTS .AS Tcl_Interp *interp out .AP Tcl_Interp *interp in Before Tcl 8.0, the \fBtcl_precision\fR variable in this interpreter controlled the conversion. As of Tcl 8.0, this argument is ignored and the conversion is controlled by the \fBtcl_precision\fR variable that is now shared by all interpreters. .AP double value in Floating-point value to be converted. .AP char *dst out Where to store the string representing \fIvalue\fR. Must have at least \fBTCL_DOUBLE_SPACE\fR characters of storage. .BE .SH DESCRIPTION .PP \fBTcl_PrintDouble\fR generates a string that represents the value of \fIvalue\fR and stores it in memory at the location given by \fIdst\fR. It uses \fB%g\fR format to generate the string, with one special twist: the string is guaranteed to contain either a ``.'' or an ``e'' so that it doesn't look like an integer. Where \fB%g\fR would generate an integer with no decimal point, \fBTcl_PrintDouble\fR adds ``.0''. .VS 8.5 .PP If the \fBtcl_precision\fR value is non-zero, the result will have precisely that many digits of significance. If the value is zero (the default), the result will have the fewest digits needed to represent the number in such a way that \fBTcl_NewDoubleObj\fR will generate the same number when presented with the given string. IEEE semantics of rounding to even apply to the conversion. .VE .SH KEYWORDS conversion, double-precision, floating-point, string |
Changes to doc/RegExp.3.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 1998-1999 Scriptics Corporation '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | | | | | | | | < < < < < < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 1998-1999 Scriptics Corporation '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: RegExp.3,v 1.20.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_RegExpMatch 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_RegExpMatch, Tcl_RegExpCompile, Tcl_RegExpExec, Tcl_RegExpRange, Tcl_GetRegExpFromObj, Tcl_RegExpMatchObj, Tcl_RegExpExecObj, Tcl_RegExpGetInfo \- Pattern matching with regular expressions .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp int \fBTcl_RegExpMatchObj\fR(\fIinterp\fR, \fItextObj\fR, \fIpatObj\fR) .sp int \fBTcl_RegExpMatch\fR(\fIinterp\fR, \fItext\fR, \fIpattern\fR) .sp Tcl_RegExp \fBTcl_RegExpCompile\fR(\fIinterp\fR, \fIpattern\fR) .sp int \fBTcl_RegExpExec\fR(\fIinterp\fR, \fIregexp\fR, \fItext\fR, \fIstart\fR) .sp void \fBTcl_RegExpRange\fR(\fIregexp\fR, \fIindex\fR, \fIstartPtr\fR, \fIendPtr\fR) .sp Tcl_RegExp \fBTcl_GetRegExpFromObj\fR(\fIinterp\fR, \fIpatObj\fR, \fIcflags\fR) .sp int \fBTcl_RegExpExecObj\fR(\fIinterp\fR, \fIregexp\fR, \fItextObj\fR, \fIoffset\fR, \fInmatches\fR, \fIeflags\fR) .sp void \fBTcl_RegExpGetInfo\fR(\fIregexp\fR, \fIinfoPtr\fR) .SH ARGUMENTS .AS Tcl_RegExpInfo *interp in/out .AP Tcl_Interp *interp in Tcl interpreter to use for error reporting. The interpreter may be NULL if no error reporting is desired. .AP Tcl_Obj *textObj in/out Refers to the object from which to get the text to search. The internal representation of the object may be converted to a form that can be efficiently searched. .AP Tcl_Obj *patObj in/out Refers to the object from which to get a regular expression. The compiled regular expression is cached in the object. .AP char *text in Text to search for a match with a regular expression. .AP "const char" *pattern in String in the form of a regular expression pattern. .AP Tcl_RegExp regexp in Compiled regular expression. Must have been returned previously by \fBTcl_GetRegExpFromObj\fR or \fBTcl_RegExpCompile\fR. .AP char *start in If \fItext\fR is just a portion of some other string, this argument identifies the beginning of the larger string. If it isn't the same as \fItext\fR, then no \fB^\fR matches will be allowed. .AP int index in Specifies which range is desired: 0 means the range of the entire match, 1 or greater means the range that matched a parenthesized sub-expression. .AP "const char" **startPtr out The address of the first character in the range is stored here, or NULL if there is no such range. .AP "const char" **endPtr out The address of the character just after the last one in the range is stored here, or NULL if there is no such range. .AP int cflags in OR-ed combination of compilation flags. See below for more information. .AP int offset in The character offset into the text where matching should begin. The value of the offset has no impact on \fB^\fR matches. This behavior is controlled by \fIeflags\fR. .AP int nmatches in The number of matching subexpressions that should be remembered for later use. If this value is 0, then no subexpression match information will be computed. If the value is -1, then all of the matching subexpressions will be remembered. Any other |
| ︙ | ︙ | |||
111 112 113 114 115 116 117 | reference page. If there is a match then \fBTcl_RegExpMatch\fR returns 1. If there is no match then \fBTcl_RegExpMatch\fR returns 0. If an error occurs in the matching process (e.g. \fIpattern\fR is not a valid regular expression) then \fBTcl_RegExpMatch\fR returns \-1 and leaves an error message in the interpreter result. \fBTcl_RegExpMatchObj\fR is similar to \fBTcl_RegExpMatch\fR except it | | | | | | | | 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 | reference page. If there is a match then \fBTcl_RegExpMatch\fR returns 1. If there is no match then \fBTcl_RegExpMatch\fR returns 0. If an error occurs in the matching process (e.g. \fIpattern\fR is not a valid regular expression) then \fBTcl_RegExpMatch\fR returns \-1 and leaves an error message in the interpreter result. \fBTcl_RegExpMatchObj\fR is similar to \fBTcl_RegExpMatch\fR except it operates on the Tcl objects \fItextObj\fR and \fIpatObj\fR instead of UTF strings. \fBTcl_RegExpMatchObj\fR is generally more efficient than \fBTcl_RegExpMatch\fR, so it is the preferred interface. .PP \fBTcl_RegExpCompile\fR, \fBTcl_RegExpExec\fR, and \fBTcl_RegExpRange\fR provide lower-level access to the regular expression pattern matcher. \fBTcl_RegExpCompile\fR compiles a regular expression string into the internal form used for efficient pattern matching. The return value is a token for this compiled form, which can be used in subsequent calls to \fBTcl_RegExpExec\fR or \fBTcl_RegExpRange\fR. If an error occurs while compiling the regular expression then \fBTcl_RegExpCompile\fR returns NULL and leaves an error message in the interpreter result. Note: the return value from \fBTcl_RegExpCompile\fR is only valid up to the next call to \fBTcl_RegExpCompile\fR; it is not safe to retain these values for long periods of time. .PP \fBTcl_RegExpExec\fR executes the regular expression pattern matcher. It returns 1 if \fItext\fR contains a range of characters that match \fIregexp\fR, 0 if no match is found, and \-1 if an error occurs. In the case of an error, \fBTcl_RegExpExec\fR leaves an error message in the interpreter result. When searching a string for multiple matches of a pattern, it is important to distinguish between the start of the original string and the start of the current search. For example, when searching for the second occurrence of a match, the \fItext\fR argument might point to the character just after the first match; however, it is important for the pattern matcher to know that this is not the start of the entire string, so that it doesn't allow \fB^\fR atoms in the pattern to match. The \fIstart\fR argument provides this information by pointing to the start of the overall string containing \fItext\fR. \fIStart\fR will be less than or equal to \fItext\fR; if it is less than \fItext\fR then no \fB^\fR matches will be allowed. .PP \fBTcl_RegExpRange\fR may be invoked after \fBTcl_RegExpExec\fR returns; it provides detailed information about what ranges of the string matched what parts of the pattern. \fBTcl_RegExpRange\fR returns a pair of pointers in \fI*startPtr\fR and \fI*endPtr\fR that identify a range of characters in the source string for the most recent call to \fBTcl_RegExpExec\fR. |
| ︙ | ︙ |
Changes to doc/SaveResult.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1997 by Sun Microsystems, Inc. '\" Contributions from Don Porter, NIST, 2004. (not subject to US copyright) '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1997 by Sun Microsystems, Inc. '\" Contributions from Don Porter, NIST, 2004. (not subject to US copyright) '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: SaveResult.3,v 1.5.2.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_SaveResult 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState, Tcl_SaveResult, Tcl_RestoreResult, Tcl_DiscardResult \- save and restore an interpreter's state .SH SYNOPSIS |
| ︙ | ︙ | |||
95 96 97 98 99 100 101 | snapshot is not to be restored to an interp. .PP The \fBTcl_InterpState\fR token returned by \fBTcl_SaveInterpState\fR must eventually be passed to either \fBTcl_RestoreInterpState\fR or \fBTcl_DiscardInterpState\fR to avoid a memory leak. Once the \fBTcl_InterpState\fR token is passed to one of them, the token is no longer valid and should not be used anymore. | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | snapshot is not to be restored to an interp. .PP The \fBTcl_InterpState\fR token returned by \fBTcl_SaveInterpState\fR must eventually be passed to either \fBTcl_RestoreInterpState\fR or \fBTcl_DiscardInterpState\fR to avoid a memory leak. Once the \fBTcl_InterpState\fR token is passed to one of them, the token is no longer valid and should not be used anymore. .VE 8.5 .PP \fBTcl_SaveResult\fR moves the string and object results of \fIinterp\fR into the location specified by \fIstatePtr\fR. \fBTcl_SaveResult\fR clears the result for \fIinterp\fR and leaves the result in its normal empty initialized state. .PP \fBTcl_RestoreResult\fR moves the string and object results from |
| ︙ | ︙ |
Changes to doc/SetResult.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | | > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: SetResult.3,v 1.11.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_SetResult 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_SetObjResult, Tcl_GetObjResult, Tcl_SetResult, Tcl_GetStringResult, Tcl_AppendResult, Tcl_AppendResultVA, Tcl_AppendElement, Tcl_ResetResult, Tcl_FreeResult \- manipulate Tcl result .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp \fBTcl_SetObjResult\fR(\fIinterp, objPtr\fR) .sp Tcl_Obj * \fBTcl_GetObjResult\fR(\fIinterp\fR) .sp \fBTcl_SetResult\fR(\fIinterp, result, freeProc\fR) .sp const char * \fBTcl_GetStringResult\fR(\fIinterp\fR) .sp \fBTcl_AppendResult\fR(\fIinterp, result, result, ... , \fB(char *) NULL\fR) .sp \fBTcl_AppendResultVA\fR(\fIinterp, argList\fR) .sp \fBTcl_AppendElement\fR(\fIinterp, element\fR) .sp \fBTcl_ResetResult\fR(\fIinterp\fR) .sp \fBTcl_FreeResult\fR(\fIinterp\fR) .SH ARGUMENTS .AS Tcl_FreeProc freeProc out .AP Tcl_Interp *interp out Interpreter whose result is to be modified or read. .AP Tcl_Obj *objPtr in Object value to become result for \fIinterp\fR. .AP char *result in String value to become result for \fIinterp\fR or to be appended to the existing result. .AP char *element in String value to append as a list element to the existing result of \fIinterp\fR. .AP Tcl_FreeProc *freeProc in Address of procedure to call to release storage at \fIresult\fR, or \fBTCL_STATIC\fR, \fBTCL_DYNAMIC\fR, or \fBTCL_VOLATILE\fR. .AP va_list argList in An argument list which must have been initialized using \fBTCL_VARARGS_START\fR, and cleared using \fBva_end\fR. .BE .SH DESCRIPTION |
| ︙ | ︙ | |||
83 84 85 86 87 88 89 | \fBTcl_GetObjResult\fR returns the result for \fIinterp\fR as an object. The object's reference count is not incremented; if the caller needs to retain a long-term pointer to the object they should use \fBTcl_IncrRefCount\fR to increment its reference count in order to keep it from being freed too early or accidentally changed. .PP \fBTcl_SetResult\fR | | | | | | | | | | | 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 |
\fBTcl_GetObjResult\fR returns the result for \fIinterp\fR as an object.
The object's reference count is not incremented;
if the caller needs to retain a long-term pointer to the object
they should use \fBTcl_IncrRefCount\fR to increment its reference count
in order to keep it from being freed too early or accidentally changed.
.PP
\fBTcl_SetResult\fR
arranges for \fIresult\fR to be the result for the current Tcl
command in \fIinterp\fR, replacing any existing result.
The \fIfreeProc\fR argument specifies how to manage the storage
for the \fIresult\fR argument;
it is discussed in the section
\fBTHE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT\fR below.
If \fIresult\fR is \fBNULL\fR, then \fIfreeProc\fR is ignored
and \fBTcl_SetResult\fR
re-initializes \fIinterp\fR's result to point to an empty string.
.PP
\fBTcl_GetStringResult\fR returns the result for \fIinterp\fR as a string.
If the result was set to an object by a \fBTcl_SetObjResult\fR call,
the object form will be converted to a string and returned.
If the object's string representation contains null bytes,
this conversion will lose information.
For this reason, programmers are encouraged to
write their code to use the new object API procedures
and to call \fBTcl_GetObjResult\fR instead.
.PP
\fBTcl_ResetResult\fR clears the result for \fIinterp\fR
and leaves the result in its normal empty initialized state.
If the result is an object,
its reference count is decremented and the result is left
pointing to an unshared object representing an empty string.
If the result is a dynamically allocated string, its memory is free*d
and the result is left as a empty string.
\fBTcl_ResetResult\fR also clears the error state managed by
\fBTcl_AddErrorInfo\fR, \fBTcl_AddObjErrorInfo\fR,
and \fBTcl_SetErrorCode\fR.
.PP
\fBTcl_AppendResult\fR makes it easy to build up Tcl results in pieces.
It takes each of its \fIresult\fR arguments and appends them in order
to the current result associated with \fIinterp\fR.
If the result is in its initialized empty state (e.g. a command procedure
was just invoked or \fBTcl_ResetResult\fR was just called),
then \fBTcl_AppendResult\fR sets the result to the concatenation of
its \fIresult\fR arguments.
\fBTcl_AppendResult\fR may be called repeatedly as additional pieces
of the result are produced.
\fBTcl_AppendResult\fR takes care of all the
storage management issues associated with managing \fIinterp\fR's
result, such as allocating a larger result area if necessary.
It also manages conversion to and from the \fIresult\fR field of the
\fIinterp\fR so as to handle backward-compatability with old-style
extensions.
Any number of \fIresult\fR arguments may be passed in a single
call; the last argument in the list must be a NULL pointer.
.PP
\fBTcl_AppendResultVA\fR is the same as \fBTcl_AppendResult\fR except that
instead of taking a variable number of arguments it takes an argument list.
.SH "OLD STRING PROCEDURES"
.PP
Use of the following procedures (is deprecated
since they manipulate the Tcl result as a string.
Procedures such as \fBTcl_SetObjResult\fR
that manipulate the result as an object
can be significantly more efficient.
.PP
\fBTcl_AppendElement\fR is similar to \fBTcl_AppendResult\fR in
that it allows results to be built up in pieces.
However, \fBTcl_AppendElement\fR takes only a single \fIelement\fR
argument and it appends that argument to the current result
as a proper Tcl list element.
\fBTcl_AppendElement\fR adds backslashes or braces if necessary
to ensure that \fIinterp\fR's result can be parsed as a list and that
\fIelement\fR will be extracted as a single element.
Under normal conditions, \fBTcl_AppendElement\fR will add a space
character to \fIinterp\fR's result just before adding the new
list element, so that the list elements in the result are properly
separated.
However if the new list element is the first in a list or sub-list
(i.e. \fIinterp\fR's current result is empty, or consists of the
single character ``{'', or ends in the characters `` {'') then no
|
| ︙ | ︙ | |||
181 182 183 184 185 186 187 | Programs should always read the result using the procedures \fBTcl_GetObjResult\fR or \fBTcl_GetStringResult\fR, and write the result using \fBTcl_SetObjResult\fR or \fBTcl_SetResult\fR. .SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT" .PP \fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how | | | | | | | 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 | Programs should always read the result using the procedures \fBTcl_GetObjResult\fR or \fBTcl_GetStringResult\fR, and write the result using \fBTcl_SetObjResult\fR or \fBTcl_SetResult\fR. .SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT" .PP \fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how the Tcl system is to manage the storage for the \fIresult\fR argument. If \fBTcl_SetResult\fR or \fBTcl_SetObjResult\fR are called at a time when \fIinterp\fR holds a string result, they do whatever is necessary to dispose of the old string result (see the \fBTcl_Interp\fR manual entry for details on this). .PP If \fIfreeProc\fR is \fBTCL_STATIC\fR it means that \fIresult\fR refers to an area of static storage that is guaranteed not to be modified until at least the next call to \fBTcl_Eval\fR. If \fIfreeProc\fR is \fBTCL_DYNAMIC\fR it means that \fIresult\fR was allocated with a call to \fBTcl_Alloc\fR and is now the property of the Tcl system. \fBTcl_SetResult\fR will arrange for the string's storage to be released by calling \fBTcl_Free\fR when it is no longer needed. If \fIfreeProc\fR is \fBTCL_VOLATILE\fR it means that \fIresult\fR points to an area of memory that is likely to be overwritten when \fBTcl_SetResult\fR returns (e.g. it points to something in a stack frame). In this case \fBTcl_SetResult\fR will make a copy of the string in dynamically allocated storage and arrange for the copy to be the result for the current Tcl command. .PP If \fIfreeProc\fR isn't one of the values \fBTCL_STATIC\fR, \fBTCL_DYNAMIC\fR, and \fBTCL_VOLATILE\fR, then it is the address of a procedure that Tcl should call to free the string. This allows applications to use non-standard storage allocators. When Tcl no longer needs the storage for the string, it will call \fIfreeProc\fR. \fIFreeProc\fR should have arguments and result that match the type \fBTcl_FreeProc\fR: .CS typedef void Tcl_FreeProc(char *\fIblockPtr\fR); .CE When \fIfreeProc\fR is called, its \fIblockPtr\fR will be set to the value of \fIresult\fR passed to \fBTcl_SetResult\fR. .SH "SEE ALSO" Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp .SH KEYWORDS append, command, element, list, object, result, return value, interpreter |
Changes to doc/StrMatch.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: StrMatch.3,v 1.6.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_StringMatch 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_StringMatch, Tcl_StringCaseMatch \- test whether a string matches a pattern .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp int \fBTcl_StringMatch\fR(\fIstr\fR, \fIpattern\fR) .sp int \fBTcl_StringCaseMatch\fR(\fIstr\fR, \fIpattern\fR, \fInocase\fR) .SH ARGUMENTS .AS "const char" *pattern .AP "const char" *str in String to test. .AP "const char" *pattern in Pattern to match against string. May contain special characters from the set *?\e[]. .AP int nocase in Specifies whether the match should be done case-sensitive (0) or case-insensitive (1). .BE .SH DESCRIPTION .PP This utility procedure determines whether a string matches a given pattern. If it does, then \fBTcl_StringMatch\fR returns 1. Otherwise \fBTcl_StringMatch\fR returns 0. The algorithm used for matching is the same algorithm used in the ``string match'' Tcl command and is similar to the algorithm used by the C-shell for file name matching; see the Tcl manual entry for details. .PP In \fBTcl_StringCaseMatch\fR, the algorithm is the same, but you have the option to make the matching case-insensitive. If you choose this (by passing \fBnocase\fR as 1), then the string and pattern are essentially matched in the lower case. .SH KEYWORDS match, pattern, string |
Changes to doc/StringObj.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: StringObj.3,v 1.17.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_StringObj 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_NewStringObj, Tcl_NewUnicodeObj, Tcl_SetStringObj, Tcl_SetUnicodeObj, Tcl_GetStringFromObj, Tcl_GetString, Tcl_GetUnicodeFromObj, Tcl_GetUnicode, Tcl_GetUniChar, Tcl_GetCharLength, Tcl_GetRange, Tcl_AppendToObj, Tcl_AppendUnicodeToObj, Tcl_AppendStringsToObj, Tcl_AppendStringsToObjVA, Tcl_AppendObjToObj, Tcl_SetObjLength, Tcl_ConcatObj, Tcl_AttemptSetObjLength \- manipulate Tcl objects as strings .SH SYNOPSIS |
| ︙ | ︙ | |||
70 71 72 73 74 75 76 | \fBTcl_AttemptSetObjLength\fR(\fIobjPtr, newLength\fR) .sp Tcl_Obj * \fBTcl_ConcatObj\fR(\fIobjc, objv\fR) .SH ARGUMENTS .AS "const Tcl_UniChar" *appendObjPtr in/out .AP "const char" *bytes in | < < | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | \fBTcl_AttemptSetObjLength\fR(\fIobjPtr, newLength\fR) .sp Tcl_Obj * \fBTcl_ConcatObj\fR(\fIobjc, objv\fR) .SH ARGUMENTS .AS "const Tcl_UniChar" *appendObjPtr in/out .AP "const char" *bytes in Points to the first byte of an array of UTF-8-encoded bytes used to set or append to a string object. This byte array may contain embedded null characters unless \fInumChars\fR is negative. (Applications needing null bytes should represent them as the two-byte sequence \fI\\700\\600\fR, use \fBTcl_ExternalToUtf\fR to convert, or \fBTcl_NewByteArrayObj\fR if the string is a collection of uninterpreted bytes.) .AP int length in The number of bytes to copy from \fIbytes\fR when initializing, setting, or appending to a string object. If negative, all bytes up to the first null are used. .AP "const Tcl_UniChar" *unicode in Points to the first byte of an array of Unicode characters used to set or append to a string object. |
| ︙ | ︙ |
Changes to doc/Thread.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1999 Scriptics Corporation '\" Copyright (c) 1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1999 Scriptics Corporation '\" Copyright (c) 1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Thread.3,v 1.23.2.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Threads 3 "8.1" Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_ConditionNotify, Tcl_ConditionWait, Tcl_ConditionFinalize, Tcl_GetThreadData, Tcl_MutexLock, Tcl_MutexUnlock, Tcl_MutexFinalize, Tcl_CreateThread, Tcl_JoinThread \- Tcl thread support .SH SYNOPSIS |
| ︙ | ︙ |
Changes to doc/TraceVar.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: TraceVar.3,v 1.13.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Tcl_TraceVar 3 7.4 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_TraceVar, Tcl_TraceVar2, Tcl_UntraceVar, Tcl_UntraceVar2, Tcl_VarTraceInfo, Tcl_VarTraceInfo2 \- monitor accesses to a variable .SH SYNOPSIS |
| ︙ | ︙ | |||
104 105 106 107 108 109 110 | \fBTCL_TRACE_ARRAY\fR Invoke \fIproc\fR whenever the array command is invoked. This gives the trace procedure a chance to update the array before array names or array get is called. Note that this is called before an array set, but that will trigger write traces. .TP \fBTCL_TRACE_RESULT_DYNAMIC\fR | < < < < | 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 | \fBTCL_TRACE_ARRAY\fR Invoke \fIproc\fR whenever the array command is invoked. This gives the trace procedure a chance to update the array before array names or array get is called. Note that this is called before an array set, but that will trigger write traces. .TP \fBTCL_TRACE_RESULT_DYNAMIC\fR The result of invoking the \fIproc\fR is a dynamically allocated string that will be released by the Tcl library via a call to \fBckfree\fR. Must not be specified at the same time as \fBTCL_TRACE_RESULT_OBJECT\fR. .TP \fBTCL_TRACE_RESULT_OBJECT\fR The result of invoking the \fIproc\fR is a Tcl_Obj* (cast to a char*) with a reference count of at least one. The ownership of that reference will be transferred to the Tcl core for release (when the core has finished with it) via a call to \fBTcl_DecrRefCount\fR. Must not be specified at the same time as \fBTCL_TRACE_RESULT_DYNAMIC\fR. .PP Whenever one of the specified operations occurs on the variable, \fIproc\fR will be invoked. It should have arguments and result that match the type \fBTcl_VarTraceProc\fR: .CS typedef char *Tcl_VarTraceProc( |
| ︙ | ︙ | |||
205 206 207 208 209 210 211 | .PP The procedures \fBTcl_TraceVar2\fR, \fBTcl_UntraceVar2\fR, and \fBTcl_VarTraceInfo2\fR are identical to \fBTcl_TraceVar\fR, \fBTcl_UntraceVar\fR, and \fBTcl_VarTraceInfo\fR, respectively, except that the name of the variable consists of two parts. \fIName1\fR gives the name of a scalar variable or array, and \fIname2\fR gives the name of an element within an array. | < < | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | .PP The procedures \fBTcl_TraceVar2\fR, \fBTcl_UntraceVar2\fR, and \fBTcl_VarTraceInfo2\fR are identical to \fBTcl_TraceVar\fR, \fBTcl_UntraceVar\fR, and \fBTcl_VarTraceInfo\fR, respectively, except that the name of the variable consists of two parts. \fIName1\fR gives the name of a scalar variable or array, and \fIname2\fR gives the name of an element within an array. When \fIname2\fR is NULL, \fIname1\fR may contain both an array and an element name: if the name contains an open parenthesis and ends with a close parenthesis, then the value between the parentheses is treated as an element name (which can have any string value) and the characters before the first open parenthesis are treated as the name of an array variable. If \fIname2\fR is NULL and \fIname1\fR does not refer to an array element it means that either the variable is a scalar or the trace is to be set on the entire array rather than an individual element (see WHOLE-ARRAY TRACES below for more information). .SH "ACCESSING VARIABLES DURING TRACES" |
| ︙ | ︙ | |||
321 322 323 324 325 326 327 | .PP Under normal conditions trace procedures should return NULL, indicating successful completion. If \fIproc\fR returns a non-NULL value it signifies that an error occurred. The return value must be a pointer to a static character string containing an error message, | < < | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | .PP Under normal conditions trace procedures should return NULL, indicating successful completion. If \fIproc\fR returns a non-NULL value it signifies that an error occurred. The return value must be a pointer to a static character string containing an error message, unless (\fIexactly\fR one of) the \fBTCL_TRACE_RESULT_DYNAMIC\fR and \fBTCL_TRACE_RESULT_OBJECT\fR flags is set, which specify that the result is either a dynamic string (to be released with \fBckfree\fR) or a Tcl_Obj* (cast to char* and to be released with \fBTcl_DecrRefCount\fR) containing the error message. If a trace procedure returns an error, no further traces are invoked for the access and the traced access aborts with the given message. Trace procedures can use this facility to make variables read-only, for example (but note that the value of the variable will already have been modified before the trace procedure is called, so the trace procedure will have to restore the correct |
| ︙ | ︙ |
Changes to doc/Utf.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < | | < | < | < | | | | < < < < > > > > > > > > | | | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 | '\" '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Utf.3,v 1.20.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH Utf 3 "8.1" Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_UniChar, Tcl_UniCharCaseMatch, Tcl_UniCharNcasecmp, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UtfCharComplete, Tcl_NumUtfChars, Tcl_UtfFindFirst, Tcl_UtfFindLast, Tcl_UtfNext, Tcl_UtfPrev, Tcl_UniCharAtIndex, Tcl_UtfAtIndex, Tcl_UtfBackslash \- routines for manipulating UTF-8 strings .SH SYNOPSIS .nf \fB#include <tcl.h>\fR .sp typedef ... Tcl_UniChar; .sp int \fBTcl_UniCharToUtf\fR(\fIch, buf\fR) .sp int \fBTcl_UtfToUniChar\fR(\fIsrc, chPtr\fR) .sp char * \fBTcl_UniCharToUtfDString\fR(\fIuniStr, uniLength, dsPtr\fR) .sp Tcl_UniChar * \fBTcl_UtfToUniCharDString\fR(\fIsrc, length, dsPtr\fR) .sp int \fBTcl_UniCharLen\fR(\fIuniStr\fR) .sp int \fBTcl_UniCharNcmp\fR(\fIucs, uct, numChars\fR) .sp int \fBTcl_UniCharNcasecmp\fR(\fIucs, uct, numChars\fR) .sp int \fBTcl_UniCharCaseMatch\fR(\fIuniStr, uniPattern, nocase\fR) .sp int \fBTcl_UtfNcmp\fR(\fIcs, ct, numChars\fR) .sp int \fBTcl_UtfNcasecmp\fR(\fIcs, ct, numChars\fR) .sp int \fBTcl_UtfCharComplete\fR(\fIsrc, length\fR) .sp int \fBTcl_NumUtfChars\fR(\fIsrc, length\fR) .sp const char * \fBTcl_UtfFindFirst\fR(\fIsrc, ch\fR) .sp const char * \fBTcl_UtfFindLast\fR(\fIsrc, ch\fR) .sp const char * \fBTcl_UtfNext\fR(\fIsrc\fR) .sp const char * \fBTcl_UtfPrev\fR(\fIsrc, start\fR) .sp Tcl_UniChar \fBTcl_UniCharAtIndex\fR(\fIsrc, index\fR) .sp const char * \fBTcl_UtfAtIndex\fR(\fIsrc, index\fR) .sp int \fBTcl_UtfBackslash\fR(\fIsrc, readPtr, dst\fR) .SH ARGUMENTS .AS "const Tcl_UniChar" *uniPattern in/out .AP char *buf out Buffer in which the UTF-8 representation of the Tcl_UniChar is stored. At most \fBTCL_UTF_MAX\fR bytes are stored in the buffer. .AP int ch in The Tcl_UniChar to be converted or examined. .AP Tcl_UniChar *chPtr out Filled with the Tcl_UniChar represented by the head of the UTF-8 string. .AP "const char" *src in Pointer to a UTF-8 string. .AP "const char" *cs in Pointer to a UTF-8 string. .AP "const char" *ct in Pointer to a UTF-8 string. .AP "const Tcl_UniChar" *uniStr in A null-terminated Unicode string. .AP "const Tcl_UniChar" *ucs in A null-terminated Unicode string. .AP "const Tcl_UniChar" *uct in A null-terminated Unicode string. .AP "const Tcl_UniChar" *uniPattern in A null-terminated Unicode string. .AP int length in The length of the UTF-8 string in bytes (not UTF-8 characters). If negative, all bytes up to the first null byte are used. .AP int uniLength in The length of the Unicode string in characters. Must be greater than or equal to 0. .AP "Tcl_DString" *dsPtr in/out A pointer to a previously initialized \fBTcl_DString\fR. .AP "unsigned long" numChars in The number of characters to compare. .AP "const char" *start in Pointer to the beginning of a UTF-8 string. .AP int index in The index of a character (not byte) in the UTF-8 string. .AP int *readPtr out If non-NULL, filled with the number of bytes in the backslash sequence, including the backslash character. .AP char *dst out Buffer in which the bytes represented by the backslash sequence are stored. At most \fBTCL_UTF_MAX\fR bytes are stored in the buffer. .AP int nocase in Specifies whether the match should be done case-sensitive (0) or case-insensitive (1). .BE .SH DESCRIPTION .PP These routines convert between UTF-8 strings and Tcl_UniChars. A Tcl_UniChar is a Unicode character represented as an unsigned, fixed-size quantity. A UTF-8 character is a Unicode character represented as |
| ︙ | ︙ | |||
146 147 148 149 150 151 152 | is known to be null-terminated, this will not happen. If the input is not in proper UTF-8 format, \fBTcl_UtfToUniChar\fR will store the first byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar between 0x0000 and 0x00ff and return 1. .PP \fBTcl_UniCharToUtfDString\fR converts the given Unicode string to UTF-8, storing the result in a previously initialized \fBTcl_DString\fR. | | | > | | < < | | | | 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 | is known to be null-terminated, this will not happen. If the input is not in proper UTF-8 format, \fBTcl_UtfToUniChar\fR will store the first byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar between 0x0000 and 0x00ff and return 1. .PP \fBTcl_UniCharToUtfDString\fR converts the given Unicode string to UTF-8, storing the result in a previously initialized \fBTcl_DString\fR. You must specify \fIuniLength\fR, the length of the given Unicode string. The return value is a pointer to the UTF-8 representation of the Unicode string. Storage for the return value is appended to the end of the \fBTcl_DString\fR. .PP \fBTcl_UtfToUniCharDString\fR converts the given UTF-8 string to Unicode, storing the result in the previously initialized \fBTcl_DString\fR. In the argument \fIlength\fR, you may either specify the length of the given UTF-8 string in bytes or "-1", in which case \fBTcl_UtfToUniCharDString\fR uses \fBstrlen\fR to calculate the length. The return value is a pointer to the Unicode representation of the UTF-8 string. Storage for the return value is appended to the end of the \fBTcl_DString\fR. The Unicode string is terminated with a Unicode null character. .PP \fBTcl_UniCharLen\fR corresponds to \fBstrlen\fR for Unicode characters. It accepts a null-terminated Unicode string and returns the number of Unicode characters (not bytes) in that string. .PP \fBTcl_UniCharNcmp\fR and \fBTcl_UniCharNcasecmp\fR correspond to \fBstrncmp\fR and \fBstrncasecmp\fR, respectively, for Unicode characters. They accept two null-terminated Unicode strings and the number of characters to compare. Both strings are assumed to be at least \fInumChars\fR characters long. \fBTcl_UniCharNcmp\fR compares the two strings character-by-character according to the Unicode character ordering. It returns an integer greater than, equal to, or less than 0 if the first string is greater than, equal to, or less than the second string respectively. \fBTcl_UniCharNcasecmp\fR is the Unicode case insensitive version. .PP \fBTcl_UniCharCaseMatch\fR is the Unicode equivalent to \fBTcl_StringCaseMatch\fR. It accepts a null-terminated Unicode string, a Unicode pattern, and a boolean value specifying whether the match should be case sensitive and returns whether the string matches the pattern. .PP \fBTcl_UtfNcmp\fR corresponds to \fBstrncmp\fR for UTF-8 strings. It accepts two null-terminated UTF-8 strings and the number of characters to compare. (Both strings are assumed to be at least \fInumChars\fR characters long.) \fBTcl_UtfNcmp\fR compares the two strings character-by-character according to the Unicode character ordering. It returns an integer greater than, equal to, or less than 0 if the first string is greater than, equal to, or less than the second string respectively. .PP \fBTcl_UtfNcasecmp\fR corresponds to \fBstrncasecmp\fR for UTF-8 strings. It is similar to \fBTcl_UtfNcmp\fR except comparisons ignore differences in case when comparing upper, lower or title case characters. .PP \fBTcl_UtfCharComplete\fR returns 1 if the source UTF-8 string \fIsrc\fR of \fIlength\fR bytes is long enough to be decoded by \fBTcl_UtfToUniChar\fR, or 0 otherwise. This function does not guarantee that the UTF-8 string is properly formed. This routine is used by procedures that are operating on a byte at a time and need to know if a full Tcl_UniChar has been seen. .PP \fBTcl_NumUtfChars\fR corresponds to \fBstrlen\fR for UTF-8 strings. It returns the number of Tcl_UniChars that are represented by the UTF-8 string \fIsrc\fR. The length of the source string is \fIlength\fR bytes. If the length is negative, all bytes up to the first null byte are used. .PP \fBTcl_UtfFindFirst\fR corresponds to \fBstrchr\fR for UTF-8 strings. It returns a pointer to the first occurrence of the Tcl_UniChar \fIch\fR in the null-terminated UTF-8 string \fIsrc\fR. The null terminator is considered part of the UTF-8 string. .PP |
| ︙ | ︙ |
Changes to doc/array.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993-1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993-1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: array.n,v 1.13.4.1 2005/06/13 01:45:37 msofer Exp $ '\" .so man.macros .TH array n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME array \- Manipulate array variables |
| ︙ | ︙ | |||
118 119 120 121 122 123 124 | search identifier that must be used in \fBarray nextelement\fR and \fBarray donesearch\fR commands; it allows multiple searches to be underway simultaneously for the same array. It is currently more efficient and easier to use either the \fBarray get\fR or \fBarray names\fR, together with \fBforeach\fR, to iterate over all but very large arrays. See the examples below for how to do this. | < < < < | 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 |
search identifier that must be used in \fBarray nextelement\fR
and \fBarray donesearch\fR commands; it allows multiple
searches to be underway simultaneously for the same array.
It is currently more efficient and easier to use either the \fBarray
get\fR or \fBarray names\fR, together with \fBforeach\fR, to iterate
over all but very large arrays. See the examples below for how to do
this.
.TP
\fBarray statistics \fIarrayName\fR
Returns statistics about the distribution of data within the hashtable
that represents the array. This information includes the number of
entries in the table, the number of buckets, and the utilization of
the buckets.
.TP
\fBarray unset \fIarrayName\fR ?\fIpattern\fR?
Unsets all of the elements in the array that match \fIpattern\fR (using the
matching rules of \fBstring match\fR). If \fIarrayName\fR isn't the name
of an array variable or there are no matching elements in the array, no
error will be raised. If \fIpattern\fR is omitted and \fIarrayName\fR is
an array variable, then the command unsets the entire array.
The command always returns an empty string.
.SH EXAMPLES
.CS
\fBarray set\fR colorcount {
red 1
green 5
blue 4
white 9
|
| ︙ | ︙ |
Changes to doc/binary.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1997 by Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1997 by Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: binary.n,v 1.25.2.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH binary n 8.0 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME binary \- Insert and extract fields from binary strings |
| ︙ | ︙ |
Added doc/chan.n.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
'\"
'\" Copyright (c) 2005 Donal K. Fellows
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: chan.n,v 1.2.2.2 2005/06/13 01:45:38 msofer Exp $
.so man.macros
.TH chan n 8.5 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
chan \- Read, write and manipulate channels
.SH SYNOPSIS
\fBchan \fIoption\fR ?\fIarg arg ...\fR?
.BE
.SH DESCRIPTION
.PP
This command provides several operations for reading from, writing to
and otherwise manipulating open channels (such as have been created
with the \fBopen\fR and \fBsocket\fR commands, or the default named
channels \fBstdin\fR, \fBstdout\fR or \fBstderr\fR which correspond to
the process's standard input, output and error streams respectively).
\fIOption\fR indicates what to do with the channel; any unique
abbreviation for \fIoption\fR is acceptable. Valid options are:
.TP
\fBchan blocked \fIchannelId\fR
.
This tests whether the last input operation on the channel called
\fIchannelId\fR failed because it would have otherwise caused the
process to block, and returns 1 if that was the case. It returns 0
otherwise. Note that this only ever returns 1 when the channel has
been configured to be non-blocking; all Tcl channels have blocking
turned on by default.
.TP
\fBchan close \fIchannelId\fR
.
Close and destroy the channel called \fIchannelId\fR. Note that this
deletes all existing file-events registered on the channel.
.RS
.PP
As part of closing the channel, all buffered output is flushed to the
channel's outpuot device, any buffered input is discarded, the
underlying operating system resource is closed and \fIchannelId\fR
becomes unavailable for future use.
.PP
If the channel is blocking, the command does not return until all
output is flushed. If the channel is nonblocking and there is
unflushed output, the channel remains open and the command returns
immediately; output will be flushed in the background and the channel
will be closed when all the flushing is complete.
.PP
If \fIchannelId\fR is a blocking channel for a command pipeline then
\fBchan close\fR waits for the child processes to complete.
.PP
If the channel is shared between interpreters, then \fBchan close\fR
makes \fIchannelId\fR unavailable in the invoking interpreter but has
no other effect until all of the sharing interpreters have closed the
channel. When the last interpreter in which the channel is registered
invokes \fBchan close\fR (or \fBclose\fR), the cleanup actions
described above occur. See the \fBinterp\fR command for a description
of channel sharing.
.PP
Channels are automatically closed when an interpreter is destroyed and
when the process exits. Channels are switched to blocking mode, to
ensure that all output is correctly flushed before the process exits.
.PP
The command returns an empty string, and may generate an error if
an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBchan close\fR
generates an error (similar to the \fBexec\fR command.)
.RE
.TP
\fBchan configure \fIchannelId\fR ?\fIoptionName\fR? ?\fIvalue\fR? ?\fIoptionName value\fR?...
.
Query or set the configuration options of the channel named
\fIchannelId\fR.
.RS
.PP
If no \fIoptionName\fR or \fIvalue\fR arguments are supplied, the
command returns a list containing alternating option names and values
for the channel. If \fIoptionName\fR is supplied but no \fIvalue\fR
then the command returns the current value of the given option. If
one or more pairs of \fIoptionName\fR and \fIvalue\fR are supplied,
the command sets each of the named options to the corresponding
\fIvalue\fR; in this case the return value is an empty string.
.PP
The options described below are supported for all channels. In
addition, each channel type may add options that only it supports. See
the manual entry for the command that creates each type of channels
for the options that that specific type of channel supports. For
example, see the manual entry for the \fBsocket\fR command for its
additional options.
.TP
\fB\-blocking\fR \fIboolean\fR
.
The \fB\-blocking\fR option determines whether I/O operations on the
channel can cause the process to block indefinitely. The value of the
option must be a proper boolean value. Channels are normally in
blocking mode; if a channel is placed into nonblocking mode it will
affect the operation of the \fBchan gets\fR, \fBchan read\fR, \fBchan
puts\fR, \fBchan flush\fR, and \fBchan close\fR commands; see the
documentation for those commands for details. For nonblocking mode to
work correctly, the application must be using the Tcl event loop
(e.g. by calling \fBTcl_DoOneEvent\fR or invoking the \fBvwait\fR
command).
.TP
\fB\-buffering\fR \fInewValue\fR
.
If \fInewValue\fR is \fBfull\fR then the I/O system will buffer output
until its internal buffer is full or until the \fBchan flush\fR
command is invoked. If \fInewValue\fR is \fBline\fR, then the I/O
system will automatically flush output for the channel whenever a
newline character is output. If \fInewValue\fR is \fBnone\fR, the I/O
system will flush automatically after every output operation. The
default is for \fB\-buffering\fR to be set to \fBfull\fR except for
channels that connect to terminal-like devices; for these channels the
initial setting is \fBline\fR. Additionally, \fBstdin\fR and
\fBstdout\fR are initially set to \fBline\fR, and \fBstderr\fR is set
to \fBnone\fR.
.TP
\fB\-buffersize\fR \fInewSize\fR
.
\fINewvalue\fR must be an integer; its value is used to set the size
of buffers, in bytes, subsequently allocated for this channel to store
input or output. \fINewvalue\fR must be a number of no more than one
million, allowing buffers of up to one million bytes in size.
.TP
\fB\-encoding\fR \fIname\fR
.
This option is used to specify the encoding of the channel as one of
the named encodings returned by \fBencoding names\fR or the special
value \fBbinary\fR, so that the data can be converted to and from
Unicode for use in Tcl. For instance, in order for Tcl to read
characters from a Japanese file in \fBshiftjis\fR and properly process
and display the contents, the encoding would be set to \fBshiftjis\fR.
Thereafter, when reading from the channel, the bytes in the Japanese
file would be converted to Unicode as they are read. Writing is also
supported \- as Tcl strings are written to the channel they will
automatically be converted to the specified encoding on output.
.RS
.PP
If a file contains pure binary data (for instance, a JPEG image), the
encoding for the channel should be configured to be \fBbinary\fR. Tcl
will then assign no interpretation to the data in the file and simply
read or write raw bytes. The Tcl \fBbinary\fR command can be used to
manipulate this byte-oriented data. It is usually better to set the
\fB\-translation\fR option to \fBbinary\fR when you want to transfer
binary data, as this turns off the other automatic interpretations of
the bytes in the stream as well.
.PP
The default encoding for newly opened channels is the same platform-
and locale-dependent system encoding used for interfacing with the
operating system, as returned by \fBencoding system\fR.
.RE
.TP
\fB\-eofchar\fR \fIchar\fR
.TP
\fB\-eofchar\fR \fB{\fIinChar outChar\fB}\fR
.
This option supports DOS file systems that use Control-z (\ex1a) as an
end of file marker. If \fIchar\fR is not an empty string, then this
character signals end-of-file when it is encountered during input.
For output, the end-of-file character is output when the channel is
closed. If \fIchar\fR is the empty string, then there is no special
end of file character marker. For read-write channels, a two-element
list specifies the end of file marker for input and output,
respectively. As a convenience, when setting the end-of-file
character for a read-write channel you can specify a single value that
will apply to both reading and writing. When querying the end-of-file
character of a read-write channel, a two-element list will always be
returned. The default value for \fB\-eofchar\fR is the empty string
in all cases except for files under Windows. In that case the
\fB\-eofchar\fR is Control-z (\ex1a) for reading and the empty string
for writing.
.TP
\fB\-translation\fR \fImode\fR
.TP
\fB\-translation\fR \fB{\fIinMode outMode\fB}\fR
.
In Tcl scripts the end of a line is always represented using a single
newline character (\en). However, in actual files and devices the end
of a line may be represented differently on different platforms, or
even for different devices on the same platform. For example, under
UNIX newlines are used in files, whereas carriage-return-linefeed
sequences are normally used in network connections. On input (i.e.,
with \fBchan gets\fP and \fBchan read\fP) the Tcl I/O system
automatically translates the external end-of-line representation into
newline characters. Upon output (i.e., with \fBchan puts\fP), the I/O
system translates newlines to the external end-of-line representation.
The default translation mode, \fBauto\fP, handles all the common cases
automatically, but the \fB\-translation\fR option provides explicit
control over the end of line translations.
.RS
.PP
The value associated with \fB\-translation\fR is a single item for
read-only and write-only channels. The value is a two-element list for
read-write channels; the read translation mode is the first element of
the list, and the write translation mode is the second element. As a
convenience, when setting the translation mode for a read-write channel
you can specify a single value that will apply to both reading and
writing. When querying the translation mode of a read-write channel, a
two-element list will always be returned. The following values are
currently supported:
.TP
\fBauto\fR
.
As the input translation mode, \fBauto\fR treats any of newline
(\fBlf\fP), carriage return (\fBcr\fP), or carriage return followed by
a newline (\fBcrlf\fP) as the end of line representation. The end of
line representation can even change from line-to-line, and all cases
are translated to a newline. As the output translation mode,
\fBauto\fR chooses a platform specific representation; for sockets on
all platforms Tcl chooses \fBcrlf\fR, for all Unix flavors, it chooses
\fBlf\fR, and for the various flavors of Windows it chooses
\fBcrlf\fR. The default setting for \fB\-translation\fR is \fBauto\fR
for both input and output.
.TP
\fBbinary\fR
.
No end-of-line translations are performed. This is nearly identical
to \fBlf\fP mode, except that in addition \fBbinary\fP mode also sets
the end-of-file character to the empty string (which disables it) and
sets the encoding to \fBbinary\fR (which disables encoding filtering).
See the description of \fB\-eofchar\fR and \fB\-encoding\fR for more
information.
.TP
\fBcr\fR
.
The end of a line in the underlying file or device is represented by a
single carriage return character. As the input translation mode,
\fBcr\fP mode converts carriage returns to newline characters. As the
output translation mode, \fBcr\fP mode translates newline characters
to carriage returns.
.TP
\fBcrlf\fR
.
The end of a line in the underlying file or device is represented by a
carriage return character followed by a linefeed character. As the
input translation mode, \fBcrlf\fP mode converts
carriage-return-linefeed sequences to newline characters. As the
output translation mode, \fBcrlf\fP mode translates newline characters
to carriage-return-linefeed sequences. This mode is typically used on
Windows platforms and for network connections.
.TP
\fBlf\fR
.
The end of a line in the underlying file or device is represented by a
single newline (linefeed) character. In this mode no translations
occur during either input or output. This mode is typically used on
UNIX platforms.
.RE
.RE
.TP
\fBchan copy \fIinputChan outputChan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR?
.
Copy data from the channel \fIinputChan\fR, which must have been
opened for reading, to the channel \fIoutputChan\fR, which must have
been opened for writing. The \fBchan copy\fR command leverages the
buffering in the Tcl I/O system to avoid extra copies and to avoid
buffering too much data in main memory when copying large files to
slow destinations like network sockets.
.RS
.PP
The \fBchan copy\fP command transfers data from \fIinputChan\fR until
end of file or \fIsize\fP bytes have been transferred. If no
\fB\-size\fP argument is given, then the copy goes until end of file.
All the data read from \fIinputChan\fR is copied to \fIoutputChan\fR.
Without the \fB\-command\fP option, \fBchan copy\fP blocks until the
copy is complete and returns the number of bytes written to
\fIoutputChan\fR.
.PP
The \fB\-command\fP argument makes \fBchan copy\fP work in the
background. In this case it returns immediately and the
\fIcallback\fP is invoked later when the copy completes. The
\fIcallback\fP is called with one or two additional arguments that
indicates how many bytes were written to \fIoutputChan\fR. If an
error occurred during the background copy, the second argument is the
error string associated with the error. With a background copy, it is
not necessary to put \fIinputChan\fR or \fIoutputChan\fR into
non-blocking mode; the \fBchan copy\fP command takes care of that
automatically. However, it is necessary to enter the event loop by
using the \fBvwait\fP command or by using Tk.
.PP
You are not allowed to do other I/O operations with \fIinputChan\fR or
\fIoutputChan\fR during a background \fBchan copy\fR. If either
\fIinputChan\fR or \fIoutputChan\fR get closed while the copy is in
progress, the current copy is stopped and the command callback is
\fInot\fP made. If \fIinputChan\fR is closed, then all data already
queued for \fIoutputChan\fR is written out.
.PP
Note that \fIinputChan\fR can become readable during a background
copy. You should turn off any \fBchan event\fP or \fBfileevent\fR
handlers during a background copy so those handlers do not interfere
with the copy. Any I/O attempted by a \fBchan event\fR or
\fBfileevent\fP handler will get a "channel busy" error.
.PP
\fBChan copy\fR translates end-of-line sequences in \fIinputChan\fR
and \fIoutputChan\fR according to the \fB\-translation\fR option for
these channels (see \fBchan configure\fR above). The translations
mean that the number of bytes read from \fIinputChan\fR can be
different than the number of bytes written to \fIoutputChan\fR. Only
the number of bytes written to \fIoutputChan\fR is reported, either as
the return value of a synchronous \fBchan copy\fP or as the argument
to the callback for an asynchronous \fBchan copy\fP.
.PP
\fBChan copy\fR obeys the encodings and character translations
configured for the channels. This means that the incoming characters
are converted internally first UTF-8 and then into the encoding of the
channel \fBchan copy\fR writes to (see \fBchan configure\fR above for
details on the \fB\-encoding\fR and \fB\-translation\fR options). No
conversion is done if both channels are set to encoding \fBbinary\fR
and have matching translations. If only the output channel is set to
encoding \fBbinary\fR the system will write the internal UTF-8
representation of the incoming characters. If only the input channel
is set to encoding \fBbinary\fR the system will assume that the
incoming bytes are valid UTF-8 characters and convert them according
to the output encoding. The behaviour of the system for bytes which
are not valid UTF-8 characters is undefined in this case.
.RE
.TP
\fBchan eof \fIchannelId\fR
.
Test whether the last input operation on the channel called
\fIchannelId\fR failed because the end of the data stream was reached,
returning 1 if end-fo-file was reached, and 0 otherwise.
.TP
\fBchan event \fIchannelId event\fR ?\fIscript\fR?
.
Arrange for the Tcl script \fIscript\fR to be installed as a \fIfile
event handler\fR to be called whenever the channel called
\fIchannelId\fR enters the state described by \fIevent\fR (which must
be either \fBreadable\fR or \fBwritable\fR); only one such handler may
be installed per event per channel at a time. If \fIscript\fR is the
empty string, the current handler is deleted (this also happens if the
channel is closed or the interpreter deleted). If \fIscript\fR is
omitted, the currently installed script is returned (or an empty
string if no such handler is installed). The callback is only
performed if the event loop is being serviced (e.g. via \fBvwait\fR or
\fBupdate\fR).
.RS
.PP
A file event handler is a binding between a channel and a script, such
that the script is evaluated whenever the channel becomes readable or
writable. File event handlers are most commonly used to allow data to
be received from another process on an event-driven basis, so that the
receiver can continue to interact with the user or with other channels
while waiting for the data to arrive. If an application invokes
\fBchan gets\fR or \fBchan read\fR on a blocking channel when there is
no input data available, the process will block; until the input data
arrives, it will not be able to service other events, so it will
appear to the user to ``freeze up''. With \fBchan event\fR, the
process can tell when data is present and only invoke \fBchan gets\fR
or \fBchan read\fR when they won't block.
.PP
A channel is considered to be readable if there is unread data
available on the underlying device. A channel is also considered to
be readable if there is unread data in an input buffer, except in the
special case where the most recent attempt to read from the channel
was a \fBchan gets\fR call that could not find a complete line in the
input buffer. This feature allows a file to be read a line at a time
in nonblocking mode using events. A channel is also considered to be
readable if an end of file or error condition is present on the
underlying file or device. It is important for \fIscript\fR to check
for these conditions and handle them appropriately; for example, if
there is no special check for end of file, an infinite loop may occur
where \fIscript\fR reads no data, returns, and is immediately invoked
again.
.PP
A channel is considered to be writable if at least one byte of data
can be written to the underlying file or device without blocking, or
if an error condition is present on the underlying file or device.
Note that client sockets opened in asynchronous mode become writable
when they become connected or if the connection fails.
.PP
Event-driven I/O works best for channels that have been placed into
nonblocking mode with the \fBchan configure\fR command. In blocking
mode, a \fBchan puts\fR command may block if you give it more data
than the underlying file or device can accept, and a \fBchan gets\fR
or \fBchan read\fR command will block if you attempt to read more data
than is ready; no events will be processed while the commands block.
In nonblocking mode \fBchan puts\fR, \fBchan read\fR, and \fBchan
gets\fR never block.
.PP
The script for a file event is executed at global level (outside the
context of any Tcl procedure) in the interpreter in which the \fBchan
event\fR command was invoked. If an error occurs while executing the
script then the command registered with \fBinterp bgerror\fR is used
to report the error. In addition, the file event handler is deleted
if it ever returns an error; this is done in order to prevent infinite
loops due to buggy handlers.
.RE
.TP
\fBchan flush \fIchannelId\fR
.
Ensures that all pending output for the channel called \fIchannelId\fR
is written.
.RS
.PP
If the channel is in blocking mode the command does not return until
all the buffered output has been flushed to the channel. If the
channel is in nonblocking mode, the command may return before all
buffered output has been flushed; the remainder will be flushed in the
background as fast as the underlying file or device is able to absorb
it.
.RE
.TP
\fBchan gets \fIchannelId\fR ?\fIvarName\fR?
.
Reads the next line from the channel called \fIchannelId\fR. If
\fIvarName\fR is not specified, the result of the command will be the
line that has been read (without a trailing newline character) or an
empty string upon end-of-file or, in non-blocking mode, if the data
available is exhausted. If \fIvarName\fR is specified, the line that
has been read will be written to the variable called \fIvarName\fR and
result will be the number of characters that have been read or -1 if
end-of-file was reached or, in non-blocking mode, if the data
available is exhausted.
.RS
.PP
If an end-of-file occurs while part way through reading a line, the
partial line will be returned (or written into \fIvarName\fR). When
\fIvarName\fR is not specified, the end-of-file case can be
distinguished from an empty line using the \fBchan eof\fR command, and
the partial-line-but-nonblocking case can be distinguished with the
\fBchan blocked\fR command.
.RE
.TP
\fBchan names\fR ?\fIpattern\fR?
.
Produces a list of all channel names. If \fIpattern\fR is specified,
only those channel names that match it (according to the rules of
\fBstring match\fR) will be returned.
.TP
\fBchan puts\fR ?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR
.
Writes \fIstring\fR to the channel named \fIchannelId\fR followed by a
newline character. A trailing newline character is written unless the
optional flag \fB\-nonewline\fR is given. If \fIchannelId\fR is
omitted, the string is written to the standard output channel,
\fBstdout\fR.
.RS
.PP
Newline characters in the output are translated by \fBchan puts\fR to
platform-specific end-of-line sequences according to the currently
configured value of the \fB\-translation\fR option for the channel
(for example, on PCs newlines are normally replaced with
carriage-return-linefeed sequences; see \fBchan configure\fR above for
details).
.PP
Tcl buffers output internally, so characters written with \fBchan
puts\fR may not appear immediately on the output file or device; Tcl
will normally delay output until the buffer is full or the channel is
closed. You can force output to appear immediately with the \fBchan
flush\fR command.
.PP
When the output buffer fills up, the \fBchan puts\fR command will
normally block until all the buffered data has been accepted for
output by the operating system. If \fIchannelId\fR is in nonblocking
mode then the \fBchan puts\fR command will not block even if the
operating system cannot accept the data. Instead, Tcl continues to
buffer the data and writes it in the background as fast as the
underlying file or device can accept it. The application must use the
Tcl event loop for nonblocking output to work; otherwise Tcl never
finds out that the file or device is ready for more output data. It
is possible for an arbitrarily large amount of data to be buffered for
a channel in nonblocking mode, which could consume a large amount of
memory. To avoid wasting memory, nonblocking I/O should normally be
used in an event-driven fashion with the \fBchan event\fR command
(don't invoke \fBchan puts\fR unless you have recently been notified
via a file event that the channel is ready for more output data).
.RE
.TP
\fBchan read \fIchannelId\fR ?\fInumChars\fR?
.TP
\fBchan read \fR?\fB\-nonewline\fR? \fIchannelId\fR
.
In the first form, the result will be the next \fInumChars\fR
characters read from the channel named \fIchannelId\fR; if
\fInumChars\fR is omitted, all characters up to the point when the
channel would signal a failure (whether an end-of-file, blocked or
other error condition) are read. In the second form (i.e. when
\fInumChars\fR has been omitted) the flag \fB\-nonewline\fR may be
given to indicate that any trailing newline in the string that has
been read should be trimmed.
.RS
.PP
If \fIchannelId\fR is in nonblocking mode, \fBchan read\fR may not
read as many characters as requested: once all available input has
been read, the command will return the data that is available rather
than blocking for more input. If the channel is configured to use a
multi-byte encoding, then there may actually be some bytes remaining
in the internal buffers that do not form a complete character. These
bytes will not be returned until a complete character is available or
end-of-file is reached. The \fB\-nonewline\fR switch is ignored if
the command returns before reaching the end of the file.
.PP
\fBChan read\fR translates end-of-line sequences in the input into
newline characters according to the \fB\-translation\fR option for the
channel (see \fBchan configure\fR above for a discussion on the ways
in which \fBchan configure\fR will alter input).
.PP
When reading from a serial port, most applications should configure
the serial port channel to be nonblocking, like this:
.CS
\fBchan configure \fIchannelId \fB\-blocking \fI0\fR.
.CE
Then \fBchan read\fR behaves much like described above. Note that
most serial ports are comparatively slow; it is entirely possible to
get a \fBreadable\fR event for each character read from them. Care
must be taken when using \fBchan read\fR on blocking serial ports:
.TP
\fBchan read \fIchannelId numChars\fR
.
In this form \fBchan read\fR blocks until \fInumChars\fR have been
received from the serial port.
.TP
\fBchan read \fIchannelId\fR
.
In this form \fBchan read\fR blocks until the reception of the
end-of-file character, see \fBchan configure -eofchar\fR. If there no
end-of-file character has been configured for the channel, then
\fBchan read\fR will block forever.
.RE
.TP
\fBchan seek \fIchannelId offset\fR ?\fIorigin\fR?
.
Sets the current access position within the underlying data stream for
the channel named \fIchannelId\fR to be \fIoffset\fR bytes relative to
\fIorigin\fR. \fIOffset\fR must be an integer (which may be negative)
and \fIorigin\fR must be one of the following:
.RS
.TP 10
\fBstart\fR
.
The new access position will be \fIoffset\fR bytes from the start
of the underlying file or device.
.TP 10
\fBcurrent\fR
.
The new access position will be \fIoffset\fR bytes from the current
access position; a negative \fIoffset\fR moves the access position
backwards in the underlying file or device.
.TP 10
\fBend\fR
.
The new access position will be \fIoffset\fR bytes from the end of the
file or device. A negative \fIoffset\fR places the access position
before the end of file, and a positive \fIoffset\fR places the access
position after the end of file.
.PP
The \fIorigin\fR argument defaults to \fBstart\fR.
.PP
\fBChan seek\fR flushes all buffered output for the channel before the
command returns, even if the channel is in nonblocking mode. It also
discards any buffered and unread input. This command returns an empty
string. An error occurs if this command is applied to channels whose
underlying file or device does not support seeking.
.PP
Note that \fIoffset\fR values are byte offsets, not character offsets.
Both \fBchan seek\fR and \fBchan tell\fR operate in terms of bytes,
not characters, unlike \fBchan read\fR.
.RE
.TP
\fBchan tell \fIchannelId\fR
.
Returns a number giving the current access position within the
underlying data stream for the channel named \fIchannelId\fR. This
value returned is a byte offset that can be passed to \fBchan seek\fR
in order to set the channel to a particular position. Note that this
value is in terms of bytes, not characters like \fBchan read\fR. The
value returned is -1 for channels that do not support seeking.
.TP
\fBchan truncate \fIchannelId\fR ?\fIlength\fR?
.
Sets the byte length of the underlying data stream for the channel
named \fIchannelId\fR to be \fIlength\fR (or to the current byte
offset within the underlying data stream if \fIlength\fR is
omitted). The channel is flushed before truncation.
.SH "SEE ALSO"
close(n), eof(n), fblocked(n), fconfigure(n), fcopy(n), file(n),
fileevent(n), flush(n), gets(n), open(n), puts(n), read(n), seek(n),
socket(n), tell(n)
.SH KEYWORDS
channel, input, output, events, offset
|
Changes to doc/close.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: close.n,v 1.8.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH close n 7.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME close \- Close an open channel .SH SYNOPSIS \fBclose \fIchannelId\fR .BE .SH DESCRIPTION .PP Closes the channel given by \fIchannelId\fR. .PP \fIChannelId\fR must be an identifier for an open channel such as a Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR), the return value from an invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel creation command provided by a Tcl extension. .PP All buffered output is flushed to the channel's output device, any buffered input is discarded, the underlying file or device is closed, and \fIchannelId\fR becomes unavailable for use. .PP If the channel is blocking, the command does not return until all output is flushed. If the channel is nonblocking and there is unflushed output, the channel remains open and the command returns immediately; output will be flushed in the background and the channel will be closed when all the flushing is complete. .PP If \fIchannelId\fR is a blocking channel for a command pipeline then \fBclose\fR waits for the child processes to complete. .PP If the channel is shared between interpreters, then \fBclose\fR makes \fIchannelId\fR unavailable in the invoking interpreter but has no other effect until all of the sharing interpreters have closed the channel. When the last interpreter in which the channel is registered invokes \fBclose\fR, the cleanup actions described above occur. See the \fBinterp\fR command for a description of channel sharing. .PP Channels are automatically closed when an interpreter is destroyed and when the process exits. Channels are switched to blocking mode, to ensure that all output is correctly flushed before the process exits. .PP The command returns an empty string, and may generate an error if an error occurs while flushing output. If a command in a command pipeline created with \fBopen\fR returns an error, \fBclose\fR generates an error (similar to the \fBexec\fR command.) .SH EXAMPLE This illustrates how you can use Tcl to ensure that files get closed |
| ︙ | ︙ |
Changes to doc/error.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: error.n,v 1.8.2.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH error n "" Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME error \- Generate an error |
| ︙ | ︙ |
Changes to doc/expr.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-2000 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-2000 Sun Microsystems, Inc. '\" Copyright (c) 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: expr.n,v 1.18.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH expr n 8.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME expr \- Evaluate an expression |
| ︙ | ︙ | |||
80 81 82 83 84 85 86 | will be used as the operand without any substitutions. .IP [6] As a Tcl command enclosed in brackets. The command will be executed and its result will be used as the operand. .IP [7] As a mathematical function whose arguments have any of the above | | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | will be used as the operand without any substitutions. .IP [6] As a Tcl command enclosed in brackets. The command will be executed and its result will be used as the operand. .IP [7] As a mathematical function whose arguments have any of the above forms for operands, such as \fBsin($x)\fR. See MATH FUNCTIONS below for a discussion of how mathematical functions are handled. .LP Where the above substitutions occur (e.g. inside quoted strings), they are performed by the expression's instructions. However, the command parser may already have performed one round of substitution before the expression processor was called. As discussed below, it is usually best to enclose expressions in braces to prevent the command parser from performing substitutions |
| ︙ | ︙ | |||
207 208 209 210 211 212 213 | only one of \fB[a]\fR or \fB[b]\fR will actually be evaluated, depending on the value of \fB$v\fR. Note, however, that this is only true if the entire expression is enclosed in braces; otherwise the Tcl parser will evaluate both \fB[a]\fR and \fB[b]\fR before invoking the \fBexpr\fR command. .SS "MATH FUNCTIONS" .PP | > | < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > | | < < < < | < < | < | < | < < < < | < < | > > | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > > | 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 |
only one of \fB[a]\fR or \fB[b]\fR will actually be evaluated,
depending on the value of \fB$v\fR. Note, however, that this is
only true if the entire expression is enclosed in braces; otherwise
the Tcl parser will evaluate both \fB[a]\fR and \fB[b]\fR before
invoking the \fBexpr\fR command.
.SS "MATH FUNCTIONS"
.PP
.VS 8.5
When the expression parser encounters a mathematical function
such as \fBsin($x)\fR, it replaces it with a call to an ordinary
Tcl function in the \fBtcl::mathfunc\fR namespace. The processing
of an expression such as:
.CS
\fBexpr {sin($x+$y)}\fR
.CE
is the same in every way as the processing of:
.CS
\fBexpr {[tcl::mathfunc::sin [expr {$x+$y}]]}\fR
.CE
The executor will search for \fBtcl::mathfunc::sin\fR using the usual
rules for resolving functions in namespaces. Either
\fB::tcl::mathfunc::sin\fR or \fB[namespace
current]::tcl::mathfunc::sin\fR will satisfy the request, and others
may as well (depending on the current \fBnamespace path\fR setting).
.PP
See the \fBmathfunc\fR(n) manual page for the math functions that are
available by default.
.VE 8.5
.SS "TYPES, OVERFLOW, AND PRECISION"
.PP
All internal computations involving integers are done with the C type
\fIlong\fR, and all internal computations involving floating-point are
done with the C type \fIdouble\fR.
When converting a string to floating-point, exponent overflow is
detected and results in a Tcl error.
|
| ︙ | ︙ | |||
426 427 428 429 430 431 432 | unbraced expressions that contain command substitutions. These expressions must be implemented by generating new code each time the expression is executed. .SH EXAMPLES Define a procedure that computes an "interesting" mathematical function: .CS | | | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
unbraced expressions that contain command substitutions.
These expressions must be implemented by generating new code
each time the expression is executed.
.SH EXAMPLES
Define a procedure that computes an "interesting" mathematical
function:
.CS
proc tcl::mathfunc::calc {x y} {
\fBexpr\fR { ($x**2 - $y**2) / exp($x**2 + $y**2) }
}
.CE
.PP
Convert polar coordinates into cartesian coordinates:
.CS
# convert from ($radius,$angle)
|
| ︙ | ︙ | |||
466 467 468 469 470 471 472 |
.PP
Generate a random integer in the range 0..99 inclusive:
.CS
set randNum [\fBexpr\fR { int(100 * rand()) }]
.CE
.SH "SEE ALSO"
| | > > > > > > > | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
.PP
Generate a random integer in the range 0..99 inclusive:
.CS
set randNum [\fBexpr\fR { int(100 * rand()) }]
.CE
.SH "SEE ALSO"
array(n), for(n), if(n), mathfunc(n), namespace(n), proc(n), string(n), Tcl(n), while(n)
.SH KEYWORDS
arithmetic, boolean, compare, expression, fuzzy comparison
.SH COPYRIGHT
Copyright (c) 1993 The Regents of the University of California.
.br
Copyright (c) 1994-2000 Sun Microsystems Incorporated.
.br
Copyright (c) 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved.
|
Changes to doc/fblocked.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | '\" '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: fblocked.n,v 1.6.4.1 2005/06/13 01:45:38 msofer Exp $ .so man.macros .TH fblocked n 7.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME fblocked \- Test whether the last input operation exhausted all available input .SH SYNOPSIS \fBfblocked \fIchannelId\fR .BE .SH DESCRIPTION .PP The \fBfblocked\fR command returns 1 if the most recent input operation on \fIchannelId\fR returned less information than requested because all available input was exhausted. For example, if \fBgets\fR is invoked when there are only three characters available for input and no end-of-line sequence, \fBgets\fR returns an empty string and a subsequent call to \fBfblocked\fR will return 1. .PP \fIChannelId\fR must be an identifier for an open channel such as a Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR), the return value from an invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel creation command provided by a Tcl extension. .SH EXAMPLE The \fBfblocked\fR command is particularly useful when writing network servers, as it allows you to write your code in a line-by-line style without preventing the servicing of other connections. This can be seen in this simple echo-service: .PP .CS |
| ︙ | ︙ |
Changes to doc/fconfigure.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: fconfigure.n,v 1.11.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH fconfigure n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME fconfigure \- Set and get options on a channel |
| ︙ | ︙ | |||
87 88 89 90 91 92 93 | will automatically be converted to the specified encoding on output. .RS .PP If a file contains pure binary data (for instance, a JPEG image), the encoding for the channel should be configured to be \fBbinary\fR. Tcl will then assign no interpretation to the data in the file and simply read or write raw bytes. The Tcl \fBbinary\fR command can be used to manipulate this | | > > > | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
will automatically be converted to the specified encoding on output.
.RS
.PP
If a file contains pure binary data (for instance, a JPEG image), the
encoding for the channel should be configured to be \fBbinary\fR. Tcl
will then assign no interpretation to the data in the file and simply read or
write raw bytes. The Tcl \fBbinary\fR command can be used to manipulate this
byte-oriented data. It is usually better to set the
\fB\-translation\fR option to \fBbinary\fR when you want to transfer
binary data, as this turns off the other automatic interpretations of
the bytes in the stream as well.
.PP
The default encoding for newly opened channels is the same platform- and
locale-dependent system encoding used for interfacing with the operating
system, as returned by \fBencoding system\fR.
.RE
.TP
\fB\-eofchar\fR \fIchar\fR
.TP
\fB\-eofchar\fR \fB{\fIinChar outChar\fB}\fR
.
This option supports DOS file systems that use Control-z (\ex1a) as an
|
| ︙ | ︙ |
Changes to doc/fcopy.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: fcopy.n,v 1.4.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH fcopy n 8.0 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME fcopy \- Copy data from one channel to another |
| ︙ | ︙ | |||
68 69 70 71 72 73 74 | \fB\-translation\fR option. The translations mean that the number of bytes read from \fIinchan\fR can be different than the number of bytes written to \fIoutchan\fR. Only the number of bytes written to \fIoutchan\fR is reported, either as the return value of a synchronous \fBfcopy\fP or as the argument to the callback for an asynchronous \fBfcopy\fP. .PP | > | > | > | | > > > > > > > > > > | | < | | | < | | 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 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 |
\fB\-translation\fR option.
The translations mean that the number of bytes read from \fIinchan\fR
can be different than the number of bytes written to \fIoutchan\fR.
Only the number of bytes written to \fIoutchan\fR is reported,
either as the return value of a synchronous \fBfcopy\fP or
as the argument to the callback for an asynchronous \fBfcopy\fP.
.PP
\fBFcopy\fR obeys the encodings and character translations configured
for the channels. This
means that the incoming characters are converted internally first
UTF-8 and then into the encoding of the channel \fBfcopy\fR writes
to. See the manual entry for \fBfconfigure\fR for details on the
\fB\-encoding\fR and \fB\-translation\fR options. No conversion is
done if both channels are
set to encoding "binary" and have matching translations. If only the
output channel is set to
encoding "binary" the system will write the internal UTF-8
representation of the incoming characters. If only the input channel
is set to encoding "binary" the system will assume that the incoming
bytes are valid UTF-8 characters and convert them according to the
output encoding. The behaviour of the system for bytes which are not
valid UTF-8 characters is undefined in this case.
.SH EXAMPLES
.PP
The first example transfers the contents of one channel exactly to
another. Note that when copying one file to another, it is better to
use \fBfile copy\fR which also copies file metadata (e.g. the file
access permissions) where possible.
.DS
fconfigure $in -translation binary
fconfigure $out -translation binary
\fBfcopy\fR $in $out
.DE
.PP
This second example shows how the callback gets
passed the number of bytes transferred.
It also uses vwait to put the application into the event loop.
Of course, this simplified example could be done without the command
callback.
.DS
proc Cleanup {in out bytes {error {}}} {
global total
set total $bytes
close $in
close $out
if {[string length $error] != 0} {
# error occurred during the copy
}
}
set in [open $file1]
set out [socket $server $port]
\fBfcopy\fR $in $out -command [list Cleanup $in $out]
vwait total
.DE
.PP
The third example copies in chunks and tests for end of file
in the command callback
.DS
proc CopyMore {in out chunk bytes {error {}}} {
global total done
incr total $bytes
if {([string length $error] != 0) || [eof $in] {
set done $total
close $in
close $out
} else {
\fBfcopy\fR $in $out -command [list CopyMore $in $out $chunk] \\
-size $chunk
}
}
set in [open $file1]
set out [socket $server $port]
set chunk 1024
set total 0
\fBfcopy\fR $in $out -command [list CopyMore $in $out $chunk] -size $chunk
vwait done
.DE
.SH "SEE ALSO"
eof(n), fblocked(n), fconfigure(n), file(n)
.SH KEYWORDS
blocking, channel, end of line, end of file, nonblocking, read, translation
|
Changes to doc/file.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: file.n,v 1.38.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH file n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME file \- Manipulate file names and attributes |
| ︙ | ︙ | |||
77 78 79 80 81 82 83 | Finder creator type of the file. \fB-hidden\fR gives or sets or clears the hidden attribute of the file. \fB-readonly\fR gives or sets or clears the readonly attribute of the file. \fB-rsrclength\fR gives the length of the resource fork of the file, this attribute can only be set to the value 0, which results in the resource fork being stripped off the file. .RE | < < | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | Finder creator type of the file. \fB-hidden\fR gives or sets or clears the hidden attribute of the file. \fB-readonly\fR gives or sets or clears the readonly attribute of the file. \fB-rsrclength\fR gives the length of the resource fork of the file, this attribute can only be set to the value 0, which results in the resource fork being stripped off the file. .RE .TP \fBfile channels ?\fIpattern\fR? . If \fIpattern\fR isn't specified, returns a list of names of all registered open channels in this interpreter. If \fIpattern\fR is specified, only those names matching \fIpattern\fR are returned. Matching is determined using the same rules as for \fBstring match\fR. .TP \fBfile copy \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIsource\fR \fItarget\fR .TP \fBfile copy \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIsource\fR ?\fIsource\fR ...? \fItargetDir\fR .RS The first form makes a copy of the file or directory \fIsource\fR under the pathname \fItarget\fR. If \fItarget\fR is an existing directory, |
| ︙ | ︙ |
Changes to doc/fileevent.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: fileevent.n,v 1.7.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH fileevent n 7.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME fileevent \- Execute a script when a channel becomes readable or writable |
| ︙ | ︙ | |||
30 31 32 33 34 35 36 | application invokes \fBgets\fR or \fBread\fR on a blocking channel when there is no input data available, the process will block; until the input data arrives, it will not be able to service other events, so it will appear to the user to ``freeze up''. With \fBfileevent\fR, the process can tell when data is present and only invoke \fBgets\fR or \fBread\fR when they won't block. .PP | < < | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | application invokes \fBgets\fR or \fBread\fR on a blocking channel when there is no input data available, the process will block; until the input data arrives, it will not be able to service other events, so it will appear to the user to ``freeze up''. With \fBfileevent\fR, the process can tell when data is present and only invoke \fBgets\fR or \fBread\fR when they won't block. .PP The \fIchannelId\fR argument to \fBfileevent\fR refers to an open channel such as a Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR), the return value from an invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel creation command provided by a Tcl extension. .PP If the \fIscript\fR argument is specified, then \fBfileevent\fR creates a new event handler: \fIscript\fR will be evaluated whenever the channel becomes readable or writable (depending on the second argument to \fBfileevent\fR). In this case \fBfileevent\fR returns an empty string. The \fBreadable\fR and \fBwritable\fR event handlers for a file |
| ︙ | ︙ |
Changes to doc/flush.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: flush.n,v 1.6.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH flush n 7.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME flush \- Flush buffered output for a channel .SH SYNOPSIS \fBflush \fIchannelId\fR .BE .SH DESCRIPTION .PP Flushes any output that has been buffered for \fIchannelId\fR. .PP \fIChannelId\fR must be an identifier for an open channel such as a Tcl standard channel (\fBstdout\fR or \fBstderr\fR), the return value from an invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel creation command provided by a Tcl extension. The channel must have been opened for writing. .PP If the channel is in blocking mode the command does not return until all the buffered output has been flushed to the channel. If the channel is in nonblocking mode, the command may return before all buffered output has been flushed; the remainder will be flushed in the background as fast as the underlying file or device is able to absorb it. .SH EXAMPLE |
| ︙ | ︙ |
Changes to doc/foreach.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: foreach.n,v 1.6.2.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH foreach n "" Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME foreach \- Iterate over all elements in one or more lists |
| ︙ | ︙ |
Changes to doc/format.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: format.n,v 1.10.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH format n 8.1 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME format \- Format a string in the style of sprintf |
| ︙ | ︙ | |||
126 127 128 129 130 131 132 | it must be a numeric string. .PP The fifth part of a conversion specifier is a length modifier, which must be \fBh\fR or \fBl\fR. If it is \fBh\fR it specifies that the numeric value should be truncated to a 16-bit value before converting. This option is rarely useful. | < < | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | it must be a numeric string. .PP The fifth part of a conversion specifier is a length modifier, which must be \fBh\fR or \fBl\fR. If it is \fBh\fR it specifies that the numeric value should be truncated to a 16-bit value before converting. This option is rarely useful. If it is \fBl\fR it specifies that the numeric value should be (at least) a 64-bit value. If neither \fBh\fR nor \fBl\fR are present, numeric values are interpreted as being values of the width of the native machine word, as described by \fBtcl_platform(wordSize)\fR. .PP The last thing in a conversion specifier is an alphabetic character that determines what kind of conversion to perform. The following conversion characters are currently supported: .TP 10 \fBd\fR Convert integer to signed decimal string. |
| ︙ | ︙ | |||
154 155 156 157 158 159 160 | .TP 10 \fBo\fR Convert integer to unsigned octal string. .TP 10 \fBx\fR or \fBX\fR Convert integer to unsigned hexadecimal string, using digits ``0123456789abcdef'' for \fBx\fR and ``0123456789ABCDEF'' for \fBX\fR). | < < | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | .TP 10 \fBo\fR Convert integer to unsigned octal string. .TP 10 \fBx\fR or \fBX\fR Convert integer to unsigned hexadecimal string, using digits ``0123456789abcdef'' for \fBx\fR and ``0123456789ABCDEF'' for \fBX\fR). .TP 10 \fBc\fR Convert integer to the Unicode character it represents. .TP 10 \fBs\fR No conversion; just insert string. .TP 10 \fBf\fR Convert floating-point number to signed decimal string of the form \fIxx.yyy\fR, where the number of \fIy\fR's is determined by |
| ︙ | ︙ | |||
203 204 205 206 207 208 209 | .IP [1] \fB%p\fR and \fB%n\fR specifiers are not currently supported. .IP [2] For \fB%c\fR conversions the argument must be a decimal string, which will then be converted to the corresponding character value. .IP [3] The \fBl\fR modifier | < < | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | .IP [1] \fB%p\fR and \fB%n\fR specifiers are not currently supported. .IP [2] For \fB%c\fR conversions the argument must be a decimal string, which will then be converted to the corresponding character value. .IP [3] The \fBl\fR modifier is ignored for real values and on 64-bit platforms, which are always converted as if the \fBl\fR modifier were present (i.e. the types \fBdouble\fR and \fBlong\fR are used for the internal representation of real and integer values, respectively). If the \fBh\fR modifier is specified then integer values are truncated to \fBshort\fR before conversion. Both \fBh\fR and \fBl\fR modifiers are ignored on all other conversions. .SH EXAMPLES Convert the output of \fBtime\fR into seconds to an accuracy of hundredths of a second: .CS |
| ︙ | ︙ |
Changes to doc/gets.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: gets.n,v 1.6.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH gets n 7.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME gets \- Read a line from a channel .SH SYNOPSIS \fBgets \fIchannelId\fR ?\fIvarName\fR? .BE .SH DESCRIPTION .PP This command reads the next line from \fIchannelId\fR, returns everything in the line up to (but not including) the end-of-line character(s), and discards the end-of-line character(s). .PP \fIChannelId\fR must be an identifier for an open channel such as the Tcl standard input channel (\fBstdin\fR), the return value from an invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel creation command provided by a Tcl extension. The channel must have been opened for input. .PP If \fIvarName\fR is omitted the line is returned as the result of the command. If \fIvarName\fR is specified then the line is placed in the variable by that name and the return value is a count of the number of characters returned. .PP |
| ︙ | ︙ |
Changes to doc/glob.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: glob.n,v 1.17.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH glob n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME glob \- Return names of files that match patterns .SH SYNOPSIS \fBglob \fR?\fIswitches\fR? \fIpattern \fR?\fIpattern ...\fR? .BE .SH DESCRIPTION .PP This command performs file name ``globbing'' in a fashion similar to the csh shell. It returns a list of the files whose names match any of the \fIpattern\fR arguments. No particular order is guaranteed in the list, so if a sorted list is required the caller should use \fBlsort\fR. .LP If the initial arguments to \fBglob\fR start with \fB\-\fR then they are treated as switches. The following switches are currently supported: .TP \fB\-directory\fR \fIdirectory\fR Search for files which match the given patterns starting in the given |
| ︙ | ︙ | |||
153 154 155 156 157 158 159 | start with a tilde ``~'' (for example through \fBglob *\fR or \fBglob -tails\fR, the returned list will not quote the tilde with ``./''. This means care must be taken if those names are later to be used with \fBfile join\fR, to avoid them being interpreted as absolute paths pointing to a given user's home directory. .SH "PORTABILITY ISSUES" .PP | < < < < < | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | start with a tilde ``~'' (for example through \fBglob *\fR or \fBglob -tails\fR, the returned list will not quote the tilde with ``./''. This means care must be taken if those names are later to be used with \fBfile join\fR, to avoid them being interpreted as absolute paths pointing to a given user's home directory. .SH "PORTABILITY ISSUES" .PP \fBWindows\fR . For Windows UNC names, the servername and sharename components of the path may not contain ?, *, or [] constructs. On Windows NT, if \fIpattern\fR is of the form ``\fB~\fIusername\fB@\fIdomain\fR'' it refers to the home directory of the user whose account information resides on the specified NT domain server. Otherwise, user account information is obtained from |
| ︙ | ︙ |
Changes to doc/info.n.
1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies '\" Copyright (c) 1998-2000 Ajuba Solutions '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies '\" Copyright (c) 1998-2000 Ajuba Solutions '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: info.n,v 1.14.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH info n 8.4 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME info \- Return information about the state of the Tcl interpreter |
| ︙ | ︙ | |||
36 37 38 39 40 41 42 | .TP \fBinfo cmdcount\fR Returns a count of the total number of commands that have been invoked in this interpreter. .TP \fBinfo commands \fR?\fIpattern\fR? If \fIpattern\fR isn't specified, | > > | > | > > > > | 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 | .TP \fBinfo cmdcount\fR Returns a count of the total number of commands that have been invoked in this interpreter. .TP \fBinfo commands \fR?\fIpattern\fR? If \fIpattern\fR isn't specified, '\" Do not move this .VS above the .TP .VS 8.5 returns a list of names of all the Tcl commands visible (i.e. executable without using a qualified name) to the current namespace, including both the built-in commands written in C and the command procedures defined using the \fBproc\fR command. If \fIpattern\fR is specified, only those names matching \fIpattern\fR are returned. Matching is determined using the same rules as for \fBstring match\fR. \fIpattern\fR can be a qualified name like \fBFoo::print*\fR. That is, it may specify a particular namespace using a sequence of namespace names separated by double colons (\fB::\fR), and may have pattern matching special characters at the end to specify a set of commands in that namespace. If \fIpattern\fR is a qualified name, the resulting list of command names has each one qualified with the name of the specified namespace, and only the commands defined in the named namespace are returned. '\" Technically, most of this hasn't changed; that's mostly just the '\" way it always worked. Hardly anyone knew that though. .VE 8.5 .TP \fBinfo complete \fIcommand\fR Returns 1 if \fIcommand\fR is a complete Tcl command in the sense of having no unclosed quotes, braces, brackets or array element names. If the command doesn't appear to be complete then 0 is returned. This command is typically used in line-oriented input environments to allow users to type in commands that span multiple lines; if the |
| ︙ | ︙ | |||
71 72 73 74 75 76 77 | Otherwise it returns \fB1\fR and places the default value of \fIarg\fR into variable \fIvarname\fR. .TP \fBinfo exists \fIvarName\fR Returns \fB1\fR if the variable named \fIvarName\fR exists in the current context (either as a global or local variable) and has been defined by being given a value, returns \fB0\fR otherwise. | < < < < | 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 | Otherwise it returns \fB1\fR and places the default value of \fIarg\fR into variable \fIvarname\fR. .TP \fBinfo exists \fIvarName\fR Returns \fB1\fR if the variable named \fIvarName\fR exists in the current context (either as a global or local variable) and has been defined by being given a value, returns \fB0\fR otherwise. .TP \fBinfo functions \fR?\fIpattern\fR? If \fIpattern\fR isn't specified, returns a list of all the math functions currently defined. If \fIpattern\fR is specified, only those functions whose name matches \fIpattern\fR are returned. Matching is determined using the same rules as for \fBstring match\fR. .TP \fBinfo globals \fR?\fIpattern\fR? If \fIpattern\fR isn't specified, returns a list of all the names of currently-defined global variables. Global variables are variables in the global namespace. If \fIpattern\fR is specified, only those names matching \fIpattern\fR are returned. Matching is determined using the same rules as for \fBstring match\fR. .TP \fBinfo hostname\fR Returns the name of the computer on which this invocation is being executed. Note that this name is not guaranteed to be the fully qualified domain name of the host. Where machines have several different names (as is common on systems with both TCP/IP (DNS) and NetBIOS-based networking installed,) it is the name that is suitable for TCP/IP networking that is returned. .TP \fBinfo level\fR ?\fInumber\fR? If \fInumber\fR is not specified, this command returns a number giving the stack level of the invoking procedure, or 0 if the command is invoked at top-level. If \fInumber\fR is specified, then the result is a list consisting of the name and arguments for the procedure call at level \fInumber\fR on the stack. If \fInumber\fR |
| ︙ | ︙ |
Changes to doc/interp.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" Copyright (c) 2004 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" Copyright (c) 2004 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: interp.n,v 1.22.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH interp n 7.6 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME interp \- Create and manipulate Tcl interpreters |
| ︙ | ︙ | |||
34 35 36 37 38 39 40 | a command in a slave interpreter which, when invoked, causes a command to be invoked in its master interpreter or in another slave interpreter. The only other connections between interpreters are through environment variables (the \fBenv\fR variable), which are normally shared among all interpreters in the application, .VS 8.5 and by resource limit exceeded callbacks. | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | a command in a slave interpreter which, when invoked, causes a command to be invoked in its master interpreter or in another slave interpreter. The only other connections between interpreters are through environment variables (the \fBenv\fR variable), which are normally shared among all interpreters in the application, .VS 8.5 and by resource limit exceeded callbacks. .VE 8.5 Note that the name space for files (such as the names returned by the \fBopen\fR command) is no longer shared between interpreters. Explicit commands are provided to share files and to transfer references to open files from one interpreter to another. .PP The \fBinterp\fR command also provides support for \fIsafe\fR |
| ︙ | ︙ |
Changes to doc/lappend.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: lappend.n,v 1.9.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH lappend n "" Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME lappend \- Append list elements onto a variable |
| ︙ | ︙ | |||
39 40 41 42 43 44 45 | % \fBlappend\fR var 2 1 2 % \fBlappend\fR var 3 4 5 1 2 3 4 5 .CE .SH "SEE ALSO" | | < < < | 39 40 41 42 43 44 45 46 47 48 49 50 | % \fBlappend\fR var 2 1 2 % \fBlappend\fR var 3 4 5 1 2 3 4 5 .CE .SH "SEE ALSO" list(n), lindex(n), linsert(n), llength(n), lset(n), lsort(n), lrange(n) .SH KEYWORDS append, element, list, variable |
Changes to doc/lindex.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < > | | < > > < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 |
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\" Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lindex.n,v 1.8.4.1 2005/06/13 01:45:38 msofer Exp $
'\"
.so man.macros
.TH lindex n 8.4 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
lindex \- Retrieve an element from a list
.SH SYNOPSIS
\fBlindex \fIlist ?index...?\fR
.BE
.SH DESCRIPTION
.PP
The \fBlindex\fP command accepts a parameter, \fIlist\fP, which
it treats as a Tcl list. It also accepts zero or more \fIindices\fP into
the list. The indices may be presented either consecutively on the
command line, or grouped in a
Tcl list and presented as a single argument.
.PP
If no indices are presented, the command takes the form:
.CS
lindex list
.CE
or
.CS
lindex list {}
.CE
In this case, the return value of \fBlindex\fR is simply the value of the
\fIlist\fR parameter.
.PP
When presented with a single index, the \fBlindex\fR command
treats \fIlist\fR as a Tcl list and returns the
\fIindex\fR'th element from it (0 refers to the first element of the list).
In extracting the element, \fBlindex\fR observes the same rules
concerning braces and quotes and backslashes as the Tcl command
interpreter; however, variable
substitution and command substitution do not occur.
If \fIindex\fR is negative or greater than or equal to the number
of elements in \fIvalue\fR, then an empty
string is returned.
.VS 8.5
The interpretation of each simple \fIindex\fR value is the same as
for the command \fBstring index\fR, supporting simple index
arithmetic and indices relative to the end of the list.
.VE 8.5
.PP
If additional \fIindex\fR arguments are supplied, then each argument is
used in turn to select an element from the previous indexing operation,
allowing the script to select elements from sublists. The command,
.CS
lindex $a 1 2 3
.CE
or
|
| ︙ | ︙ | |||
76 77 78 79 80 81 82 |
\fBlindex\fR {a b c} end \fI=> c\fR
\fBlindex\fR {a b c} end-1 \fI=> b\fR
\fBlindex\fR {{a b c} {d e f} {g h i}} 2 1 \fI=> h\fR
\fBlindex\fR {{a b c} {d e f} {g h i}} {2 1} \fI=> h\fR
\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} 1 1 0 \fI=> g\fR
\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} {1 1 0} \fI=> g\fR
.CE
| < > | | < < | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
\fBlindex\fR {a b c} end \fI=> c\fR
\fBlindex\fR {a b c} end-1 \fI=> b\fR
\fBlindex\fR {{a b c} {d e f} {g h i}} 2 1 \fI=> h\fR
\fBlindex\fR {{a b c} {d e f} {g h i}} {2 1} \fI=> h\fR
\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} 1 1 0 \fI=> g\fR
\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} {1 1 0} \fI=> g\fR
.CE
.SH "SEE ALSO"
list(n), lappend(n), linsert(n), llength(n), lsearch(n),
lset(n), lsort(n), lrange(n), lreplace(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
element, index, list
|
Changes to doc/linsert.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | > | < | | > < | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: linsert.n,v 1.10.4.1 2005/06/13 01:45:38 msofer Exp $
'\"
.so man.macros
.TH linsert n 8.2 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
linsert \- Insert elements into a list
.SH SYNOPSIS
\fBlinsert \fIlist index element \fR?\fIelement element ...\fR?
.BE
.SH DESCRIPTION
.PP
This command produces a new list from \fIlist\fR by inserting all of the
\fIelement\fR arguments just before the \fIindex\fR'th element of
\fIlist\fR. Each \fIelement\fR argument will become a separate element of
the new list. If \fIindex\fR is less than or equal to zero, then the new
elements are inserted at the beginning of the list.
.VS 8.5
The interpretation of the \fIindex\fR value is the same as
for the command \fBstring index\fR, supporting simple index
arithmetic and indices relative to the end of the list.
.VE
.SH EXAMPLE
Putting some values into a list, first indexing from the start and
then indexing from the end, and then chaining them together:
.CS
set oldList {the fox jumps over the dog}
set midList [\fBlinsert\fR $oldList 1 quick]
set newList [\fBlinsert\fR $midList end-1 lazy]
# The old lists still exist though...
set newerList [\fBlinsert\fR [\fBlinsert\fR $oldList end-1 quick] 1 lazy]
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), llength(n), lsearch(n),
lset(n), lsort(n), lrange(n), lreplace(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
element, insert, list
|
Changes to doc/llength.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: llength.n,v 1.8.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH llength n "" Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME llength \- Count the number of elements in a list |
| ︙ | ︙ | |||
46 47 48 49 50 51 52 |
An empty list is not necessarily an empty string:
.CS
% set var { }; puts "[string length $var],[\fBllength\fR $var]"
1,0
.CE
.SH "SEE ALSO"
| < < | 46 47 48 49 50 51 52 53 54 55 56 57 |
An empty list is not necessarily an empty string:
.CS
% set var { }; puts "[string length $var],[\fBllength\fR $var]"
1,0
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), lsearch(n),
lset(n), lsort(n), lrange(n), lreplace(n)
.SH KEYWORDS
element, list, length
|
Changes to doc/load.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: load.n,v 1.12.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH load n 7.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME load \- Load machine code and initialize new commands |
| ︙ | ︙ | |||
88 89 90 91 92 93 94 | .PP If \fIpackageName\fR is omitted or specified as an empty string, Tcl tries to guess the name of the package. This may be done differently on different platforms. The default guess, which is used on most UNIX platforms, is to take the last element of \fIfileName\fR, strip off the first three characters if they are \fBlib\fR, and use any following | < < < < | 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 |
.PP
If \fIpackageName\fR is omitted or specified as an empty string,
Tcl tries to guess the name of the package.
This may be done differently on different platforms.
The default guess, which is used on most UNIX platforms, is to
take the last element of \fIfileName\fR, strip off the first
three characters if they are \fBlib\fR, and use any following
alphabetic and underline characters as the module name.
For example, the command \fBload libxyz4.2.so\fR uses the module
name \fBxyz\fR and the command \fBload bin/last.so {}\fR uses the
module name \fBlast\fR.
.PP
If \fIfileName\fR is an empty string, then \fIpackageName\fR must
be specified.
The \fBload\fR command first searches for a statically loaded package
(one that has been registered by calling the \fBTcl_StaticPackage\fR
procedure) by that name; if one is found, it is used.
Otherwise, the \fBload\fR command searches for a dynamically loaded
package by that name, and uses it if it is found. If several
different files have been \fBload\fRed with different versions of
the package, Tcl picks the file that was loaded first.
.SH "PORTABILITY ISSUES"
.TP
\fBWindows\fR\0\0\0\0\0
.
When a load fails with "library not found" error, it is also possible
that a dependent library was not found. To see the dependent libraries,
type ``dumpbin -imports <dllname>'' in a DOS console to see what the
|
| ︙ | ︙ | |||
133 134 135 136 137 138 139 | .SH EXAMPLE The following is a minimal extension: .PP .CS #include <tcl.h> #include <stdio.h> static int fooCmd(ClientData clientData, | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
.SH EXAMPLE
The following is a minimal extension:
.PP
.CS
#include <tcl.h>
#include <stdio.h>
static int fooCmd(ClientData clientData,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
printf("called with %d arguments\\n", objc);
return TCL_OK;
}
int Foo_Init(Tcl_Interp *interp) {
if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
return TCL_ERROR;
}
|
| ︙ | ︙ | |||
155 156 157 158 159 160 161 |
(e.g. \fBfoo.dll\fR on Windows, \fBlibfoo.so\fR on Solaris and Linux)
it can then be loaded into Tcl with the following:
.PP
.CS
# Load the extension
switch $tcl_platform(platform) {
windows {
| | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
(e.g. \fBfoo.dll\fR on Windows, \fBlibfoo.so\fR on Solaris and Linux)
it can then be loaded into Tcl with the following:
.PP
.CS
# Load the extension
switch $tcl_platform(platform) {
windows {
\fBload\fR [file join [pwd] foo.dll]
}
unix {
\fBload\fR ./libfoo[info sharedlibextension]
}
}
# Now execute the command defined by the extension
|
| ︙ | ︙ |
Changes to doc/lrange.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | > | < > > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: lrange.n,v 1.9.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH lrange n 7.4 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME lrange \- Return one or more adjacent elements from a list .SH SYNOPSIS \fBlrange \fIlist first last\fR .BE .SH DESCRIPTION .PP \fIList\fR must be a valid Tcl list. This command will return a new list consisting of elements \fIfirst\fR through \fIlast\fR, inclusive. .VS 8.5 The index values \fIfirst\fR and \fIlast\fR are interpreted the same as index values for the command \fBstring index\fR, supporting simple index arithmetic and indices relative to the end of the list. .VE If \fIfirst\fR is less than zero, it is treated as if it were zero. If \fIlast\fR is greater than or equal to the number of elements in the list, then it is treated as if it were \fBend\fR. If \fIfirst\fR is greater than \fIlast\fR then an empty string is returned. Note: ``\fBlrange \fIlist first first\fR'' does not always produce the same result as ``\fBlindex \fIlist first\fR'' (although it often does |
| ︙ | ︙ | |||
62 63 64 65 66 67 68 |
% lindex $var 1
elements to
% \fBlrange\fR $var 1 1
{elements to}
.CE
.SH "SEE ALSO"
| < | > > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
% lindex $var 1
elements to
% \fBlrange\fR $var 1 1
{elements to}
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lset(n), lreplace(n), lsort(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
element, list, range, sublist
|
Changes to doc/lreplace.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | > > > | > > > | < | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: lreplace.n,v 1.10.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH lreplace n 7.4 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME lreplace \- Replace elements in a list with new elements .SH SYNOPSIS \fBlreplace \fIlist first last \fR?\fIelement element ...\fR? .BE .SH DESCRIPTION .PP \fBlreplace\fR returns a new list formed by replacing one or more elements of \fIlist\fR with the \fIelement\fR arguments. .VS 8.5 \fIfirst\fR and \fIlast\fR are index values specifying the first and last elements of the range to replace. The index values \fIfirst\fR and \fIlast\fR are interpreted the same as index values for the command \fBstring index\fR, supporting simple index arithmetic and indices relative to the end of the list. 0 refers to the first element of the list, and \fBend\fR refers to the last element of the list. If \fIlist\fR is empty, then \fIfirst\fR and \fIlast\fR are ignored. .VE If \fIfirst\fR is less than zero, it is considered to refer to the first element of the list. For non-empty lists, the element indicated by \fIfirst\fR must exist. If \fIlast\fR is less than zero but greater than \fIfirst\fR, then any specified elements will be prepended to the list. If \fIlast\fR is |
| ︙ | ︙ | |||
61 62 63 64 65 66 67 |
% set var {a b c d e}
a b c d e
% set var [\fBlreplace\fR $var end end]
a b c d
.CE
.SH "SEE ALSO"
| < | > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
% set var {a b c d e}
a b c d e
% set var [\fBlreplace\fR $var end end]
a b c d
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lset(n), lrange(n), lsort(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
element, list, replace
|
Changes to doc/lsearch.n.
1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" Copyright (c) 2003-2004 Donal K. Fellows. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" Copyright (c) 2003-2004 Donal K. Fellows. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: lsearch.n,v 1.22.2.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH lsearch n 8.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME lsearch \- See if a list contains a particular element |
| ︙ | ︙ | |||
66 67 68 69 70 71 72 | the result of the command is the list of all values that matched. .TP \fB\-not\fR This negates the sense of the match, returning the index of the first non-matching value in the list. .TP \fB\-start\fR\0\fIindex\fR | | > | | | > > > > > > > > | 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 110 111 | the result of the command is the list of all values that matched. .TP \fB\-not\fR This negates the sense of the match, returning the index of the first non-matching value in the list. .TP \fB\-start\fR\0\fIindex\fR The list is searched starting at position \fIindex\fR. .VS 8.5 The interpretation of the \fIindex\fR value is the same as for the command \fBstring index\fR, supporting simple index arithmetic and indices relative to the end of the list. .VE 8.5 .SS "CONTENTS DESCRIPTION OPTIONS" These options describe how to interpret the items in the list being searched. They are only meaningful when used with the \fB\-exact\fR and \fB\-sorted\fR options. If more than one is specified, the last one takes precedence. The default is \fB\-ascii\fR. .TP \fB\-ascii\fR The list elements are to be examined as Unicode strings (the name is for backward-compatibility reasons.) .TP \fB\-dictionary\fR The list elements are to be compared using dictionary-style comparisons (see \fBlsort\fR for a fuller description). Note that this only makes a meaningful difference from the \fB\-ascii\fR option when the \fB\-sorted\fR option is given, because values are only dictionary-equal when exactly equal. .TP \fB\-integer\fR The list elements are to be compared as integers. .VS 8.5 .TP \fB\-nocase\fR Causes comparisons to be handled in a case-insensitive manner. Has no effect if combined with the \fB\-dictionary\fR, \fB\-integer\fR, or \fB\-real\fR options. .VE 8.5 .TP \fB\-real\fR The list elements are to be compared as floating-point values. .SS "SORTED LIST OPTIONS" These options (only meaningful with the \fB\-sorted\fR option) specify how the list is sorted. If more than one is given, the last one takes precedence. The default option is \fB\-increasing\fR. |
| ︙ | ︙ | |||
162 163 164 165 166 167 168 |
.CS
\fBlsearch\fR -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc*
=> {a abc} {b bcd}
.CE
.SH "SEE ALSO"
foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n),
| | > > > > | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
.CS
\fBlsearch\fR -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc*
=> {a abc} {b bcd}
.CE
.SH "SEE ALSO"
foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n),
lset(n), lsort(n), lrange(n), lreplace(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
list, match, pattern, regular expression, search, string
'\" Local Variables:
'\" mode: nroff
'\" End:
|
Changes to doc/lset.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: lset.n,v 1.7.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH lset n 8.4 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME lset \- Change an element in a list |
| ︙ | ︙ | |||
48 49 50 51 52 53 54 | replaced with \fInewValue\fR. This new list is stored in the variable \fIvarName\fR, and is also the return value from the \fBlset\fR command. .PP If \fIindex\fR is negative or greater than or equal to the number of elements in \fI$varName\fR, then an error occurs. .PP | > | | < > > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | replaced with \fInewValue\fR. This new list is stored in the variable \fIvarName\fR, and is also the return value from the \fBlset\fR command. .PP If \fIindex\fR is negative or greater than or equal to the number of elements in \fI$varName\fR, then an error occurs. .PP .VS 8.5 The interpretation of each simple \fIindex\fR value is the same as for the command \fBstring index\fR, supporting simple index arithmetic and indices relative to the end of the list. .VE 8.5 .PP If additional \fIindex\fR arguments are supplied, then each argument is used in turn to address an element within a sublist designated by the previous indexing operation, allowing the script to alter elements in sublists. The command, .CS lset a 1 2 newValue |
| ︙ | ︙ | |||
103 104 105 106 107 108 109 |
The indicated return value also becomes the new value of \fIx\fR.
.CS
lset x 1 1 0 j => {{a b} {c d}} {{e f} {j h}}
lset x {1 1 0} j => {{a b} {c d}} {{e f} {j h}}
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
| | > > > > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
The indicated return value also becomes the new value of \fIx\fR.
.CS
lset x 1 1 0 j => {{a b} {c d}} {{e f} {j h}}
lset x {1 1 0} j => {{a b} {c d}} {{e f} {j h}}
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lsort(n), lrange(n), lreplace(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
element, index, list, replace, set
|
Changes to doc/lsort.n.
1 2 3 4 5 6 7 8 9 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 1999 Scriptics Corporation '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 1999 Scriptics Corporation '\" Copyright (c) 2001 Kevin B. Kenny. All rights reserved. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: lsort.n,v 1.18.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH lsort n 8.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME lsort \- Sort the elements of a list .SH SYNOPSIS \fBlsort \fR?\fIoptions\fR? \fIlist\fR .BE |
| ︙ | ︙ | |||
74 75 76 77 78 79 80 | \fB\-index\0\fIindexList\fR If this option is specified, each of the elements of \fIlist\fR must itself be a proper Tcl sublist. Instead of sorting based on whole sublists, \fBlsort\fR will extract the \fIindexList\fR'th element from each sublist .VS 8.5 (as if the overall element and the \fIindexList\fR were passed to | | < < < | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
\fB\-index\0\fIindexList\fR
If this option is specified, each of the elements of \fIlist\fR must
itself be a proper Tcl sublist. Instead of sorting based on whole
sublists, \fBlsort\fR will extract the \fIindexList\fR'th element from
each sublist
.VS 8.5
(as if the overall element and the \fIindexList\fR were passed to
\fBlindex\fR) and sort based on the given element.
.VE 8.5
For example,
.RS
.CS
lsort -integer -index 1 {{First 24} {Second 18} {Third 30}}
.CE
returns \fB{Second 18} {First 24} {Third 30}\fR, and
|
| ︙ | ︙ | |||
103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
.CE
returns \fB{{d e m o} 34512} {{b i g} 12345} {{c o d e} 54321}\fR
(because \fBe\fR sorts before \fBi\fR which sorts before \fBo\fR.)
.VE 8.5
This option is much more efficient than using \fB\-command\fR
to achieve the same effect.
.RE
.TP 20
\fB\-unique\fR
If this option is specified, then only the last set of duplicate
elements found in the list will be retained. Note that duplicates are
determined relative to the comparison used in the sort. Thus if
\fI-index 0\fR is used, \fB{1 a}\fR and \fB{1 b}\fR would be
considered duplicates and only the second element, \fB{1 b}\fR, would
| > > > > > > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
.CE
returns \fB{{d e m o} 34512} {{b i g} 12345} {{c o d e} 54321}\fR
(because \fBe\fR sorts before \fBi\fR which sorts before \fBo\fR.)
.VE 8.5
This option is much more efficient than using \fB\-command\fR
to achieve the same effect.
.RE
.VS 8.5
.TP 20
\fB\-nocase\fR
Causes comparisons to be handled in a case-insensitive manner. Has no
effect if combined with the \fB\-dictionary\fR, \fB\-integer\fR, or
\fB\-real\fR options.
.VE 8.5
.TP 20
\fB\-unique\fR
If this option is specified, then only the last set of duplicate
elements found in the list will be retained. Note that duplicates are
determined relative to the comparison used in the sort. Thus if
\fI-index 0\fR is used, \fB{1 a}\fR and \fB{1 b}\fR would be
considered duplicates and only the second element, \fB{1 b}\fR, would
|
| ︙ | ︙ |
Added doc/mathfunc.n.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 220 221 222 223 224 225 226 227 228 229 230 |
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-2000 Sun Microsystems, Inc.
'\" Copyright (c) 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: mathfunc.n,v 1.6.2.2 2005/06/13 01:45:38 msofer Exp $
'\"
.so man.macros
.TH mathfunc n 8.5 Tcl "Tcl Mathematical Functions"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
mathfunc \- Mathematical functions for Tcl expressions
.SH SYNOPSIS
package require \fBTcl 8.5\fR
.sp
\fB::tcl::mathfunc::abs\fR \fIarg\fR
.br
\fB::tcl::mathfunc::acos\fR \fIarg\fR
.br
\fB::tcl::mathfunc::asin\fR \fIarg\fR
.br
\fB::tcl::mathfunc::atan\fR \fIarg\fR
.br
\fB::tcl::mathfunc::atan2\fR \fIy\fR \fIx\fR
.br
\fB::tcl::mathfunc::bool\fR \fIarg\fR
.br
\fB::tcl::mathfunc::ceil\fR \fIarg\fR
.br
\fB::tcl::mathfunc::cos\fR \fIarg\fR
.br
\fB::tcl::mathfunc::cosh\fR \fIarg\fR
.br
\fB::tcl::mathfunc::double\fR \fIarg\fR
.br
\fB::tcl::mathfunc::exp\fR \fIarg\fR
.br
\fB::tcl::mathfunc::floor\fR \fIarg\fR
.br
\fB::tcl::mathfunc::fmod\fR \fIx\fR \fIy\fR
.br
\fB::tcl::mathfunc::hypot\fR \fIx\fR \fIy\fR
.br
\fB::tcl::mathfunc::int\fR \fIarg\fR
.br
\fB::tcl::mathfunc::log\fR \fIarg\fR
.br
\fB::tcl::mathfunc::log10\fR \fIarg\fR
.br
\fB::tcl::mathfunc::pow\fR \fIx\fR \fIy\fR
.br
\fB::tcl::mathfunc::rand\fR
.br
\fB::tcl::mathfunc::round\fR \fIarg\fR
.br
\fB::tcl::mathfunc::sin\fR \fIarg\fR
.br
\fB::tcl::mathfunc::sinh\fR \fIarg\fR
.br
\fB::tcl::mathfunc::sqrt\fR \fIarg\fR
.br
\fB::tcl::mathfunc::srand\fR \fIarg\fR
.br
\fB::tcl::mathfunc::tan\fR \fIarg\fR
.br
\fB::tcl::mathfunc::tanh\fR \fIarg\fR
.br
\fB::tcl::mathfunc::wide\fR \fIarg\fR
.sp
.BE
.SH "DESCRIPTION"
.PP
The \fBexpr\fR command handles mathematical functions of the form
\fBsin($x)\fR or \fBatan2($y,$x)\fR by converting them to calls of the
form \fB[tcl::math::sin [expr {$x}]]\fR or
\fB[tcl::math::atan2 [expr {$y}] [expr {$x}]]\fR.
A number of math functions are available by default within the
namespace \fB::tcl::mathfunc\fR; these functions are also available
for code apart from \fBexpr\fR, by invoking the given commands
directly.
.PP
Tcl supports the following mathematical functions in expressions, all
of which work solely with floating-point numbers unless otherwise noted:
.DS
.ta 3c 6c 9c
\fBabs\fR \fBcos\fR \fBint\fR \fBsinh\fR
\fBacos\fR \fBcosh\fR \fBlog\fR \fBsqrt\fR
\fBasin\fR \fBdouble\fR \fBlog10\fR \fBsrand\fR
\fBatan\fR \fBexp\fR \fBpow\fR \fBtan\fR
\fBatan2\fR \fBfloor\fR \fBrand\fR \fBtanh\fR
\fBbool\fR \fBfmod\fR \fBround\fR \fBwide\fR
\fBceil\fR \fBhypot\fR \fBsin\fR
.DE
.PP
.TP
\fBabs(\fIarg\fB)\fR
Returns the absolute value of \fIarg\fR. \fIArg\fR may be either
integer or floating-point, and the result is returned in the same form.
.TP
\fBacos(\fIarg\fB)\fR
Returns the arc cosine of \fIarg\fR, in the range [\fI0\fR,\fIpi\fR]
radians. \fIArg\fR should be in the range [\fI-1\fR,\fI1\fR].
.TP
\fBasin(\fIarg\fB)\fR
Returns the arc sine of \fIarg\fR, in the range [\fI-pi/2\fR,\fIpi/2\fR]
radians. \fIArg\fR should be in the range [\fI-1\fR,\fI1\fR].
.TP
\fBatan(\fIarg\fB)\fR
Returns the arc tangent of \fIarg\fR, in the range [\fI-pi/2\fR,\fIpi/2\fR]
radians.
.TP
\fBatan2(\fIy, x\fB)\fR
Returns the arc tangent of \fIy\fR/\fIx\fR, in the range [\fI-pi\fR,\fIpi\fR]
radians. \fIx\fR and \fIy\fR cannot both be 0. If \fIx\fR is greater
than \fI0\fR, this is equivalent to \fBatan(\fIy/x\fB)\fR.
.TP
\fBbool(\fIarg\fB)\fR
Accepts any numerical value, or any string acceptable to
\fBstring is boolean\fR, and returns the corresponding
boolean value \fB0\fR or \fB1\fR. Non-zero numbers are true.
Other numbers are false. Non-numeric strings produce boolean value in
agreement with \fBstring is true\fR and \fBstring is false\fR.
.TP
\fBceil(\fIarg\fB)\fR
Returns the smallest integral floating-point value (i.e. with a zero
fractional part) not less than \fIarg\fR.
.TP
\fBcos(\fIarg\fB)\fR
Returns the cosine of \fIarg\fR, measured in radians.
.TP
\fBcosh(\fIarg\fB)\fR
Returns the hyperbolic cosine of \fIarg\fR. If the result would cause
an overflow, an error is returned.
.TP
\fBdouble(\fIarg\fB)\fR
If \fIarg\fR is a floating-point value, returns \fIarg\fR, otherwise converts
\fIarg\fR to floating-point and returns the converted value.
.TP
\fBexp(\fIarg\fB)\fR
Returns the exponential of \fIarg\fR, defined as \fIe\fR**\fIarg\fR.
If the result would cause an overflow, an error is returned.
.TP
\fBfloor(\fIarg\fB)\fR
Returns the largest integral floating-point value (i.e. with a zero
fractional part) not greater than \fIarg\fR.
.TP
\fBfmod(\fIx, y\fB)\fR
Returns the floating-point remainder of the division of \fIx\fR by
\fIy\fR. If \fIy\fR is 0, an error is returned.
.TP
\fBhypot(\fIx, y\fB)\fR
Computes the length of the hypotenuse of a right-angled triangle
\fBsqrt(\fIx\fR*\fIx\fR+\fIy\fR*\fIy\fB)\fR.
.TP
\fBint(\fIarg\fB)\fR
If \fIarg\fR is an integer value of the same width as the machine
word, returns \fIarg\fR, otherwise
converts \fIarg\fR to an integer (of the same size as a machine word,
i.e. 32-bits on 32-bit systems, and 64-bits on 64-bit systems) by
truncation and returns the converted value.
.TP
\fBlog(\fIarg\fB)\fR
Returns the natural logarithm of \fIarg\fR. \fIArg\fR must be a
positive value.
.TP
\fBlog10(\fIarg\fB)\fR
Returns the base 10 logarithm of \fIarg\fR. \fIArg\fR must be a
positive value.
.TP
\fBpow(\fIx, y\fB)\fR
Computes the value of \fIx\fR raised to the power \fIy\fR. If \fIx\fR
is negative, \fIy\fR must be an integer value.
.TP
\fBrand()\fR
Returns a pseudo-random floating-point value in the range (\fI0\fR,\fI1\fR).
The generator algorithm is a simple linear congruential generator that
is not cryptographically secure. Each result from \fBrand\fR completely
determines all future results from subsequent calls to \fBrand\fR, so
\fBrand\fR should not be used to generate a sequence of secrets, such as
one-time passwords. The seed of the generator is initialized from the
internal clock of the machine or may be set with the \fBsrand\fR function.
.TP
\fBround(\fIarg\fB)\fR
If \fIarg\fR is an integer value, returns \fIarg\fR, otherwise converts
\fIarg\fR to integer by rounding and returns the converted value.
.TP
\fBsin(\fIarg\fB)\fR
Returns the sine of \fIarg\fR, measured in radians.
.TP
\fBsinh(\fIarg\fB)\fR
Returns the hyperbolic sine of \fIarg\fR. If the result would cause
an overflow, an error is returned.
.TP
\fBsqrt(\fIarg\fB)\fR
Returns the square root of \fIarg\fR. \fIArg\fR must be non-negative.
.TP
\fBsrand(\fIarg\fB)\fR
The \fIarg\fR, which must be an integer, is used to reset the seed for
the random number generator of \fBrand\fR. Returns the first random
number (see \fBrand()\fR) from that seed. Each interpreter has its own seed.
.TP
\fBtan(\fIarg\fB)\fR
Returns the tangent of \fIarg\fR, measured in radians.
.TP
\fBtanh(\fIarg\fB)\fR
Returns the hyperbolic tangent of \fIarg\fR.
.TP
\fBwide(\fIarg\fB)\fR
Converts \fIarg\fR to an integer value at least 64-bits wide (by sign-extension
if \fIarg\fR is a 32-bit number) if it is not one already.
.PP
In addition to these predefined functions, applications may
define additional functions by using \fBproc\fR (or any other method,
such as \fBinterp alias\fR or \fBTcl_CreateObjCommand\fR) to define
new commands in the \fBtcl::mathfunc\fR namespace. In addition, an
obsolete interface named \fBTcl_CreateMathFunc\fR() is available to
extensions that are written in C. The latter interface is not recommended
for new implementations..
.SH "SEE ALSO"
expr(n), namespace(n)
.SH "COPYRIGHT"
Copyright (c) 1993 The Regents of the University of California.
.br
Copyright (c) 1994-2000 Sun Microsystems Incorporated.
.br
Copyright (c) 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved.
|
Changes to doc/msgcat.n.
| ︙ | ︙ | |||
91 92 93 94 95 96 97 |
The list is ordered from most specific to least
preference. The list is derived from the current
locale set in msgcat by \fB::msgcat::mclocale\fR, and
cannot be set independently. For example, if the
current locale is en_US_funky, then \fB::msgcat::mcpreferences\fR
.VS 1.4
returns \fB{en_US_funky en_US en {}}\fR.
| | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
The list is ordered from most specific to least
preference. The list is derived from the current
locale set in msgcat by \fB::msgcat::mclocale\fR, and
cannot be set independently. For example, if the
current locale is en_US_funky, then \fB::msgcat::mcpreferences\fR
.VS 1.4
returns \fB{en_US_funky en_US en {}}\fR.
.VE 1.4
.TP
\fB::msgcat::mcload \fIdirname\fR
Searches the specified directory for files that match
the language specifications returned by \fB::msgcat::mcpreferences\fR
(note that these are all lowercase), extended by the file
extension ``.msg''. Each matching file is
read in order, assuming a UTF-8 encoding. The file contents are
|
| ︙ | ︙ | |||
166 167 168 169 170 171 172 | locale of ``C''. .PP When a locale is specified by the user, a ``best match'' search is performed during string translation. For example, if a user specifies .VS 1.4 en_GB_Funky, the locales ``en_GB_Funky'', ``en_GB'', ``en'' and ``'' (the empty string) | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | locale of ``C''. .PP When a locale is specified by the user, a ``best match'' search is performed during string translation. For example, if a user specifies .VS 1.4 en_GB_Funky, the locales ``en_GB_Funky'', ``en_GB'', ``en'' and ``'' (the empty string) .VE 1.4 are searched in order until a matching translation string is found. If no translation string is available, then \fB::msgcat::unknown\fR is called. .SH "NAMESPACES AND MESSAGE CATALOGS" .PP Strings stored in the message catalog are stored relative to the namespace from which they were added. This allows |
| ︙ | ︙ | |||
236 237 238 239 240 241 242 | .IP [2] The message file name is a msgcat locale specifier (all lowercase) followed by ``.msg''. For example: .CS es.msg -- spanish en_gb.msg -- United Kingdom English .CE | | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | .IP [2] The message file name is a msgcat locale specifier (all lowercase) followed by ``.msg''. For example: .CS es.msg -- spanish en_gb.msg -- United Kingdom English .CE .VS 1.4 \fIException:\fR The message file for the root locale ``'' is called \fBROOT.msg\fR. This exception is made so as not to cause peculiar behavior, such as marking the message file as ``hidden'' on Unix file systems. .VE 1.4 .IP [3] The file contains a series of calls to \fBmcset\fR and \fBmcmset\fR, setting the necessary translation strings for the language, likely enclosed in a \fBnamespace eval\fR so that all source strings are tied to the namespace of the package. For example, a short \fBes.msg\fR might contain: .CS |
| ︙ | ︙ |
Changes to doc/namespace.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" Copyright (c) 2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | '\" '\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" Copyright (c) 2000 Scriptics Corporation. '\" Copyright (c) 2004-2005 Donal K. Fellows. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: namespace.n,v 1.16.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH namespace n 8.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME namespace \- create and manipulate contexts for commands and variables |
| ︙ | ︙ | |||
211 212 213 214 215 216 217 218 219 220 221 222 223 224 | the command's own fully-qualified name is returned. .TP \fBnamespace parent\fR ?\fInamespace\fR? Returns the fully-qualified name of the parent namespace for namespace \fInamespace\fR. If \fInamespace\fR is not specified, the fully-qualified name of the current namespace's parent is returned. .TP \fBnamespace qualifiers\fR \fIstring\fR Returns any leading namespace qualifiers for \fIstring\fR. Qualifiers are namespace names separated by double colons (\fB::\fR). For the \fIstring\fR \fB::foo::bar::x\fR, this command returns \fB::foo::bar\fR, and for \fB::\fR it returns an empty string. | > > > > > > > > > > > | 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 | the command's own fully-qualified name is returned. .TP \fBnamespace parent\fR ?\fInamespace\fR? Returns the fully-qualified name of the parent namespace for namespace \fInamespace\fR. If \fInamespace\fR is not specified, the fully-qualified name of the current namespace's parent is returned. .TP \fBnamespace path\fR ?\fInamespaceList\fR? '\" Should really have the .TP inside the .VS, but that triggers a groff bug .VS 8.5 Returns the command resolution path of the current namespace. If \fInamespaceList\fR is specified as a list of named namespaces, the current namespace's command resolution path is set to those namespaces and returns the empty list. The default command resolution path is always empty. See the section \fBNAME RESOLUTION\fR below for an explanation of the rules regarding name resolution. .VE 8.5 .TP \fBnamespace qualifiers\fR \fIstring\fR Returns any leading namespace qualifiers for \fIstring\fR. Qualifiers are namespace names separated by double colons (\fB::\fR). For the \fIstring\fR \fB::foo::bar::x\fR, this command returns \fB::foo::bar\fR, and for \fB::\fR it returns an empty string. |
| ︙ | ︙ | |||
383 384 385 386 387 388 389 | This means you can give qualified names to such commands as \fBset\fR, \fBproc\fR, \fBrename\fR, and \fBinterp alias\fR. If you provide a fully-qualified name that starts with a \fB::\fR, there is no question about what command, variable, or namespace you mean. However, if the name does not start with a \fB::\fR (i.e., is \fIrelative\fR), | | | > > > > > > > > | 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 |
This means you can give qualified names to such commands as
\fBset\fR, \fBproc\fR, \fBrename\fR, and \fBinterp alias\fR.
If you provide a fully-qualified name that starts with a \fB::\fR,
there is no question about what command, variable, or namespace
you mean.
However, if the name does not start with a \fB::\fR
(i.e., is \fIrelative\fR),
Tcl follows basic rules for looking it up:
Variable names are always resolved
by looking first in the current namespace,
and then in the global namespace.
.VS 8.5
Command names are also always resolved by looking in the current
namespace first. If not found there, they are searched for in every
namespace on the current namespace's command path (which is empty by
default). If not found there, command names are looked up in the
global namespace (or, failing that, are processed by the \fBunknown\fR
command.)
.VE 8.5
Namespace names, on the other hand, are always resolved
by looking in only the current namespace.
.PP
In the following example,
.CS
set traceLevel 0
\fBnamespace eval\fR Debug {
|
| ︙ | ︙ | |||
760 761 762 763 764 765 766 | \fBnamespace export\fR grill } .CE .PP Call the command defined in the previous example in various ways. .CS # Direct call | | > > > > > > | | | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
\fBnamespace export\fR grill
}
.CE
.PP
Call the command defined in the previous example in various ways.
.CS
# Direct call
::foo::grill
# Use the command resolution path to find the name
\fBnamespace eval\fR boo {
\fBnamespace path\fR ::foo
grill
}
# Import into current namespace, then call local alias
\fBnamespace import\fR foo::grill
grill
# Create two ensembles, one with the default name and one with a
# specified name. Then call through the ensembles.
\fBnamespace eval\fR foo {
\fBnamespace ensemble\fR create
\fBnamespace ensemble\fR create -command ::foobar
}
foo grill
foobar grill
.CE
.PP
Look up where the command imported in the previous example came from:
.CS
puts "grill came from [\fBnamespace origin\fR grill]"
.CE
.SH "SEE ALSO"
interp(n), variable(n)
.SH KEYWORDS
command, ensemble, exported, internal, variable
|
Changes to doc/open.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: open.n,v 1.22.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH open n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME open \- Open a file-based or command pipeline channel |
| ︙ | ︙ | |||
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 | create a new empty file. Set the initial access position to the end of the file. .TP 15 \fBa+\fR Open the file for reading and writing. If the file doesn't exist, create a new empty file. Set the initial access position to the end of the file. .PP In the second form, \fIaccess\fR consists of a list of any of the following flags, all of which have the standard POSIX meanings. One of the flags must be either \fBRDONLY\fR, \fBWRONLY\fR or \fBRDWR\fR. .TP 15 \fBRDONLY\fR Open the file for reading only. .TP 15 \fBWRONLY\fR Open the file for writing only. .TP 15 \fBRDWR\fR Open the file for both reading and writing. .TP 15 \fBAPPEND\fR Set the file pointer to the end of the file prior to each write. .TP 15 \fBCREAT\fR Create the file if it doesn't already exist (without this flag it is an error for the file not to exist). .TP 15 \fBEXCL\fR If \fBCREAT\fR is also specified, an error is returned if the | > > > > > > > > > > > > > | 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 | create a new empty file. Set the initial access position to the end of the file. .TP 15 \fBa+\fR Open the file for reading and writing. If the file doesn't exist, create a new empty file. Set the initial access position to the end of the file. .VS 8.5 .PP All of the legal \fIaccess\fR values above may have the character \fBb\fR added as the second or third character in the value to indicate that the opened channel should be configured with the \fB-translation binary\fR option, making the channel suitable for reading or writing of binary data. .VE 8.5 .PP In the second form, \fIaccess\fR consists of a list of any of the following flags, all of which have the standard POSIX meanings. One of the flags must be either \fBRDONLY\fR, \fBWRONLY\fR or \fBRDWR\fR. .TP 15 \fBRDONLY\fR Open the file for reading only. .TP 15 \fBWRONLY\fR Open the file for writing only. .TP 15 \fBRDWR\fR Open the file for both reading and writing. .TP 15 \fBAPPEND\fR Set the file pointer to the end of the file prior to each write. .TP 15 .VS 8.5 \fBBINARY\fR Configure the opened channed with the \fB-translation binary\fR option. .VE 8.5 .TP 15 \fBCREAT\fR Create the file if it doesn't already exist (without this flag it is an error for the file not to exist). .TP 15 \fBEXCL\fR If \fBCREAT\fR is also specified, an error is returned if the |
| ︙ | ︙ | |||
102 103 104 105 106 107 108 | \fBTRUNC\fR If the file exists it is truncated to zero length. .PP If a new file is created as part of opening it, \fIpermissions\fR (an integer) is used to set the permissions for the new file in conjunction with the process's file mode creation mask. \fIPermissions\fR defaults to 0666. | < < < < < < < < | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | \fBTRUNC\fR If the file exists it is truncated to zero length. .PP If a new file is created as part of opening it, \fIpermissions\fR (an integer) is used to set the permissions for the new file in conjunction with the process's file mode creation mask. \fIPermissions\fR defaults to 0666. .SH "COMMAND PIPELINES" .PP If the first character of \fIfileName\fR is ``|'' then the remaining characters of \fIfileName\fR are treated as a list of arguments that describe a command pipeline to invoke, in the same style as the arguments for \fBexec\fR. |
| ︙ | ︙ | |||
138 139 140 141 142 143 144 | a Tcl error is generated when \fBclose\fR is called on the channel unless the pipeline is in non-blocking mode then no exit status is returned (a silent \fBclose\fR with -blocking 0). .PP It is often useful to use the \fBfileevent\fR command with pipelines so other processing may happen at the same time as running the command in the background. | < | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | a Tcl error is generated when \fBclose\fR is called on the channel unless the pipeline is in non-blocking mode then no exit status is returned (a silent \fBclose\fR with -blocking 0). .PP It is often useful to use the \fBfileevent\fR command with pipelines so other processing may happen at the same time as running the command in the background. .SH "SERIAL COMMUNICATIONS" .PP If \fIfileName\fR refers to a serial port, then the specified serial port is opened and initialized in a platform-dependent manner. Acceptable values for the \fIfileName\fR to use to open a serial port are described in the PORTABILITY ISSUES section. .PP |
| ︙ | ︙ | |||
318 319 320 321 322 323 324 | \fBFRAME\fR A stop-bit error has been detected by your UART. Wrong mode settings with \fBfconfigure -mode\fR or a noisy data line (RXD) may cause this error. .TP 10 \fBBREAK\fR A BREAK condition has been detected by your UART (see above). | < | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | \fBFRAME\fR A stop-bit error has been detected by your UART. Wrong mode settings with \fBfconfigure -mode\fR or a noisy data line (RXD) may cause this error. .TP 10 \fBBREAK\fR A BREAK condition has been detected by your UART (see above). .SH "PORTABILITY ISSUES" .TP \fBWindows \fR(all versions) Valid values for \fIfileName\fR to open a serial port are of the form \fBcom\fIX\fB:\fR, where \fIX\fR is a number, generally from 1 to 4. This notation only works for serial ports from 1 to 9, if the system |
| ︙ | ︙ | |||
380 381 382 383 384 385 386 | until the pipe is actually closed. This problem occurs because 16-bit DOS applications are run synchronously, as described above. .TP \fBUnix\fR\0\0\0\0\0\0\0 Valid values for \fIfileName\fR to open a serial port are generally of the form \fB/dev/tty\fIX\fR, where \fIX\fR is \fBa\fR or \fBb\fR, but the name of any pseudo-file that maps to a serial port may be used. | < < | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | until the pipe is actually closed. This problem occurs because 16-bit DOS applications are run synchronously, as described above. .TP \fBUnix\fR\0\0\0\0\0\0\0 Valid values for \fIfileName\fR to open a serial port are generally of the form \fB/dev/tty\fIX\fR, where \fIX\fR is \fBa\fR or \fBb\fR, but the name of any pseudo-file that maps to a serial port may be used. Advanced configuration options are only supported for serial ports when Tcl is built to use the POSIX serial interface. .sp When running Tcl interactively, there may be some strange interactions between the console, if one is present, and a command pipeline that uses standard input. If a command pipeline is opened for reading, some of the lines entered at the console will be sent to the command pipeline and some will be sent to the Tcl evaluator. This problem only occurs because both Tcl and the child application are competing for the console at the |
| ︙ | ︙ |
Changes to doc/pkgMkIndex.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | '\" '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: pkgMkIndex.n,v 1.15.2.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH pkg_mkIndex n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME pkg_mkIndex \- Build an index for automatic loading of packages .SH SYNOPSIS .nf \fBpkg_mkIndex ?\fI\-direct\fR? ?\fI\-lazy\fR? ?\fI\-load pkgPat\fR? ?\fI\-verbose\fR? \fIdir\fR ?\fIpattern pattern ...\fR? .fi .BE .SH DESCRIPTION .PP \fBPkg_mkIndex\fR is a utility procedure that is part of the standard Tcl library. |
| ︙ | ︙ | |||
37 38 39 40 41 42 43 | the package and version number, and each binary file must contain a call to \fBTcl_PkgProvide\fR. .IP [2] Create the index by invoking \fBpkg_mkIndex\fR. The \fIdir\fR argument gives the name of a directory and each \fIpattern\fR argument is a \fBglob\fR-style pattern that selects script or binary files in \fIdir\fR. | < < | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | the package and version number, and each binary file must contain a call to \fBTcl_PkgProvide\fR. .IP [2] Create the index by invoking \fBpkg_mkIndex\fR. The \fIdir\fR argument gives the name of a directory and each \fIpattern\fR argument is a \fBglob\fR-style pattern that selects script or binary files in \fIdir\fR. The default pattern is \fB*.tcl\fR and \fB*.[info sharedlibextension]\fR. .br \fBPkg_mkIndex\fR will create a file \fBpkgIndex.tcl\fR in \fIdir\fR with package information about all the files given by the \fIpattern\fR arguments. It does this by loading each file into a slave interpreter and seeing what packages and new commands appear (this is why it is essential to have |
| ︙ | ︙ | |||
156 157 158 159 160 161 162 | evaluates all of the \fBpkgIndex.tcl\fR files in the \fBauto_path\fR. The \fBpkgIndex.tcl\fR files contain \fBpackage ifneeded\fR commands for each version of each available package; these commands invoke \fBpackage provide\fR commands to announce the availability of the package, and they setup auto-loader information to load the files of the package. | < < < < | 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 | evaluates all of the \fBpkgIndex.tcl\fR files in the \fBauto_path\fR. The \fBpkgIndex.tcl\fR files contain \fBpackage ifneeded\fR commands for each version of each available package; these commands invoke \fBpackage provide\fR commands to announce the availability of the package, and they setup auto-loader information to load the files of the package. If the \fI\-lazy\fR flag was provided when the \fBpkgIndex.tcl\fR was generated, a given file of a given version of a given package isn't actually loaded until the first time one of its commands is invoked. Thus, after invoking \fBpackage require\fR you may not see the package's commands in the interpreter, but you will be able to invoke the commands and they will be auto-loaded. .SH "DIRECT LOADING" .PP Some packages, for instance packages which use namespaces and export commands or those which require special initialization, might select that their package files be loaded immediately upon \fBpackage require\fR instead of delaying the actual loading to the first use of one of the package's command. This is the default mode when generating the package index. It can be overridden by specifying the \fI\-lazy\fR argument. .SH "COMPLEX CASES" Most complex cases of dependencies among scripts and binary files, and packages being split among scripts and binary files are handled OK. However, you may have to adjust the order in which files are processed by \fBpkg_mkIndex\fR. These issues are described in detail below. |
| ︙ | ︙ |
Changes to doc/puts.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: puts.n,v 1.8.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH puts n 7.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME puts \- Write to a channel .SH SYNOPSIS \fBputs \fR?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR .BE .SH DESCRIPTION .PP Writes the characters given by \fIstring\fR to the channel given by \fIchannelId\fR. .PP \fIChannelId\fR must be an identifier for an open channel such as a Tcl standard channel (\fBstdout\fR or \fBstderr\fR), the return value from an invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel creation command provided by a Tcl extension. The channel must have been opened for output. .PP If no \fIchannelId\fR is specified then it defaults to \fBstdout\fR. \fBPuts\fR normally outputs a newline character after \fIstring\fR, but this feature may be suppressed by specifying the \fB\-nonewline\fR switch. .PP Newline characters in the output are translated by \fBputs\fR to |
| ︙ | ︙ |
Changes to doc/re_syntax.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1998 Sun Microsystems, Inc. '\" Copyright (c) 1999 Scriptics Corporation '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1998 Sun Microsystems, Inc. '\" Copyright (c) 1999 Scriptics Corporation '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: re_syntax.n,v 1.6.2.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH re_syntax n "8.1" Tcl "Tcl Built-In Commands" .BS .SH NAME re_syntax \- Syntax of Tcl regular expressions .BE |
| ︙ | ︙ | |||
44 45 46 47 48 49 50 | A branch is zero or more \fIconstraints\fR or \fIquantified atoms\fR, concatenated. It matches a match for the first, followed by a match for the second, etc; an empty branch matches the empty string. .PP A quantified atom is an \fIatom\fR possibly followed by a single \fIquantifier\fR. | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | A branch is zero or more \fIconstraints\fR or \fIquantified atoms\fR, concatenated. It matches a match for the first, followed by a match for the second, etc; an empty branch matches the empty string. .PP A quantified atom is an \fIatom\fR possibly followed by a single \fIquantifier\fR. Without a quantifier, it matches a single match for the atom. The quantifiers, and what a so-quantified atom matches, are: .RS 2 .TP 6 \fB*\fR a sequence of 0 or more matches of the atom .TP |
| ︙ | ︙ | |||
81 82 83 84 85 86 87 |
.PP
The forms using \fB{\fR and \fB}\fR are known as \fIbound\fRs. The
numbers \fIm\fR and \fIn\fR are unsigned decimal integers with
permissible values from 0 to 255 inclusive.
.PP
An atom is one of:
.RS 2
| < | | | < | < | < | < | < | < | | | < | < | < | | 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 |
.PP
The forms using \fB{\fR and \fB}\fR are known as \fIbound\fRs. The
numbers \fIm\fR and \fIn\fR are unsigned decimal integers with
permissible values from 0 to 255 inclusive.
.PP
An atom is one of:
.RS 2
.IP \fB(\fIre\fB)\fR 6
matches a match for \fIre\fR (\fIre\fR is any regular expression) with
the match noted for possible reporting
.IP \fB(?:\fIre\fB)\fR
as previous, but does no reporting (a ``non-capturing'' set of
parentheses)
.IP \fB()\fR
matches an empty string, noted for possible reporting
.IP \fB(?:)\fR
matches an empty string, without reporting
.IP \fB[\fIchars\fB]\fR
a \fIbracket expression\fR, matching any one of the \fIchars\fR (see
\fBBRACKET EXPRESSIONS\fR for more detail)
.IP \fB.\fR
matches any single character
.IP \fB\e\fIk\fR
matches the non-alphanumeric character \fIk\fR
taken as an ordinary character, e.g. \fB\e\e\fR matches a backslash
character
.IP \fB\e\fIc\fR
where \fIc\fR is alphanumeric (possibly followed by other characters),
an \fIescape\fR (AREs only), see \fBESCAPES\fR below
.IP \fB{\fR
when followed by a character other than a digit, matches the
left-brace character `\fB{\fR'; when followed by a digit, it is the
beginning of a \fIbound\fR (see above)
.IP \fIx\fR
where \fIx\fR is a single character with no other significance,
matches that character.
.RE
.PP
A \fIconstraint\fR matches an empty string when specific conditions
are met. A constraint may not be followed by a quantifier. The
simple constraints are as follows; some more constraints are described
|
| ︙ | ︙ |
Changes to doc/read.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: read.n,v 1.9.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH read n 8.1 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME read \- Read from a channel |
| ︙ | ︙ | |||
28 29 30 31 32 33 34 | how many characters to read. Exactly that many characters will be read and returned, unless there are fewer than \fInumChars\fR left in the file; in this case all the remaining characters are returned. If the channel is configured to use a multi-byte encoding, then the number of characters read may not be the same as the number of bytes read. .PP | < < | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | how many characters to read. Exactly that many characters will be read and returned, unless there are fewer than \fInumChars\fR left in the file; in this case all the remaining characters are returned. If the channel is configured to use a multi-byte encoding, then the number of characters read may not be the same as the number of bytes read. .PP \fIChannelId\fR must be an identifier for an open channel such as the Tcl standard input channel (\fBstdin\fR), the return value from an invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel creation command provided by a Tcl extension. The channel must have been opened for input. .PP If \fIchannelId\fR is in nonblocking mode, the command may not read as many characters as requested: once all available input has been read, the command will return the data that is available rather than blocking for more input. If the channel is configured to use a multi-byte encoding, then there may actually be some bytes remaining in the internal buffers that do not form a complete character. These |
| ︙ | ︙ |
Changes to doc/regexp.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: regexp.n,v 1.16.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH regexp n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME regexp \- Match a regular expression against a string |
| ︙ | ︙ | |||
79 80 81 82 83 84 85 | beginning and end of a line respectively. This is the same as specifying the \fB(?w)\fR embedded option (see the \fBre_syntax\fR manual page). .TP 15 \fB\-nocase\fR Causes upper-case characters in \fIstring\fR to be treated as lower case during the matching process. | < | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | beginning and end of a line respectively. This is the same as specifying the \fB(?w)\fR embedded option (see the \fBre_syntax\fR manual page). .TP 15 \fB\-nocase\fR Causes upper-case characters in \fIstring\fR to be treated as lower case during the matching process. .TP 15 \fB\-all\fR Causes the regular expression to be matched as many times as possible in the string, returning the total number of matches found. If this is specified with match variables, they will contain information for the last match only. .TP 15 |
| ︙ | ︙ | |||
104 105 106 107 108 109 110 |
=> {in n}
regexp -all -inline -- {\\w(\\w)} " inlined "
=> {in n li i ne e}
.CE
.TP 15
\fB\-start\fR \fIindex\fR
Specifies a character index offset into the string to start
| | > > > > > < | 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 |
=> {in n}
regexp -all -inline -- {\\w(\\w)} " inlined "
=> {in n li i ne e}
.CE
.TP 15
\fB\-start\fR \fIindex\fR
Specifies a character index offset into the string to start
matching the regular expression at.
.VS 8.5
The \fIindex\fR value is interpreted in the same manner
as the \fIindex\fR argument to \fBstring index\fR.
.VE 8.5
When using this switch, `^'
will not match the beginning of the line, and \\A will still
match the start of the string at \fIindex\fR. If \fB\-indices\fR
is specified, the indices will be indexed starting from the
absolute beginning of the input string.
\fIindex\fR will be constrained to the bounds of the input string.
.TP 15
\fB\-\|\-\fR
Marks the end of switches. The argument following this one will
be treated as \fIexp\fR even if it starts with a \fB\-\fR.
.PP
If there are more \fIsubMatchVar\fR's than parenthesized
subexpressions within \fIexp\fR, or if a particular subexpression
|
| ︙ | ︙ | |||
151 152 153 154 155 156 157 |
List all words (consisting of all sequences of non-whitespace
characters) in a string:
.CS
\fBregexp\fR \-all \-inline {\\S+} $string
.CE
.SH "SEE ALSO"
| | > > > > | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
List all words (consisting of all sequences of non-whitespace
characters) in a string:
.CS
\fBregexp\fR \-all \-inline {\\S+} $string
.CE
.SH "SEE ALSO"
re_syntax(n), regsub(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
match, regular expression, string
|
Changes to doc/registry.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" Copyright (c) 2002 ActiveState Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" Copyright (c) 2002 ActiveState Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: registry.n,v 1.12.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH registry n 1.1 registry "Tcl Bundled Packages" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME registry \- Manipulate the Windows registry |
| ︙ | ︙ | |||
36 37 38 39 40 41 42 | \fIrootname\fB\e\fIkeypath\fR .IP \fIrootname\fR .PP \fIHostname\fR specifies the name of any valid Windows host that exports its registry. The \fIrootname\fR component must be one of \fBHKEY_LOCAL_MACHINE\fR, \fBHKEY_USERS\fR, | < < < < | 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 |
\fIrootname\fB\e\fIkeypath\fR
.IP
\fIrootname\fR
.PP
\fIHostname\fR specifies the name of any valid Windows
host that exports its registry. The \fIrootname\fR component must be
one of \fBHKEY_LOCAL_MACHINE\fR, \fBHKEY_USERS\fR,
\fBHKEY_CLASSES_ROOT\fR, \fBHKEY_CURRENT_USER\fR,
\fBHKEY_CURRENT_CONFIG\fR, \fBHKEY_PERFORMANCE_DATA\fR, or
\fBHKEY_DYN_DATA\fR. The \fIkeypath\fR can be one or more
registry key names separated by backslash (\fB\e\fR) characters.
.PP
\fIOption\fR indicates what to do with the registry key name. Any
unique abbreviation for \fIoption\fR is acceptable. The valid options
are:
.TP
\fBregistry broadcast \fIkeyName\fR ?\fI-timeout milliseconds\fR?
.
Sends a broadcast message to the system and running programs to notify them
of certain updates. This is necessary to propagate changes to key registry
keys like Environment. The timeout specifies the amount of time, in
milliseconds, to wait for applications to respond to the broadcast message.
It defaults to 3000. The following example demonstrates how to add a path
to the global Environment and notify applications of the change without
requiring a logoff/logon step (assumes admin privileges):
.CS
set regPath {HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment}
set curPath [registry get $regPath "Path"]
registry set $regPath "Path" "$curPath;$addPath"
registry broadcast "Environment"
.CE
.TP
\fBregistry delete \fIkeyName\fR ?\fIvalueName\fR?
.
If the optional \fIvalueName\fR argument is present, the specified
value under \fIkeyName\fR will be deleted from the registry. If the
optional \fIvalueName\fR is omitted, the specified key and any subkeys
or values beneath it in the registry hierarchy will be deleted. If
|
| ︙ | ︙ |
Changes to doc/regsub.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: regsub.n,v 1.12.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH regsub n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME regsub \- Perform substitutions based on regular expression pattern matching .SH SYNOPSIS \fBregsub \fR?\fIswitches\fR? \fIexp string subSpec \fR?\fIvarName\fR? .BE .SH DESCRIPTION .PP This command matches the regular expression \fIexp\fR against \fIstring\fR, and either copies \fIstring\fR to the variable whose name is given by \fIvarName\fR or returns \fIstring\fR if \fIvarName\fR is not present. (Regular expression matching is described in the \fBre_syntax\fR reference page.) If there is a match, then while copying \fIstring\fR to \fIvarName\fR (or to the result of this command if \fIvarName\fR is not present) the portion of \fIstring\fR that matched \fIexp\fR is replaced with \fIsubSpec\fR. If \fIsubSpec\fR contains a ``&'' or ``\e0'', then it is replaced in the substitution with the portion of \fIstring\fR that matched \fIexp\fR. If \fIsubSpec\fR contains a ``\e\fIn\fR'', where \fIn\fR is a digit between 1 and 9, then it is replaced in the substitution with |
| ︙ | ︙ | |||
94 95 96 97 98 99 100 | \fB\-nocase\fR Upper-case characters in \fIstring\fR will be converted to lower-case before matching against \fIexp\fR; however, substitutions specified by \fIsubSpec\fR use the original unconverted form of \fIstring\fR. .TP 10 \fB\-start\fR \fIindex\fR Specifies a character index offset into the string to start | | > > > > > < < | 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 |
\fB\-nocase\fR
Upper-case characters in \fIstring\fR will be converted to lower-case
before matching against \fIexp\fR; however, substitutions specified
by \fIsubSpec\fR use the original unconverted form of \fIstring\fR.
.TP 10
\fB\-start\fR \fIindex\fR
Specifies a character index offset into the string to start
matching the regular expression at.
.VS 8.5
The \fIindex\fR value is interpreted in the same manner
as the \fIindex\fR argument to \fBstring index\fR.
.VE 8.5
When using this switch, `^'
will not match the beginning of the line, and \\A will still
match the start of the string at \fIindex\fR.
\fIindex\fR will be constrained to the bounds of the input string.
.TP 10
\fB\-\|\-\fR
Marks the end of switches. The argument following this one will
be treated as \fIexp\fR even if it starts with a \fB\-\fR.
.PP
If \fIvarName\fR is supplied, the command returns a count of the
number of matching ranges that were found and replaced, otherwise the
string after replacement is returned.
See the manual entry for \fBregexp\fR for details on the interpretation
of regular expressions.
.SH EXAMPLES
Replace (in the string in variable \fIstring\fR) every instance of
\fBfoo\fR which is a word by itself with \fBbar\fR:
.CS
\fBregsub\fR -all {\e<foo\e>} $string bar string
|
| ︙ | ︙ | |||
138 139 140 141 142 143 144 | # Now we apply the substitution to get a subst-string that # will perform the computational parts of the conversion. set quoted [subst [\fBregsub\fR -all $RE $string $substitution]] .CE .SH "SEE ALSO" | | > > > > | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | # Now we apply the substitution to get a subst-string that # will perform the computational parts of the conversion. set quoted [subst [\fBregsub\fR -all $RE $string $substitution]] .CE .SH "SEE ALSO" regexp(n), re_syntax(n), subst(n), .VS 8.5 string(n) .VE .SH KEYWORDS match, pattern, regular expression, substitute |
Changes to doc/scan.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: scan.n,v 1.12.4.1 2005/06/13 01:45:38 msofer Exp $ '\" .so man.macros .TH scan n 8.4 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME scan \- Parse string using conversion specifiers in the style of sscanf |
| ︙ | ︙ | |||
39 40 41 42 43 44 45 | If the next character in \fIformat\fR is a blank or tab then it matches any number of white space characters in \fIstring\fR (including zero). Otherwise, if it isn't a \fB%\fR character then it must match the next character of \fIstring\fR. When a \fB%\fR is encountered in \fIformat\fR, it indicates the start of a conversion specifier. | < < | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | If the next character in \fIformat\fR is a blank or tab then it matches any number of white space characters in \fIstring\fR (including zero). Otherwise, if it isn't a \fB%\fR character then it must match the next character of \fIstring\fR. When a \fB%\fR is encountered in \fIformat\fR, it indicates the start of a conversion specifier. A conversion specifier contains up to four fields after the \fB%\fR: a \fB*\fR, which indicates that the converted value is to be discarded instead of assigned to a variable; a XPG3 position specifier; a number indicating a maximum field width; a field size modifier; and a conversion character. All of these fields are optional except for the conversion character. The fields that are present must appear in the order given above. .PP When \fBscan\fR finds a conversion specifier in \fIformat\fR, it first skips any white-space characters in \fIstring\fR (unless the specifier is \fB[\fR or \fBc\fR). Then it converts the next input characters according to the |
| ︙ | ︙ | |||
71 72 73 74 75 76 77 | at most once and the empty positions will be filled in with empty strings. .PP The following conversion characters are supported: .TP 10 \fBd\fR The input field must be a decimal integer. It is read in and the value is stored in the variable as a decimal string. | < < < < < < < < < < | 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 118 119 120 121 122 | at most once and the empty positions will be filled in with empty strings. .PP The following conversion characters are supported: .TP 10 \fBd\fR The input field must be a decimal integer. It is read in and the value is stored in the variable as a decimal string. If the \fBl\fR or \fBL\fR field size modifier is given, the scanned value will have an internal representation that is at least 64-bits in size. .TP 10 \fBo\fR The input field must be an octal integer. It is read in and the value is stored in the variable as a decimal string. If the \fBl\fR or \fBL\fR field size modifier is given, the scanned value will have an internal representation that is at least 64-bits in size. If the value exceeds MAX_INT (017777777777 on platforms using 32-bit integers when the \fBl\fR and \fBL\fR modifiers are not given), it will be truncated to a signed integer. Hence, 037777777777 will appear as -1 on a 32-bit machine by default. .TP 10 \fBx\fR The input field must be a hexadecimal integer. It is read in and the value is stored in the variable as a decimal string. If the \fBl\fR or \fBL\fR field size modifier is given, the scanned value will have an internal representation that is at least 64-bits in size. If the value exceeds MAX_INT (0x7FFFFFFF on platforms using 32-bit integers when the \fBl\fR and \fBL\fR modifiers are not given), it will be truncated to a signed integer. Hence, 0xFFFFFFFF will appear as -1 on a 32-bit machine. .TP 10 \fBu\fR The input field must be a decimal integer. The value is stored in the variable as an unsigned decimal integer string. If the \fBl\fR or \fBL\fR field size modifier is given, the scanned value will have an internal representation that is at least 64-bits in size. .TP 10 \fBi\fR The input field must be an integer. The base (i.e. decimal, octal, or hexadecimal) is determined in the same fashion as described in \fBexpr\fR. The value is stored in the variable as a decimal string. If the \fBl\fR or \fBL\fR field size modifier is given, the scanned value will have an internal representation that is at least 64-bits in size. .TP 10 \fBc\fR A single character is read in and its binary value is stored in the variable as a decimal string. Initial white space is not skipped in this case, so the input field may be a white-space character. This conversion is different from the ANSI standard in that the |
| ︙ | ︙ | |||
195 196 197 198 199 200 201 | \fB%p\fR conversion specifier is not currently supported. .IP [2] For \fB%c\fR conversions a single character value is converted to a decimal string, which is then assigned to the corresponding \fIvarName\fR; no field width may be specified for this conversion. .IP [3] | < < | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | \fB%p\fR conversion specifier is not currently supported. .IP [2] For \fB%c\fR conversions a single character value is converted to a decimal string, which is then assigned to the corresponding \fIvarName\fR; no field width may be specified for this conversion. .IP [3] The \fBh\fR modifier is always ignored and the \fBl\fR and \fBL\fR modifiers are ignored when converting real values (i.e. type \fBdouble\fR is used for the internal representation). .IP [4] If the end of the input string is reached before any conversions have been performed and no variables are given, an empty string is returned. .SH EXAMPLES Parse a simple color specification of the form \fI#RRGGBB\fR using hexadecimal conversions with field sizes: .CS |
| ︙ | ︙ |
Changes to doc/seek.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: seek.n,v 1.7.4.1 2005/06/13 01:45:39 msofer Exp $ '\" .so man.macros .TH seek n 8.1 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME seek \- Change the access position for an open channel .SH SYNOPSIS \fBseek \fIchannelId offset \fR?\fIorigin\fR? .BE .SH DESCRIPTION .PP Changes the current access position for \fIchannelId\fR. .PP \fIChannelId\fR must be an identifier for an open channel such as a Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR), the return value from an invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel creation command provided by a Tcl extension. .PP The \fIoffset\fR and \fIorigin\fR arguments specify the position at which the next read or write will occur for \fIchannelId\fR. \fIOffset\fR must be an integer (which may be negative) and \fIorigin\fR must be one of the following: .TP 10 \fBstart\fR |
| ︙ | ︙ | |||
53 54 55 56 57 58 59 | The command flushes all buffered output for the channel before the command returns, even if the channel is in nonblocking mode. It also discards any buffered and unread input. This command returns an empty string. An error occurs if this command is applied to channels whose underlying file or device does not support seeking. .PP | < < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | The command flushes all buffered output for the channel before the command returns, even if the channel is in nonblocking mode. It also discards any buffered and unread input. This command returns an empty string. An error occurs if this command is applied to channels whose underlying file or device does not support seeking. .PP Note that \fIoffset\fR values are byte offsets, not character offsets. Both \fBseek\fR and \fBtell\fR operate in terms of bytes, not characters, unlike \fBread\fR. .SH EXAMPLES Read a file twice: .CS set f [open file.txt] set data1 [read $f] \fBseek\fR $f 0 set data2 [read $f] |
| ︙ | ︙ |
Changes to doc/string.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: string.n,v 1.26.2.1 2005/06/13 01:45:39 msofer Exp $ '\" .so man.macros .TH string n 8.1 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME string \- Manipulate strings |
| ︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 | will return \fB\-1\fR. .RE .TP \fBstring index \fIstring charIndex\fR Returns the \fIcharIndex\fR'th character of the \fIstring\fR argument. A \fIcharIndex\fR of 0 corresponds to the first character of the string. \fIcharIndex\fR may be specified as follows: .RS .IP \fIinteger\fR 10 | > > | > | > | | > > > > > > > | > > > > > > > > | > | 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 | will return \fB\-1\fR. .RE .TP \fBstring index \fIstring charIndex\fR Returns the \fIcharIndex\fR'th character of the \fIstring\fR argument. A \fIcharIndex\fR of 0 corresponds to the first character of the string. \fIcharIndex\fR may be specified as follows: .VS 8.5 .RS .IP \fIinteger\fR 10 For any index value that passes \fBstring is integer -strict\fR, the char specified at this integral index (e.g. \fB2\fR would refer to the "c" in "abcd"). .IP \fBend\fR 10 The last char of the string (e.g. \fBend\fR would refer to the "d" in "abcd"). .IP \fBend\fR\-\fIN\fR 10 The last char of the string minus the specified integer offset \fIN\fR (e.g. \fBend\fR\-1 would refer to the "c" in "abcd"). .IP \fBend\fR+\fIN\fR 10 The last char of the string plus the specified integer offset \fIN\fR (e.g. \fBend\fR+\-1 would refer to the "c" in "abcd"). .IP \fIM\fR+\fIN\fR 10 The char specified at the integral index that is the sum of integer values \fIM\fR and \fIN\fR (e.g. \fB1+1\fR would refer to the "c" in "abcd"). .IP \fIM\fR\-\fIN\fR 10 The char specified at the integral index that is the difference of integer values \fIM\fR and \fIN\fR (e.g. \fB2\-1\fR would refer to the "b" in "abcd"). .PP In the specifications above, the integer value \fIM\fR contains no trailing whitespace and the integer value \fIN\fR contains no leading whitespace. .PP If \fIcharIndex\fR is less than 0 or greater than or equal to the length of the string then this command returns an empty string. .RE .VE .TP \fBstring is \fIclass\fR ?\fB\-strict\fR? ?\fB\-failindex \fIvarname\fR? \fIstring\fR Returns 1 if \fIstring\fR is a valid member of the specified character class, otherwise returns 0. If \fB\-strict\fR is specified, then an empty string returns 0, otherwise an empty string will return 1 on any class. If \fB\-failindex\fR is specified, then if the function returns 0, the index in the string where the class was no longer valid |
| ︙ | ︙ |
Changes to doc/subst.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2001 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: subst.n,v 1.6.4.1 2005/06/13 01:45:40 msofer Exp $ '\" .so man.macros .TH subst n 7.4 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME subst \- Perform backslash, command, and variable substitutions |
| ︙ | ︙ | |||
32 33 34 35 36 37 38 | If any of the \fB\-nobackslashes\fR, \fB\-nocommands\fR, or \fB\-novariables\fR are specified, then the corresponding substitutions are not performed. For example, if \fB\-nocommands\fR is specified, command substitution is not performed: open and close brackets are treated as ordinary characters with no special interpretation. .PP | < | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | If any of the \fB\-nobackslashes\fR, \fB\-nocommands\fR, or \fB\-novariables\fR are specified, then the corresponding substitutions are not performed. For example, if \fB\-nocommands\fR is specified, command substitution is not performed: open and close brackets are treated as ordinary characters with no special interpretation. .PP Note that the substitution of one kind can include substitution of other kinds. For example, even when the \fB-novariables\fR option is specified, command substitution is performed without restriction. This means that any variable substitution necessary to complete the command substitution will still take place. Likewise, any command substitution necessary to complete a variable substitution will take place, even when \fB-nocommands\fR is specified. See the |
| ︙ | ︙ | |||
55 56 57 58 59 60 61 | will be substituted for that entire command or variable substitution (as long as it is well-formed Tcl.) If a return exception occurs, or any other return code is returned during command or variable substitution, then the returned value is substituted for that substitution. See the EXAMPLES below. In this way, all exceptional return codes are ``caught'' by \fBsubst\fR. The \fBsubst\fR command itself will either return an error, or will complete successfully. | < < | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
will be substituted for that entire command or variable substitution
(as long as it is well-formed Tcl.) If a return exception occurs,
or any other return code is returned during command or variable
substitution, then the returned value is substituted for that
substitution. See the EXAMPLES below. In this way, all exceptional
return codes are ``caught'' by \fBsubst\fR. The \fBsubst\fR command
itself will either return an error, or will complete successfully.
.SH EXAMPLES
.PP
When it performs its substitutions, \fIsubst\fR does not give any
special treatment to double quotes or curly braces (except within
command substitutions) so the script
.CS
set a 44
\fBsubst\fR {xyz {$a}}
.CE
returns ``\fBxyz {44}\fR'', not ``\fBxyz {$a}\fR''
and the script
.CS
set a "p\\} q \\{r"
\fBsubst\fR {xyz {$a}}
.CE
return ``\fBxyz {p} q {r}\fR'', not ``\fBxyz {p\\} q \\{r}\fR''.
.PP
|
| ︙ | ︙ | |||
112 113 114 115 116 117 118 |
\fBsubst\fR {abc,[return foo;expr 1+2],def}
.CE
returns ``\fBabc,foo,def\fR'', not ``\fBabc,3,def\fR'' and
.CS
\fBsubst\fR {abc,[return -code 10 foo;expr 1+2],def}
.CE
also returns ``\fBabc,foo,def\fR'', not ``\fBabc,3,def\fR''.
| < | 109 110 111 112 113 114 115 116 117 118 119 120 121 |
\fBsubst\fR {abc,[return foo;expr 1+2],def}
.CE
returns ``\fBabc,foo,def\fR'', not ``\fBabc,3,def\fR'' and
.CS
\fBsubst\fR {abc,[return -code 10 foo;expr 1+2],def}
.CE
also returns ``\fBabc,foo,def\fR'', not ``\fBabc,3,def\fR''.
.SH "SEE ALSO"
Tcl(n), eval(n), break(n), continue(n)
.SH KEYWORDS
backslash substitution, command substitution, variable substitution
|
Changes to doc/switch.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: switch.n,v 1.8.4.1 2005/06/13 01:45:40 msofer Exp $ '\" .so man.macros .TH switch n 8.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME switch \- Evaluate one of several scripts, depending on a given value .SH SYNOPSIS \fBswitch \fR?\fIoptions\fR?\fI string pattern body \fR?\fIpattern body \fR...? .sp |
| ︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | \fB\-regexp\fR When matching \fIstring\fR to the patterns, use regular expression matching (as described in the \fBre_syntax\fR reference page). '\" Options defined by TIP#75 .VS 8.5 .TP 10 \fB\-matchvar\fR \fIvarName\fR This option (only legal when \fB\-regexp\fR is also specified) specifies the name of a variable into which the list of matches found by the regular expression engine will be written. The first element of the list written will be the overall substring of the input string (i.e. the \fIstring\fR argument to \fBswitch\fR) matched, the second element of the list will be the substring matched by the first | > > > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | \fB\-regexp\fR When matching \fIstring\fR to the patterns, use regular expression matching (as described in the \fBre_syntax\fR reference page). '\" Options defined by TIP#75 .VS 8.5 .TP 10 \fB\-nocase\fR Causes comparisons to be handled in a case-insensitive manner. .TP 10 \fB\-matchvar\fR \fIvarName\fR This option (only legal when \fB\-regexp\fR is also specified) specifies the name of a variable into which the list of matches found by the regular expression engine will be written. The first element of the list written will be the overall substring of the input string (i.e. the \fIstring\fR argument to \fBswitch\fR) matched, the second element of the list will be the substring matched by the first |
| ︙ | ︙ |
Changes to doc/tclvars.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: tclvars.n,v 1.20.4.1 2005/06/13 01:45:40 msofer Exp $ '\" .so man.macros .TH tclvars n 8.0 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tclvars \- Variables used by Tcl |
| ︙ | ︙ | |||
33 34 35 36 37 38 39 | environment variable. Changes to the \fBenv\fR array will affect the environment passed to children by commands like \fBexec\fR. If the entire \fBenv\fR array is unset then Tcl will stop monitoring \fBenv\fR accesses and will not update environment variables. .RS | < < | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | environment variable. Changes to the \fBenv\fR array will affect the environment passed to children by commands like \fBexec\fR. If the entire \fBenv\fR array is unset then Tcl will stop monitoring \fBenv\fR accesses and will not update environment variables. .RS Under Windows, the environment variables PATH and COMSPEC in any capitalization are converted automatically to upper case. For instance, the PATH variable could be exported by the operating system as ``path'', ``Path'', ``PaTh'', etc., causing otherwise simple Tcl code to have to support many special cases. All other environment variables inherited by Tcl are left unmodified. Setting an env array variable to blank is the same as unsetting it as this is the behavior of the underlying Windows OS. It should be noted that relying on an existing and empty environment variable won't work on windows and is discouraged for cross-platform usage. .RE .TP \fBerrorCode\fR This variable holds the value of the \fB-errorcode\fR return option set by the most recent error that occurred in this interpreter. This list value represents additional information about the error in a form that is easy to process with programs. |
| ︙ | ︙ | |||
159 160 161 162 163 164 165 | \fBtcl_patchLevel\fR When an interpreter is created Tcl initializes this variable to hold a string giving the current patch level for Tcl, such as \fB7.3p2\fR for Tcl 7.3 with the first two official patches, or \fB7.4b4\fR for the fourth beta release of Tcl 7.4. The value of this variable is returned by the \fBinfo patchlevel\fR command. | < < < < | 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 | \fBtcl_patchLevel\fR When an interpreter is created Tcl initializes this variable to hold a string giving the current patch level for Tcl, such as \fB7.3p2\fR for Tcl 7.3 with the first two official patches, or \fB7.4b4\fR for the fourth beta release of Tcl 7.4. The value of this variable is returned by the \fBinfo patchlevel\fR command. .TP \fBtcl_pkgPath\fR This variable holds a list of directories indicating where packages are normally installed. It is not used on Windows. It typically contains either one or two entries; if it contains two entries, the first is normally a directory for platform-dependent packages (e.g., shared library binaries) and the second is normally a directory for platform-independent packages (e.g., script files). Typically a package is installed as a subdirectory of one of the entries in \fB$tcl_pkgPath\fR. The directories in \fB$tcl_pkgPath\fR are included by default in the \fBauto_path\fR variable, so they and their immediate subdirectories are automatically searched for packages during \fBpackage require\fR commands. Note: \fBtcl_pkgPath\fR it not intended to be modified by the application. Its value is added to \fBauto_path\fR at startup; changes to \fBtcl_pkgPath\fR are not reflected in \fBauto_path\fR. If you want Tcl to search additional directories for packages you should add the names of those directories to \fBauto_path\fR, not \fBtcl_pkgPath\fR. .TP \fBtcl_platform\fR This is an associative array whose elements contain information about the platform on which the application is running, such as the name of the operating system, its current release number, and the machine's instruction set. The elements listed below will always be defined, but they may have empty strings as values if Tcl couldn't retrieve any relevant information. In addition, extensions and applications may add additional values to the array. The predefined elements are: .RS .TP \fBbyteOrder\fR The native byte order of this machine: either \fBlittleEndian\fR or \fBbigEndian\fR. .TP \fBdebug\fR If this variable exists, then the interpreter was compiled with and linked to a debug-enabled C run-time. This variable will only exist on Windows, so extension writers can specify which package to load depending on the C run-time library that is in use. This is not an indication that this core contains symbols. |
| ︙ | ︙ | |||
237 238 239 240 241 242 243 | \fBuser\fR This identifies the current user based on the login information available on the platform. This comes from the USER or LOGNAME environment variable on Unix, and the value from GetUserName on Windows. .TP \fBwordSize\fR | < < < > > > | > > > > > > > > > > < | 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 | \fBuser\fR This identifies the current user based on the login information available on the platform. This comes from the USER or LOGNAME environment variable on Unix, and the value from GetUserName on Windows. .TP \fBwordSize\fR This gives the size of the native-machine word in bytes (strictly, it is same as the result of evaluating \fIsizeof(long)\fR in C.) .RE .TP \fBtcl_precision\fR This variable controls the number of digits to generate when converting floating-point values to strings. It defaults .VS 8.5 to 0. \fIApplications should not change this value;\fR it is provided for compatibility with legacy code. .PP The default value of 0 is special, meaning that Tcl should convert numbers using as few digits as possible while still distinguishing any floating point number from its nearest neighbours. It differs from using an arbitrarily high value for \fItcl_precision\fR in that an inexact number like \fI1.4\fR will convert as \fI1.4\fR rather than \fI1.3999999999999999\fR even though the latter is nearer to the exact value of the binary number. .VE 8.5 .PP 17 digits is ``perfect'' for IEEE floating-point in that it allows double-precision values to be converted to strings and back to binary with no loss of information. However, using 17 digits prevents any rounding, which produces longer, less intuitive results. For example, \fBexpr 1.4\fR returns 1.3999999999999999 with \fBtcl_precision\fR set to 17, vs. 1.4 if \fBtcl_precision\fR is 12. .RS All interpreters in a process share a single \fBtcl_precision\fR value: changing it in one interpreter will affect all other interpreters as well. However, safe interpreters are not allowed to modify the variable. .RE .TP \fBtcl_rcFileName\fR This variable is used during initialization to indicate the name of a user-specific startup file. If it is set by application-specific initialization, then the Tcl startup code will check for the existence of this file and \fBsource\fR it if it exists. For example, for \fBwish\fR the variable is set to \fB~/.wishrc\fR for Unix and \fB~/wishrc.tcl\fR |
| ︙ | ︙ |
Changes to doc/tell.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: tell.n,v 1.7.4.1 2005/06/13 01:45:40 msofer Exp $
'\"
.so man.macros
.TH tell n 8.1 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
tell \- Return current access position for an open channel
.SH SYNOPSIS
\fBtell \fIchannelId\fR
.BE
.SH DESCRIPTION
.PP
Returns an integer string giving the current access position in
\fIchannelId\fR. This value returned is a byte offset that can be passed to
\fBseek\fR in order to set the channel to a particular position. Note
that this value is in terms of bytes, not characters like \fBread\fR.
The value returned is -1 for channels that do not support
seeking.
.PP
\fIChannelId\fR must be an identifier for an open channel such as a
Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR),
the return value from an invocation of \fBopen\fR or \fBsocket\fR, or
the result of a channel creation command provided by a Tcl extension.
.SH EXAMPLE
Read a line from a file channel only if it starts with \fBfoobar\fR:
.CS
# Save the offset in case we need to undo the read...
set offset [\fBtell\fR $chan]
if {[read $chan 6] eq "foobar"} {
gets $chan line
|
| ︙ | ︙ |
Changes to doc/unload.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 2003 George Petasis, petasis@iit.demokritos.gr. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 2003 George Petasis, petasis@iit.demokritos.gr. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: unload.n,v 1.6.4.1 2005/06/13 01:45:40 msofer Exp $ '\" .so man.macros .TH unload n 8.5 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME unload \- Unload machine code |
| ︙ | ︙ | |||
112 113 114 115 116 117 118 | .PP If \fIpackageName\fR is omitted or specified as an empty string, Tcl tries to guess the name of the package. This may be done differently on different platforms. The default guess, which is used on most UNIX platforms, is to take the last element of \fIfileName\fR, strip off the first three characters if they are \fBlib\fR, and use any following | < < | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
.PP
If \fIpackageName\fR is omitted or specified as an empty string,
Tcl tries to guess the name of the package.
This may be done differently on different platforms.
The default guess, which is used on most UNIX platforms, is to
take the last element of \fIfileName\fR, strip off the first
three characters if they are \fBlib\fR, and use any following
alphabetic and underline characters as the module name.
For example, the command \fBunload libxyz4.2.so\fR uses the module
name \fBxyz\fR and the command \fBunload bin/last.so {}\fR uses the
module name \fBlast\fR.
.SH "PORTABILITY ISSUES"
.TP
\fBUnix\fR\0\0\0\0\0
.
|
| ︙ | ︙ |
Changes to doc/unset.n.
1 2 3 4 5 6 7 8 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: unset.n,v 1.8.4.1 2005/06/13 01:45:40 msofer Exp $ '\" .so man.macros .TH unset n 8.4 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME unset \- Delete variables |
| ︙ | ︙ | |||
24 25 26 27 28 29 30 | Each \fIname\fR is a variable name, specified in any of the ways acceptable to the \fBset\fR command. If a \fIname\fR refers to an element of an array then that element is removed without affecting the rest of the array. If a \fIname\fR consists of an array name with no parenthesized index, then the entire array is deleted. The \fBunset\fR command returns an empty string as result. | < < | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | Each \fIname\fR is a variable name, specified in any of the ways acceptable to the \fBset\fR command. If a \fIname\fR refers to an element of an array then that element is removed without affecting the rest of the array. If a \fIname\fR consists of an array name with no parenthesized index, then the entire array is deleted. The \fBunset\fR command returns an empty string as result. If \fI\-nocomplain\fR is specified as the first argument, any possible errors are suppressed. The option may not be abbreviated, in order to disambiguate it from possible variable names. The option \fI\-\-\fR indicates the end of the options, and should be used if you wish to remove a variable with the same name as any of the options. If an error occurs, any variables after the named one causing the error not deleted. An error can occur when the named variable doesn't exist, or the name refers to an array element but the variable is a scalar, or the name refers to a variable in a non-existent namespace. .SH EXAMPLE Create an array containing a mapping from some numbers to their squares and remove the array elements for non-prime numbers: |
| ︙ | ︙ |
Changes to doc/upvar.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: upvar.n,v 1.10.4.1 2005/06/13 01:45:40 msofer Exp $ '\" .so man.macros .TH upvar n "" Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME upvar \- Create link to variable in a different stack frame |
| ︙ | ︙ | |||
64 65 66 67 68 69 70 | counts as another call level for \fBuplevel\fR and \fBupvar\fR commands. For example, \fBinfo level 1\fR will return a list describing a command that is either the outermost procedure call or the outermost \fBnamespace eval\fR command. Also, \fBuplevel #0\fR evaluates a script at top-level in the outermost namespace (the global namespace). .PP | < | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | counts as another call level for \fBuplevel\fR and \fBupvar\fR commands. For example, \fBinfo level 1\fR will return a list describing a command that is either the outermost procedure call or the outermost \fBnamespace eval\fR command. Also, \fBuplevel #0\fR evaluates a script at top-level in the outermost namespace (the global namespace). .PP If an upvar variable is unset (e.g. \fBx\fR in \fBadd2\fR above), the \fBunset\fR operation affects the variable it is linked to, not the upvar variable. There is no way to unset an upvar variable except by exiting the procedure in which it is defined. However, it is possible to retarget an upvar variable by executing another \fBupvar\fR command. .SH "TRACES AND UPVAR" |
| ︙ | ︙ | |||
97 98 99 100 101 102 103 | .CE .PP If \fIotherVar\fR refers to an element of an array, then variable traces set for the entire array will not be invoked when \fImyVar\fR is accessed (but traces on the particular element will still be invoked). In particular, if the array is \fBenv\fR, then changes made to \fImyVar\fR will not be passed to subprocesses correctly. | < | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
.CE
.PP
If \fIotherVar\fR refers to an element of an array, then variable
traces set for the entire array will not be invoked when \fImyVar\fR
is accessed (but traces on the particular element will still be
invoked). In particular, if the array is \fBenv\fR, then changes
made to \fImyVar\fR will not be passed to subprocesses correctly.
.SH EXAMPLE
A \fBdecr\fR command that works like \fBincr\fR except it subtracts
the value from the variable instead of adding it:
.CS
proc decr {varName {decrement 1}} {
\fBupvar\fR 1 $varName var
incr var [expr {-$decrement}]
|
| ︙ | ︙ |
Changes to doc/variable.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies '\" Copyright (c) 1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: variable.n,v 1.7.2.1 2005/06/13 01:45:40 msofer Exp $ '\" .so man.macros .TH variable n 8.0 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME variable \- create and initialize a namespace variable |
| ︙ | ︙ |
Changes to generic/tcl.decls.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # tcl.decls -- # # This file contains the declarations for all supported public # functions that are exported by the Tcl library via the stubs table. # This file is used to generate the tclDecls.h, tclPlatDecls.h, # tclStub.c, and tclPlatStub.c files. # # # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # tcl.decls -- # # This file contains the declarations for all supported public # functions that are exported by the Tcl library via the stubs table. # This file is used to generate the tclDecls.h, tclPlatDecls.h, # tclStub.c, and tclPlatStub.c files. # # # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: tcl.decls,v 1.108.2.1 2005/06/13 01:45:40 msofer Exp $ library tcl # Define the tcl interface with several sub interfaces: # tclPlat - platform specific public # tclInt - generic private # tclPlatInt - platform specific private |
| ︙ | ︙ | |||
132 133 134 135 136 137 138 |
declare 29 generic {
Tcl_Obj * Tcl_DuplicateObj(Tcl_Obj *objPtr)
}
declare 30 generic {
void TclFreeObj(Tcl_Obj *objPtr)
}
declare 31 generic {
| | | | | 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 |
declare 29 generic {
Tcl_Obj * Tcl_DuplicateObj(Tcl_Obj *objPtr)
}
declare 30 generic {
void TclFreeObj(Tcl_Obj *objPtr)
}
declare 31 generic {
int Tcl_GetBoolean(Tcl_Interp *interp, CONST char *src, int *boolPtr)
}
declare 32 generic {
int Tcl_GetBooleanFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
int *boolPtr)
}
declare 33 generic {
unsigned char * Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, int *lengthPtr)
}
declare 34 generic {
int Tcl_GetDouble(Tcl_Interp *interp, CONST char *src, double *doublePtr)
}
declare 35 generic {
int Tcl_GetDoubleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
double *doublePtr)
}
declare 36 generic {
int Tcl_GetIndexFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
CONST84 char **tablePtr, CONST char *msg, int flags, int *indexPtr)
}
declare 37 generic {
int Tcl_GetInt(Tcl_Interp *interp, CONST char *src, int *intPtr)
}
declare 38 generic {
int Tcl_GetIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr)
}
declare 39 generic {
int Tcl_GetLongFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr)
}
|
| ︙ | ︙ | |||
257 258 259 260 261 262 263 |
void Tcl_AddObjErrorInfo(Tcl_Interp *interp, CONST char *message,
int length)
}
declare 68 generic {
void Tcl_AllowExceptions(Tcl_Interp *interp)
}
declare 69 generic {
| | | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
void Tcl_AddObjErrorInfo(Tcl_Interp *interp, CONST char *message,
int length)
}
declare 68 generic {
void Tcl_AllowExceptions(Tcl_Interp *interp)
}
declare 69 generic {
void Tcl_AppendElement(Tcl_Interp *interp, CONST char *element)
}
declare 70 generic {
void Tcl_AppendResult(Tcl_Interp *interp, ...)
}
declare 71 generic {
Tcl_AsyncHandler Tcl_AsyncCreate(Tcl_AsyncProc *proc,
ClientData clientData)
|
| ︙ | ︙ | |||
427 428 429 430 431 432 433 |
declare 115 generic {
int Tcl_DoOneEvent(int flags)
}
declare 116 generic {
void Tcl_DoWhenIdle(Tcl_IdleProc *proc, ClientData clientData)
}
declare 117 generic {
| | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
declare 115 generic {
int Tcl_DoOneEvent(int flags)
}
declare 116 generic {
void Tcl_DoWhenIdle(Tcl_IdleProc *proc, ClientData clientData)
}
declare 117 generic {
char * Tcl_DStringAppend(Tcl_DString *dsPtr, CONST char *bytes, int length)
}
declare 118 generic {
char * Tcl_DStringAppendElement(Tcl_DString *dsPtr, CONST char *element)
}
declare 119 generic {
void Tcl_DStringEndSublist(Tcl_DString *dsPtr)
}
declare 120 generic {
void Tcl_DStringFree(Tcl_DString *dsPtr)
}
|
| ︙ | ︙ | |||
463 464 465 466 467 468 469 |
declare 127 generic {
CONST84_RETURN char * Tcl_ErrnoId(void)
}
declare 128 generic {
CONST84_RETURN char * Tcl_ErrnoMsg(int err)
}
declare 129 generic {
| | | | | | | 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 513 514 515 516 517 518 519 |
declare 127 generic {
CONST84_RETURN char * Tcl_ErrnoId(void)
}
declare 128 generic {
CONST84_RETURN char * Tcl_ErrnoMsg(int err)
}
declare 129 generic {
int Tcl_Eval(Tcl_Interp *interp, CONST char *script)
}
# This is obsolete, use Tcl_FSEvalFile
declare 130 generic {
int Tcl_EvalFile(Tcl_Interp *interp, CONST char *fileName)
}
declare 131 generic {
int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
}
declare 132 generic {
void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc *freeProc)
}
declare 133 generic {
void Tcl_Exit(int status)
}
declare 134 generic {
int Tcl_ExposeCommand(Tcl_Interp *interp, CONST char *hiddenCmdToken,
CONST char *cmdName)
}
declare 135 generic {
int Tcl_ExprBoolean(Tcl_Interp *interp, CONST char *expr, int *ptr)
}
declare 136 generic {
int Tcl_ExprBooleanObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *ptr)
}
declare 137 generic {
int Tcl_ExprDouble(Tcl_Interp *interp, CONST char *expr, double *ptr)
}
declare 138 generic {
int Tcl_ExprDoubleObj(Tcl_Interp *interp, Tcl_Obj *objPtr, double *ptr)
}
declare 139 generic {
int Tcl_ExprLong(Tcl_Interp *interp, CONST char *expr, long *ptr)
}
declare 140 generic {
int Tcl_ExprLongObj(Tcl_Interp *interp, Tcl_Obj *objPtr, long *ptr)
}
declare 141 generic {
int Tcl_ExprObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
Tcl_Obj **resultPtrPtr)
}
declare 142 generic {
int Tcl_ExprString(Tcl_Interp *interp, CONST char *expr)
}
declare 143 generic {
void Tcl_Finalize(void)
}
declare 144 generic {
void Tcl_FindExecutable(CONST char *argv0)
}
|
| ︙ | ︙ | |||
595 596 597 598 599 600 601 |
Tcl_Obj * Tcl_GetObjResult(Tcl_Interp *interp)
}
# Tcl_GetOpenFile is only available on unix, but it is a part of the old
# generic interface, so we inlcude it here for compatibility reasons.
declare 167 unix {
| | | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
Tcl_Obj * Tcl_GetObjResult(Tcl_Interp *interp)
}
# Tcl_GetOpenFile is only available on unix, but it is a part of the old
# generic interface, so we inlcude it here for compatibility reasons.
declare 167 unix {
int Tcl_GetOpenFile(Tcl_Interp *interp, CONST char *chanID, int forWriting,
int checkUsage, ClientData *filePtr)
}
# Obsolete. Should now use Tcl_FSGetPathType which is objectified
# and therefore usually faster.
declare 168 generic {
Tcl_PathType Tcl_GetPathType(CONST char *path)
}
|
| ︙ | ︙ | |||
723 724 725 726 727 728 729 |
declare 201 generic {
void Tcl_Preserve(ClientData data)
}
declare 202 generic {
void Tcl_PrintDouble(Tcl_Interp *interp, double value, char *dst)
}
declare 203 generic {
| | | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 |
declare 201 generic {
void Tcl_Preserve(ClientData data)
}
declare 202 generic {
void Tcl_PrintDouble(Tcl_Interp *interp, double value, char *dst)
}
declare 203 generic {
int Tcl_PutEnv(CONST char *assignment)
}
declare 204 generic {
CONST84_RETURN char * Tcl_PosixError(Tcl_Interp *interp)
}
declare 205 generic {
void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position)
}
|
| ︙ | ︙ | |||
750 751 752 753 754 755 756 |
declare 210 generic {
void Tcl_RegisterChannel(Tcl_Interp *interp, Tcl_Channel chan)
}
declare 211 generic {
void Tcl_RegisterObjType(Tcl_ObjType *typePtr)
}
declare 212 generic {
| | | | | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 |
declare 210 generic {
void Tcl_RegisterChannel(Tcl_Interp *interp, Tcl_Channel chan)
}
declare 211 generic {
void Tcl_RegisterObjType(Tcl_ObjType *typePtr)
}
declare 212 generic {
Tcl_RegExp Tcl_RegExpCompile(Tcl_Interp *interp, CONST char *pattern)
}
declare 213 generic {
int Tcl_RegExpExec(Tcl_Interp *interp, Tcl_RegExp regexp,
CONST char *text, CONST char *start)
}
declare 214 generic {
int Tcl_RegExpMatch(Tcl_Interp *interp, CONST char *text,
CONST char *pattern)
}
declare 215 generic {
void Tcl_RegExpRange(Tcl_RegExp regexp, int index,
CONST84 char **startPtr, CONST84 char **endPtr)
}
declare 216 generic {
|
| ︙ | ︙ | |||
817 818 819 820 821 822 823 |
declare 230 generic {
void Tcl_SetPanicProc(Tcl_PanicProc *panicProc)
}
declare 231 generic {
int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth)
}
declare 232 generic {
| | | 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 |
declare 230 generic {
void Tcl_SetPanicProc(Tcl_PanicProc *panicProc)
}
declare 231 generic {
int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth)
}
declare 232 generic {
void Tcl_SetResult(Tcl_Interp *interp, char *result,
Tcl_FreeProc *freeProc)
}
declare 233 generic {
int Tcl_SetServiceMode(int mode)
}
declare 234 generic {
void Tcl_SetObjErrorCode(Tcl_Interp *interp, Tcl_Obj *errorObjPtr)
|
| ︙ | ︙ | |||
952 953 954 955 956 957 958 |
declare 268 generic {
void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList)
}
declare 269 generic {
CONST84_RETURN char * Tcl_HashStats(Tcl_HashTable *tablePtr)
}
declare 270 generic {
| | | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
declare 268 generic {
void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList)
}
declare 269 generic {
CONST84_RETURN char * Tcl_HashStats(Tcl_HashTable *tablePtr)
}
declare 270 generic {
CONST84_RETURN char * Tcl_ParseVar(Tcl_Interp *interp, CONST char *start,
CONST84 char **termPtr)
}
declare 271 generic {
CONST84_RETURN char * Tcl_PkgPresent(Tcl_Interp *interp, CONST char *name,
CONST char *version, int exact)
}
declare 272 generic {
|
| ︙ | ︙ | |||
1116 1117 1118 1119 1120 1121 1122 |
void Tcl_ConditionNotify(Tcl_Condition *condPtr)
}
declare 311 generic {
void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr,
Tcl_Time *timePtr)
}
declare 312 generic {
| | | 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 |
void Tcl_ConditionNotify(Tcl_Condition *condPtr)
}
declare 311 generic {
void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr,
Tcl_Time *timePtr)
}
declare 312 generic {
int Tcl_NumUtfChars(CONST char *src, int length)
}
declare 313 generic {
int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead,
int appendFlag)
}
declare 314 generic {
void Tcl_RestoreResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr)
|
| ︙ | ︙ | |||
1161 1162 1163 1164 1165 1166 1167 |
declare 324 generic {
int Tcl_UniCharToUtf(int ch, char *buf)
}
declare 325 generic {
CONST84_RETURN char * Tcl_UtfAtIndex(CONST char *src, int index)
}
declare 326 generic {
| | | 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 |
declare 324 generic {
int Tcl_UniCharToUtf(int ch, char *buf)
}
declare 325 generic {
CONST84_RETURN char * Tcl_UtfAtIndex(CONST char *src, int index)
}
declare 326 generic {
int Tcl_UtfCharComplete(CONST char *src, int length)
}
declare 327 generic {
int Tcl_UtfBackslash(CONST char *src, int *readPtr, char *dst)
}
declare 328 generic {
CONST84_RETURN char * Tcl_UtfFindFirst(CONST char *src, int ch)
}
|
| ︙ | ︙ | |||
1243 1244 1245 1246 1247 1248 1249 |
declare 350 generic {
int Tcl_UniCharIsUpper(int ch)
}
declare 351 generic {
int Tcl_UniCharIsWordChar(int ch)
}
declare 352 generic {
| | | | | | | | | | | | | 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 |
declare 350 generic {
int Tcl_UniCharIsUpper(int ch)
}
declare 351 generic {
int Tcl_UniCharIsWordChar(int ch)
}
declare 352 generic {
int Tcl_UniCharLen(CONST Tcl_UniChar *uniStr)
}
declare 353 generic {
int Tcl_UniCharNcmp(CONST Tcl_UniChar *ucs, CONST Tcl_UniChar *uct,
unsigned long numChars)
}
declare 354 generic {
char * Tcl_UniCharToUtfDString(CONST Tcl_UniChar *uniStr,
int uniLength, Tcl_DString *dsPtr)
}
declare 355 generic {
Tcl_UniChar * Tcl_UtfToUniCharDString(CONST char *src,
int length, Tcl_DString *dsPtr)
}
declare 356 generic {
Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj,
int flags)
}
declare 357 generic {
Tcl_Obj *Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
int count)
}
declare 358 generic {
void Tcl_FreeParse(Tcl_Parse *parsePtr)
}
declare 359 generic {
void Tcl_LogCommandInfo(Tcl_Interp *interp, CONST char *script,
CONST char *command, int length)
}
declare 360 generic {
int Tcl_ParseBraces(Tcl_Interp *interp, CONST char *start, int numBytes,
Tcl_Parse *parsePtr, int append, CONST84 char **termPtr)
}
declare 361 generic {
int Tcl_ParseCommand(Tcl_Interp *interp, CONST char *start, int numBytes,
int nested, Tcl_Parse *parsePtr)
}
declare 362 generic {
int Tcl_ParseExpr(Tcl_Interp *interp, CONST char *start, int numBytes,
Tcl_Parse *parsePtr)
}
declare 363 generic {
int Tcl_ParseQuotedString(Tcl_Interp *interp, CONST char *start,
int numBytes, Tcl_Parse *parsePtr, int append,
CONST84 char **termPtr)
}
declare 364 generic {
int Tcl_ParseVarName(Tcl_Interp *interp, CONST char *start, int numBytes,
Tcl_Parse *parsePtr, int append)
}
# These 4 functions are obsolete, use Tcl_FSGetCwd, Tcl_FSChdir,
# Tcl_FSAccess and Tcl_FSStat
declare 365 generic {
char *Tcl_GetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr)
}
|
| ︙ | ︙ | |||
1331 1332 1333 1334 1335 1336 1337 |
int Tcl_UniCharIsPrint(int ch)
}
declare 375 generic {
int Tcl_UniCharIsPunct(int ch)
}
declare 376 generic {
int Tcl_RegExpExecObj(Tcl_Interp *interp, Tcl_RegExp regexp,
| | | 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 |
int Tcl_UniCharIsPrint(int ch)
}
declare 375 generic {
int Tcl_UniCharIsPunct(int ch)
}
declare 376 generic {
int Tcl_RegExpExecObj(Tcl_Interp *interp, Tcl_RegExp regexp,
Tcl_Obj *textObj, int offset, int nmatches, int flags)
}
declare 377 generic {
void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr)
}
declare 378 generic {
Tcl_Obj * Tcl_NewUnicodeObj(CONST Tcl_UniChar *unicode, int numChars)
}
|
| ︙ | ︙ | |||
1360 1361 1362 1363 1364 1365 1366 |
Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, int first, int last)
}
declare 384 generic {
void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, CONST Tcl_UniChar *unicode,
int length)
}
declare 385 generic {
| | | 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 |
Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, int first, int last)
}
declare 384 generic {
void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, CONST Tcl_UniChar *unicode,
int length)
}
declare 385 generic {
int Tcl_RegExpMatchObj(Tcl_Interp *interp, Tcl_Obj *textObj,
Tcl_Obj *patternObj)
}
declare 386 generic {
void Tcl_SetNotifier(Tcl_NotifierProcs *notifierProcPtr)
}
declare 387 generic {
Tcl_Mutex * Tcl_GetAllocMutex(void)
|
| ︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 |
void Tcl_ClearChannelHandlers(Tcl_Channel channel)
}
declare 418 generic {
int Tcl_IsChannelExisting(CONST char* channelName)
}
declare 419 generic {
| | | | | | 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 |
void Tcl_ClearChannelHandlers(Tcl_Channel channel)
}
declare 418 generic {
int Tcl_IsChannelExisting(CONST char* channelName)
}
declare 419 generic {
int Tcl_UniCharNcasecmp(CONST Tcl_UniChar *ucs, CONST Tcl_UniChar *uct,
unsigned long numChars)
}
declare 420 generic {
int Tcl_UniCharCaseMatch(CONST Tcl_UniChar *uniStr,
CONST Tcl_UniChar *uniPattern, int nocase)
}
declare 421 generic {
Tcl_HashEntry *Tcl_FindHashEntry(Tcl_HashTable *tablePtr, CONST char *key)
}
declare 422 generic {
|
| ︙ | ︙ | |||
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 |
Tcl_ScaleTimeProc** scaleProc,
ClientData* clientData)
}
# TIP#218 (Driver Thread Actions) davygrvy/akupries ChannelType ver 4
declare 554 generic {
Tcl_DriverThreadActionProc *Tcl_ChannelThreadActionProc(Tcl_ChannelType *chanTypePtr)
}
##############################################################################
# Define the platform specific public Tcl interface. These functions are
# only available on the designated platform.
interface tclPlat
| > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
Tcl_ScaleTimeProc** scaleProc,
ClientData* clientData)
}
# TIP#218 (Driver Thread Actions) davygrvy/akupries ChannelType ver 4
declare 554 generic {
Tcl_DriverThreadActionProc *Tcl_ChannelThreadActionProc(Tcl_ChannelType *chanTypePtr)
}
# TIP #237:
declare 555 generic {
Tcl_Obj* Tcl_NewBignumObj( mp_int* value )
}
declare 556 generic {
Tcl_Obj* Tcl_DbNewBignumObj( mp_int* value, CONST char* file, int line )
}
declare 557 generic {
void Tcl_SetBignumObj( Tcl_Obj* obj, mp_int* value )
}
declare 558 generic {
int Tcl_GetBignumFromObj( Tcl_Interp* interp, Tcl_Obj* obj, mp_int* value )
}
# TIP #208:
declare 559 generic {
int Tcl_TruncateChannel(Tcl_Channel chan, Tcl_WideInt length)
}
declare 560 generic {
Tcl_DriverTruncateProc *Tcl_ChannelTruncateProc(
Tcl_ChannelType *chanTypePtr)
}
##############################################################################
# Define the platform specific public Tcl interface. These functions are
# only available on the designated platform.
interface tclPlat
|
| ︙ | ︙ |
Changes to generic/tcl.h.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tcl.h,v 1.196.2.3 2005/10/09 13:56:35 msofer Exp $ */ #ifndef _TCL #define _TCL /* * * For C++ compilers, use extern "C" |
| ︙ | ︙ | |||
53 54 55 56 57 58 59 | * tools/tcl.hpj.in (not patchlevel, for windows installer) * tools/tcl.wse.in (for windows installer) * tools/tclSplash.bmp (not patchlevel) */ #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 5 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE | | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | * tools/tcl.hpj.in (not patchlevel, for windows installer) * tools/tcl.wse.in (for windows installer) * tools/tclSplash.bmp (not patchlevel) */ #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 5 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE #define TCL_RELEASE_SERIAL 4 #define TCL_VERSION "8.5" #define TCL_PATCH_LEVEL "8.5a4" /* * The following definitions set up the proper options for Windows * compilers. We use this method because there is no autoconf equivalent. */ #ifndef __WIN32__ |
| ︙ | ︙ | |||
764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
double doubleValue; /* - a double-precision floating value */
VOID *otherValuePtr; /* - another, type-specific value */
Tcl_WideInt wideValue; /* - a long long value */
struct { /* - internal rep as two pointers */
VOID *ptr1;
VOID *ptr2;
} twoPtrValue;
} internalRep;
} Tcl_Obj;
/*
* 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).
| > > > > > > | 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 |
double doubleValue; /* - a double-precision floating value */
VOID *otherValuePtr; /* - another, type-specific value */
Tcl_WideInt wideValue; /* - a long long value */
struct { /* - internal rep as two pointers */
VOID *ptr1;
VOID *ptr2;
} twoPtrValue;
struct { /* - internal rep as a wide int,
* tightly packed fields */
VOID *digits; /* Pointer to digits */
unsigned long misc; /* Alloc, used, and signum packed
* into a single word */
} bignumValue;
} internalRep;
} Tcl_Obj;
/*
* 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).
|
| ︙ | ︙ | |||
805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
/*
* Macros and definitions that help to debug the use of Tcl objects.
* When TCL_MEM_DEBUG is defined, the Tcl_New declarations are
* overridden to call debugging versions of the object creation procedures.
*/
#ifdef TCL_MEM_DEBUG
# define Tcl_NewBooleanObj(val) \
Tcl_DbNewBooleanObj(val, __FILE__, __LINE__)
# define Tcl_NewByteArrayObj(bytes, len) \
Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__)
# define Tcl_NewDoubleObj(val) \
Tcl_DbNewDoubleObj(val, __FILE__, __LINE__)
# define Tcl_NewIntObj(val) \
| > > | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
/*
* Macros and definitions that help to debug the use of Tcl objects.
* When TCL_MEM_DEBUG is defined, the Tcl_New declarations are
* overridden to call debugging versions of the object creation procedures.
*/
#ifdef TCL_MEM_DEBUG
# define Tcl_NewBignumObj(val) \
Tcl_DbNewBignumObj(val, __FILE__, __LINE__)
# define Tcl_NewBooleanObj(val) \
Tcl_DbNewBooleanObj(val, __FILE__, __LINE__)
# define Tcl_NewByteArrayObj(bytes, len) \
Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__)
# define Tcl_NewDoubleObj(val) \
Tcl_DbNewDoubleObj(val, __FILE__, __LINE__)
# define Tcl_NewIntObj(val) \
|
| ︙ | ︙ | |||
1064 1065 1066 1067 1068 1069 1070 | */ #define TCL_TRACE_RENAME 0x2000 #define TCL_TRACE_DELETE 0x4000 #define TCL_ALLOW_INLINE_COMPILATION 0x20000 | < < < < < < < < | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | */ #define TCL_TRACE_RENAME 0x2000 #define TCL_TRACE_DELETE 0x4000 #define TCL_ALLOW_INLINE_COMPILATION 0x20000 /* * The TCL_PARSE_PART1 flag is deprecated and has no effect. * The part1 is now always parsed whenever the part2 is NULL. * (This is to avoid a common error when converting code to * use the new object based APIs and forgetting to give the * flag) */ |
| ︙ | ︙ | |||
1500 1501 1502 1503 1504 1505 1506 | typedef int (Tcl_DriverHandlerProc) _ANSI_ARGS_(( ClientData instanceData, int interestMask)); typedef Tcl_WideInt (Tcl_DriverWideSeekProc) _ANSI_ARGS_(( ClientData instanceData, Tcl_WideInt offset, int mode, int *errorCodePtr)); /* TIP #218, Channel Thread Actions */ | | > > > | 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 | typedef int (Tcl_DriverHandlerProc) _ANSI_ARGS_(( ClientData instanceData, int interestMask)); typedef Tcl_WideInt (Tcl_DriverWideSeekProc) _ANSI_ARGS_(( ClientData instanceData, Tcl_WideInt offset, int mode, int *errorCodePtr)); /* TIP #218, Channel Thread Actions */ typedef void (Tcl_DriverThreadActionProc) _ANSI_ARGS_ (( ClientData instanceData, int action)); /* TIP #208, File Truncation (etc.) */ typedef int (Tcl_DriverTruncateProc) _ANSI_ARGS_(( ClientData instanceData, Tcl_WideInt length)); /* * The following declarations either map ckalloc and ckfree to * malloc and free, or they map them to procedures with all sorts * of debugging hooks defined in tclCkalloc.c. */ #ifdef TCL_MEM_DEBUG |
| ︙ | ︙ | |||
1592 1593 1594 1595 1596 1597 1598 |
*/
Tcl_DriverWideSeekProc *wideSeekProc;
/* Procedure to call to seek
* on the channel which can
* handle 64-bit offsets. May be
* NULL, and must be NULL if
* seekProc is NULL. */
| < | | | > | | > > > > > | 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 |
*/
Tcl_DriverWideSeekProc *wideSeekProc;
/* Procedure to call to seek
* on the channel which can
* handle 64-bit offsets. May be
* NULL, and must be NULL if
* seekProc is NULL. */
/*
* Only valid in TCL_CHANNEL_VERSION_4 channels or later
* TIP #218, Channel Thread Actions
* TIP #208 (part relating to truncation)
*/
Tcl_DriverThreadActionProc *threadActionProc;
/* Procedure to call to notify
* the driver of thread specific
* activity for a channel.
* May be NULL. */
Tcl_DriverTruncateProc *truncateProc;
/* Procedure to call to truncate the
* underlying file to a particular
* length. May be NULL if the channel
* does not support truncation. */
} Tcl_ChannelType;
/*
* The following flags determine whether the blockModeProc above should
* set the channel into blocking or nonblocking mode. They are passed
* as arguments to the blockModeProc procedure in the above structure.
*/
|
| ︙ | ︙ | |||
2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 |
* when a command- or time-limit is exceeded by an interpreter.
*/
typedef void (Tcl_LimitHandlerProc) _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp));
typedef void (Tcl_LimitHandlerDeleteProc) _ANSI_ARGS_((ClientData clientData));
#ifndef TCL_NO_DEPRECATED
/*
* Deprecated Tcl procedures:
*/
| > > > > > > > > > | 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 |
* when a command- or time-limit is exceeded by an interpreter.
*/
typedef void (Tcl_LimitHandlerProc) _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp));
typedef void (Tcl_LimitHandlerDeleteProc) _ANSI_ARGS_((ClientData clientData));
#ifndef MP_INT_DECLARED
typedef struct mp_int mp_int;
#define MP_INT_DECLARED
#endif
#ifndef MP_DIGIT_DECLARED
typedef unsigned long mp_digit;
#define MP_DIGIT_DECLARED
#endif
#ifndef TCL_NO_DEPRECATED
/*
* Deprecated Tcl procedures:
*/
|
| ︙ | ︙ |
Changes to generic/tclBasic.c.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > > > > > > > > > > > > > > | < | | | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 9 10 11 12 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 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 |
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
* Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclBasic.c,v 1.141.2.3 2005/06/13 01:45:41 msofer Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
#include <float.h>
#include <math.h>
/*
* The following structure defines the client data for a math function
* registered with Tcl_CreateMathFunc
*/
typedef struct OldMathFuncData {
Tcl_MathProc* proc; /* Handler procedure */
int numArgs; /* Number of args expected */
Tcl_ValueType* argTypes; /* Types of the args */
ClientData clientData; /* Client data for the handler function */
} OldMathFuncData;
/*
* Static procedures in this file:
*/
static char * CallCommandTraces _ANSI_ARGS_((Interp *iPtr, Command *cmdPtr,
CONST char *oldName, CONST char* newName, int flags));
static void DeleteInterpProc _ANSI_ARGS_((Tcl_Interp *interp));
static void ProcessUnexpectedResult _ANSI_ARGS_((Tcl_Interp *interp,
int returnCode));
static int OldMathFuncProc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static void OldMathFuncDeleteProc _ANSI_ARGS_((ClientData));
static int ExprAbsFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprBinaryFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprBoolFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprDoubleFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprIntFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprRandFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprRoundFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprSrandFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprUnaryFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int ExprWideFunc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, Tcl_Obj *CONST *objv));
static int VerifyExprObjType _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
static void MathFuncWrongNumArgs _ANSI_ARGS_((Tcl_Interp* interp,
int expected, int actual, Tcl_Obj *CONST *objv));
#ifndef TCL_WIDE_INT_IS_LONG
/*
* Extract a double value from a general numeric object.
*/
#define GET_DOUBLE_VALUE(doubleVar, objPtr, typePtr) \
if ((typePtr) == &tclIntType) { \
(doubleVar) = (double) (objPtr)->internalRep.longValue; \
} else if ((typePtr) == &tclWideIntType) { \
(doubleVar) = Tcl_WideAsDouble((objPtr)->internalRep.wideValue);\
} else { \
(doubleVar) = (objPtr)->internalRep.doubleValue; \
}
#else /* TCL_WIDE_INT_IS_LONG */
#define GET_DOUBLE_VALUE(doubleVar, objPtr, typePtr) \
if (((typePtr) == &tclIntType) || ((typePtr) == &tclWideIntType)) { \
(doubleVar) = (double) (objPtr)->internalRep.longValue; \
} else { \
(doubleVar) = (objPtr)->internalRep.doubleValue; \
}
#endif /* TCL_WIDE_INT_IS_LONG */
#define GET_WIDE_OR_INT(resultVar, objPtr, longVar, wideVar) \
(resultVar) = Tcl_GetWideIntFromObj((Tcl_Interp *) NULL, (objPtr), \
&(wideVar)); \
if ((resultVar) == TCL_OK && (wideVar) >= Tcl_LongAsWide(LONG_MIN) \
&& (wideVar) <= Tcl_LongAsWide(LONG_MAX)) { \
(objPtr)->typePtr = &tclIntType; \
(objPtr)->internalRep.longValue = (longVar) \
= Tcl_WideAsLong(wideVar); \
}
#define IS_INTEGER_TYPE(typePtr) \
((typePtr) == &tclIntType || (typePtr) == &tclWideIntType)
#define IS_NUMERIC_TYPE(typePtr) \
(IS_INTEGER_TYPE(typePtr) || (typePtr) == &tclDoubleType)
/*
* Macros for testing floating-point values for certain special cases. Test
* for not-a-number by comparing a value against itself; test for infinity
* by comparing against the largest floating-point value.
*/
#ifdef _MSC_VER
#define IS_NAN(f) (_isnan((f)))
#define IS_INF(f) (!(_finite((f))))
#else
#define IS_NAN(f) ((f) != (f))
#define IS_INF(f) (((f) > DBL_MAX) || ((f) < -DBL_MAX))
#endif
extern TclStubs tclStubs;
/*
* The following structure defines the commands in the Tcl core.
*/
typedef struct {
char *name; /* Name of object-based command. */
Tcl_ObjCmdProc *objProc; /* Object-based procedure for command. */
CompileProc *compileProc; /* Procedure called to compile command. */
int isSafe; /* If non-zero, command will be present
* in safe interpreter. Otherwise it will
* be hidden. */
} CmdInfo;
/*
* The built-in commands, and the procedures that implement them:
*/
static CmdInfo builtInCmds[] = {
|
| ︙ | ︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
{"vwait", Tcl_VwaitObjCmd, (CompileProc *) NULL, 1},
{"exec", Tcl_ExecObjCmd, (CompileProc *) NULL, 0},
{"source", Tcl_SourceObjCmd, (CompileProc *) NULL, 0},
#endif /* TCL_GENERIC_ONLY */
{NULL, (Tcl_ObjCmdProc *) NULL, (CompileProc *) NULL, 0}
};
/*
*----------------------------------------------------------------------
*
* Tcl_CreateInterp --
*
* Create a new TCL command interpreter.
*
* Results:
* The return value is a token for the interpreter, which may be
* used in calls to procedures like Tcl_CreateCmd, Tcl_Eval, or
* Tcl_DeleteInterp.
*
* Side effects:
* The command interpreter is initialized with the built-in commands
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < < > | < | | 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 |
{"vwait", Tcl_VwaitObjCmd, (CompileProc *) NULL, 1},
{"exec", Tcl_ExecObjCmd, (CompileProc *) NULL, 0},
{"source", Tcl_SourceObjCmd, (CompileProc *) NULL, 0},
#endif /* TCL_GENERIC_ONLY */
{NULL, (Tcl_ObjCmdProc *) NULL, (CompileProc *) NULL, 0}
};
/*
* Math functions
*/
typedef struct {
CONST char* name; /* Name of the function */
Tcl_ObjCmdProc* objCmdProc; /* Procedure that evaluates the function */
ClientData clientData; /* Client data for the procedure */
} BuiltinFuncDef;
BuiltinFuncDef BuiltinFuncTable[] = {
{ "::tcl::mathfunc::abs", ExprAbsFunc, NULL },
{ "::tcl::mathfunc::acos", ExprUnaryFunc, (ClientData) acos },
{ "::tcl::mathfunc::asin", ExprUnaryFunc, (ClientData) asin },
{ "::tcl::mathfunc::atan", ExprUnaryFunc, (ClientData) atan },
{ "::tcl::mathfunc::atan2", ExprBinaryFunc, (ClientData) atan2 },
{ "::tcl::mathfunc::bool", ExprBoolFunc, NULL },
{ "::tcl::mathfunc::ceil", ExprUnaryFunc, (ClientData) ceil },
{ "::tcl::mathfunc::cos", ExprUnaryFunc, (ClientData) cos },
{ "::tcl::mathfunc::cosh", ExprUnaryFunc, (ClientData) cosh },
{ "::tcl::mathfunc::double",ExprDoubleFunc, NULL },
{ "::tcl::mathfunc::exp", ExprUnaryFunc, (ClientData) exp },
{ "::tcl::mathfunc::floor", ExprUnaryFunc, (ClientData) floor },
{ "::tcl::mathfunc::fmod", ExprBinaryFunc, (ClientData) fmod },
{ "::tcl::mathfunc::hypot", ExprBinaryFunc, (ClientData) hypot },
{ "::tcl::mathfunc::int", ExprIntFunc, NULL },
{ "::tcl::mathfunc::log", ExprUnaryFunc, (ClientData) log },
{ "::tcl::mathfunc::log10", ExprUnaryFunc, (ClientData) log10 },
{ "::tcl::mathfunc::pow", ExprBinaryFunc, (ClientData) pow },
{ "::tcl::mathfunc::rand", ExprRandFunc, NULL },
{ "::tcl::mathfunc::round", ExprRoundFunc, NULL },
{ "::tcl::mathfunc::sin", ExprUnaryFunc, (ClientData) sin },
{ "::tcl::mathfunc::sinh", ExprUnaryFunc, (ClientData) sinh },
{ "::tcl::mathfunc::sqrt", ExprUnaryFunc, (ClientData) sqrt },
{ "::tcl::mathfunc::srand", ExprSrandFunc, NULL },
{ "::tcl::mathfunc::tan", ExprUnaryFunc, (ClientData) tan },
{ "::tcl::mathfunc::tanh", ExprUnaryFunc, (ClientData) tanh },
{ "::tcl::mathfunc::wide", ExprWideFunc, NULL },
{ NULL, NULL, NULL }
};
/*
*----------------------------------------------------------------------
*
* Tcl_CreateInterp --
*
* Create a new TCL command interpreter.
*
* Results:
* The return value is a token for the interpreter, which may be
* used in calls to procedures like Tcl_CreateCmd, Tcl_Eval, or
* Tcl_DeleteInterp.
*
* Side effects:
* The command interpreter is initialized with the built-in commands
* and with the variables documented in tclvars(n).
*
*----------------------------------------------------------------------
*/
Tcl_Interp *
Tcl_CreateInterp()
{
Interp *iPtr;
Tcl_Interp *interp;
Command *cmdPtr;
BuiltinFuncDef *builtinFuncPtr;
const CmdInfo *cmdInfoPtr;
Tcl_Namespace* mathfuncNSPtr;
int i;
union {
char c[sizeof(short)];
short s;
} order;
#ifdef TCL_COMPILE_STATS
ByteCodeStats *statsPtr;
#endif /* TCL_COMPILE_STATS */
TclInitSubsystems();
/*
* Panic if someone updated the CallFrame structure without
* also updating the Tcl_CallFrame structure (or vice versa).
*/
if (sizeof(Tcl_CallFrame) != sizeof(CallFrame)) {
/*NOTREACHED*/
Tcl_Panic("Tcl_CallFrame and CallFrame are not the same size");
}
/*
* Initialize support for namespaces and create the global namespace
* (whose name is ""; an alias is "::"). This also initializes the
* Tcl object type table and other object management code.
*/
iPtr = (Interp *) ckalloc(sizeof(Interp));
interp = (Tcl_Interp *) iPtr;
iPtr->result = iPtr->resultSpace;
iPtr->freeProc = NULL;
iPtr->errorLine = 0;
iPtr->objResultPtr = Tcl_NewObj();
Tcl_IncrRefCount(iPtr->objResultPtr);
iPtr->handle = TclHandleCreate(iPtr);
iPtr->globalNsPtr = NULL;
iPtr->hiddenCmdTablePtr = NULL;
iPtr->interpInfo = NULL;
iPtr->numLevels = 0;
iPtr->maxNestingDepth = MAX_NESTING_DEPTH;
iPtr->framePtr = NULL;
iPtr->varFramePtr = NULL;
iPtr->activeVarTracePtr = NULL;
iPtr->returnOpts = NULL;
iPtr->errorInfo = NULL;
iPtr->eiVar = Tcl_NewStringObj("errorInfo", -1);
Tcl_IncrRefCount(iPtr->eiVar);
iPtr->errorCode = NULL;
iPtr->ecVar = Tcl_NewStringObj("errorCode", -1);
Tcl_IncrRefCount(iPtr->ecVar);
iPtr->returnLevel = 1;
iPtr->returnCode = TCL_OK;
iPtr->appendResult = NULL;
iPtr->appendAvl = 0;
iPtr->appendUsed = 0;
Tcl_InitHashTable(&iPtr->packageTable, TCL_STRING_KEYS);
|
| ︙ | ︙ | |||
246 247 248 249 250 251 252 |
iPtr->scriptFile = NULL;
iPtr->flags = 0;
iPtr->tracePtr = NULL;
iPtr->tracesForbiddingInline = 0;
iPtr->activeCmdTracePtr = NULL;
iPtr->activeInterpTracePtr = NULL;
iPtr->assocData = (Tcl_HashTable *) NULL;
| | | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
iPtr->scriptFile = NULL;
iPtr->flags = 0;
iPtr->tracePtr = NULL;
iPtr->tracesForbiddingInline = 0;
iPtr->activeCmdTracePtr = NULL;
iPtr->activeInterpTracePtr = NULL;
iPtr->assocData = (Tcl_HashTable *) NULL;
iPtr->execEnvPtr = NULL; /* set after namespaces initialized */
iPtr->emptyObjPtr = Tcl_NewObj(); /* another empty object */
Tcl_IncrRefCount(iPtr->emptyObjPtr);
iPtr->resultSpace[0] = 0;
iPtr->globalNsPtr = NULL; /* force creation of global ns below */
iPtr->globalNsPtr = (Namespace *) Tcl_CreateNamespace(interp, "",
(ClientData) NULL, (Tcl_NamespaceDeleteProc *) NULL);
if (iPtr->globalNsPtr == NULL) {
Tcl_Panic("Tcl_CreateInterp: can't create global namespace");
}
/*
* Initialize support for code compilation and execution. We call
* TclCreateExecEnv after initializing namespaces since it tries to
* reference a Tcl variable (it links to the Tcl "tcl_traceExec"
* variable).
|
| ︙ | ︙ | |||
289 290 291 292 293 294 295 |
statsPtr->currentSrcBytes = 0.0;
statsPtr->currentByteCodeBytes = 0.0;
(VOID *) memset(statsPtr->srcCount, 0, sizeof(statsPtr->srcCount));
(VOID *) memset(statsPtr->byteCodeCount, 0,
sizeof(statsPtr->byteCodeCount));
(VOID *) memset(statsPtr->lifetimeCount, 0,
sizeof(statsPtr->lifetimeCount));
| | | | < | 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 |
statsPtr->currentSrcBytes = 0.0;
statsPtr->currentByteCodeBytes = 0.0;
(VOID *) memset(statsPtr->srcCount, 0, sizeof(statsPtr->srcCount));
(VOID *) memset(statsPtr->byteCodeCount, 0,
sizeof(statsPtr->byteCodeCount));
(VOID *) memset(statsPtr->lifetimeCount, 0,
sizeof(statsPtr->lifetimeCount));
statsPtr->currentInstBytes = 0.0;
statsPtr->currentLitBytes = 0.0;
statsPtr->currentExceptBytes = 0.0;
statsPtr->currentAuxBytes = 0.0;
statsPtr->currentCmdMapBytes = 0.0;
statsPtr->numLiteralsCreated = 0;
statsPtr->totalLitStringBytes = 0.0;
statsPtr->currentLitStringBytes = 0.0;
(VOID *) memset(statsPtr->literalCount, 0, sizeof(statsPtr->literalCount));
#endif /* TCL_COMPILE_STATS */
/*
* Initialise the stub table pointer.
*/
iPtr->stubTable = &tclStubs;
|
| ︙ | ︙ | |||
339 340 341 342 343 344 345 |
*/
for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) {
int new;
Tcl_HashEntry *hPtr;
if ((cmdInfoPtr->objProc == (Tcl_ObjCmdProc *) NULL)
| | | | | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
*/
for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) {
int new;
Tcl_HashEntry *hPtr;
if ((cmdInfoPtr->objProc == (Tcl_ObjCmdProc *) NULL)
&& (cmdInfoPtr->compileProc == (CompileProc *) NULL)) {
Tcl_Panic("Tcl_CreateInterp: builtin command with NULL object command proc and a NULL compile proc\n");
}
hPtr = Tcl_CreateHashEntry(&iPtr->globalNsPtr->cmdTable,
cmdInfoPtr->name, &new);
if (new) {
cmdPtr = (Command *) ckalloc(sizeof(Command));
cmdPtr->hPtr = hPtr;
cmdPtr->nsPtr = iPtr->globalNsPtr;
cmdPtr->refCount = 1;
cmdPtr->cmdEpoch = 0;
cmdPtr->compileProc = cmdInfoPtr->compileProc;
|
| ︙ | ︙ | |||
370 371 372 373 374 375 376 |
}
/*
* Register the clock commands. These *do* go through
* Tcl_CreateObjCommand, since they aren't in the global namespace.
*/
| | | | | | | | | | | | | | | | | | | | | > > > > > > > > | | > > > > > > > > > | > | < < < < | < < | | | < > > > | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
}
/*
* Register the clock commands. These *do* go through
* Tcl_CreateObjCommand, since they aren't in the global namespace.
*/
Tcl_CreateObjCommand(interp, "::tcl::clock::clicks",
TclClockClicksObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateObjCommand(interp, "::tcl::clock::getenv",
TclClockGetenvObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateObjCommand(interp, "::tcl::clock::microseconds",
TclClockMicrosecondsObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateObjCommand(interp, "::tcl::clock::milliseconds",
TclClockMillisecondsObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateObjCommand(interp, "::tcl::clock::seconds",
TclClockSecondsObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateObjCommand(interp, "::tcl::clock::Localtime",
TclClockLocaltimeObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateObjCommand(interp, "::tcl::clock::Mktime",
TclClockMktimeObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateObjCommand(interp, "::tcl::clock::Oldscan",
TclClockOldscanObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateObjCommand(interp, "::tcl::chan::Truncate",
TclChanTruncateObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
/*
* Register the built-in functions
*/
/* Register the default [interp bgerror] handler. */
Tcl_CreateObjCommand(interp, "::tcl::Bgerror",
TclDefaultBgErrorHandlerObjCmd, (ClientData) NULL,
(Tcl_CmdDeleteProc*) NULL);
/* Register the unsupported encoding search path command */
Tcl_CreateObjCommand(interp, "::tcl::unsupported::EncodingDirs",
TclEncodingDirsObjCmd, NULL, NULL);
/*
* Register the builtin math functions.
*/
mathfuncNSPtr = Tcl_CreateNamespace(interp, "::tcl::mathfunc",
(ClientData) NULL, (Tcl_NamespaceDeleteProc*) NULL);
if (mathfuncNSPtr == NULL) {
Tcl_Panic("Can't create math function namespace");
}
i = 0;
for (;;) {
CONST char* tail;
builtinFuncPtr = &(BuiltinFuncTable[i++]);
if (builtinFuncPtr->name == NULL) {
break;
}
Tcl_CreateObjCommand(interp, builtinFuncPtr->name,
builtinFuncPtr->objCmdProc, builtinFuncPtr->clientData,
(Tcl_CmdDeleteProc*) NULL);
tail = builtinFuncPtr->name + strlen("::tcl::mathfunc::");
Tcl_Export(interp, mathfuncNSPtr, tail, 0);
}
/*
* Do Multiple/Safe Interps Tcl init stuff
*/
TclInterpInit(interp);
#ifndef TCL_GENERIC_ONLY
TclSetupEnv(interp);
#endif
/*
* TIP #59: Make embedded configuration information
* available.
*/
TclInitEmbeddedConfigurationInformation(interp);
/*
* Compute the byte order of this machine.
*/
order.s = 1;
Tcl_SetVar2(interp, "tcl_platform", "byteOrder",
|
| ︙ | ︙ | |||
480 481 482 483 484 485 486 |
#endif
/*
* Register Tcl's version number.
*/
Tcl_PkgProvideEx(interp, "Tcl", TCL_VERSION, (ClientData) &tclStubs);
| | | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
#endif
/*
* Register Tcl's version number.
*/
Tcl_PkgProvideEx(interp, "Tcl", TCL_VERSION, (ClientData) &tclStubs);
#ifdef Tcl_InitStubs
#undef Tcl_InitStubs
#endif
Tcl_InitStubs(interp, TCL_VERSION, 1);
return interp;
}
|
| ︙ | ︙ | |||
513 514 515 516 517 518 519 |
int
TclHideUnsafeCommands(interp)
Tcl_Interp *interp; /* Hide commands in this interpreter. */
{
register const CmdInfo *cmdInfoPtr;
if (interp == (Tcl_Interp *) NULL) {
| | | | | | 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 |
int
TclHideUnsafeCommands(interp)
Tcl_Interp *interp; /* Hide commands in this interpreter. */
{
register const CmdInfo *cmdInfoPtr;
if (interp == (Tcl_Interp *) NULL) {
return TCL_ERROR;
}
for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) {
if (!cmdInfoPtr->isSafe) {
Tcl_HideCommand(interp, cmdInfoPtr->name, cmdInfoPtr->name);
}
}
return TCL_OK;
}
/*
*--------------------------------------------------------------
*
|
| ︙ | ︙ | |||
569 570 571 572 573 574 575 |
Tcl_MutexLock(&assocMutex);
sprintf(buffer, "Assoc Data Key #%d", assocDataCounter);
assocDataCounter++;
Tcl_MutexUnlock(&assocMutex);
if (iPtr->assocData == (Tcl_HashTable *) NULL) {
| | | | 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 |
Tcl_MutexLock(&assocMutex);
sprintf(buffer, "Assoc Data Key #%d", assocDataCounter);
assocDataCounter++;
Tcl_MutexUnlock(&assocMutex);
if (iPtr->assocData == (Tcl_HashTable *) NULL) {
iPtr->assocData = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(iPtr->assocData, TCL_STRING_KEYS);
}
hPtr = Tcl_CreateHashEntry(iPtr->assocData, buffer, &new);
dPtr->proc = proc;
dPtr->clientData = clientData;
Tcl_SetHashValue(hPtr, dPtr);
}
|
| ︙ | ︙ | |||
613 614 615 616 617 618 619 |
Tcl_HashTable *hTablePtr;
Tcl_HashSearch hSearch;
Tcl_HashEntry *hPtr;
AssocData *dPtr;
hTablePtr = iPtr->assocData;
if (hTablePtr == (Tcl_HashTable *) NULL) {
| | | | | | | | | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 |
Tcl_HashTable *hTablePtr;
Tcl_HashSearch hSearch;
Tcl_HashEntry *hPtr;
AssocData *dPtr;
hTablePtr = iPtr->assocData;
if (hTablePtr == (Tcl_HashTable *) NULL) {
return;
}
for (hPtr = Tcl_FirstHashEntry(hTablePtr, &hSearch); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
dPtr = (AssocData *) Tcl_GetHashValue(hPtr);
if ((dPtr->proc == proc) && (dPtr->clientData == clientData)) {
ckfree((char *) dPtr);
Tcl_DeleteHashEntry(hPtr);
return;
}
}
}
/*
*----------------------------------------------------------------------
*
* Tcl_SetAssocData --
|
| ︙ | ︙ | |||
650 651 652 653 654 655 656 |
*/
void
Tcl_SetAssocData(interp, name, proc, clientData)
Tcl_Interp *interp; /* Interpreter to associate with. */
CONST char *name; /* Name for association. */
Tcl_InterpDeleteProc *proc; /* Proc to call when interpreter is
| | | | | | | 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 |
*/
void
Tcl_SetAssocData(interp, name, proc, clientData)
Tcl_Interp *interp; /* Interpreter to associate with. */
CONST char *name; /* Name for association. */
Tcl_InterpDeleteProc *proc; /* Proc to call when interpreter is
* about to be deleted. */
ClientData clientData; /* One-word value to pass to proc. */
{
Interp *iPtr = (Interp *) interp;
AssocData *dPtr;
Tcl_HashEntry *hPtr;
int new;
if (iPtr->assocData == (Tcl_HashTable *) NULL) {
iPtr->assocData = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(iPtr->assocData, TCL_STRING_KEYS);
}
hPtr = Tcl_CreateHashEntry(iPtr->assocData, name, &new);
if (new == 0) {
dPtr = (AssocData *) Tcl_GetHashValue(hPtr);
} else {
dPtr = (AssocData *) ckalloc(sizeof(AssocData));
}
dPtr->proc = proc;
dPtr->clientData = clientData;
Tcl_SetHashValue(hPtr, dPtr);
}
|
| ︙ | ︙ | |||
701 702 703 704 705 706 707 |
CONST char *name; /* Name of association. */
{
Interp *iPtr = (Interp *) interp;
AssocData *dPtr;
Tcl_HashEntry *hPtr;
if (iPtr->assocData == (Tcl_HashTable *) NULL) {
| | | | | 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 |
CONST char *name; /* Name of association. */
{
Interp *iPtr = (Interp *) interp;
AssocData *dPtr;
Tcl_HashEntry *hPtr;
if (iPtr->assocData == (Tcl_HashTable *) NULL) {
return;
}
hPtr = Tcl_FindHashEntry(iPtr->assocData, name);
if (hPtr == (Tcl_HashEntry *) NULL) {
return;
}
dPtr = (AssocData *) Tcl_GetHashValue(hPtr);
if (dPtr->proc != NULL) {
(dPtr->proc) (dPtr->clientData, interp);
}
ckfree((char *) dPtr);
Tcl_DeleteHashEntry(hPtr);
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
745 746 747 748 749 750 751 |
* of current deletion callback. */
{
Interp *iPtr = (Interp *) interp;
AssocData *dPtr;
Tcl_HashEntry *hPtr;
if (iPtr->assocData == (Tcl_HashTable *) NULL) {
| | | | | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 |
* of current deletion callback. */
{
Interp *iPtr = (Interp *) interp;
AssocData *dPtr;
Tcl_HashEntry *hPtr;
if (iPtr->assocData == (Tcl_HashTable *) NULL) {
return (ClientData) NULL;
}
hPtr = Tcl_FindHashEntry(iPtr->assocData, name);
if (hPtr == (Tcl_HashEntry *) NULL) {
return (ClientData) NULL;
}
dPtr = (AssocData *) Tcl_GetHashValue(hPtr);
if (procPtr != (Tcl_InterpDeleteProc **) NULL) {
*procPtr = dPtr->proc;
}
return dPtr->clientData;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
817 818 819 820 821 822 823 |
Interp *iPtr = (Interp *) interp;
/*
* If the interpreter has already been marked deleted, just punt.
*/
if (iPtr->flags & DELETED) {
| | | < | < | 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 |
Interp *iPtr = (Interp *) interp;
/*
* If the interpreter has already been marked deleted, just punt.
*/
if (iPtr->flags & DELETED) {
return;
}
/*
* Mark the interpreter as deleted. No further evals will be allowed.
* Increase the compileEpoch as a signal to compiled bytecodes.
*/
iPtr->flags |= DELETED;
iPtr->compileEpoch++;
/*
* Ensure that the interpreter is eventually deleted.
*/
Tcl_EventuallyFree((ClientData) interp, (Tcl_FreeProc *) DeleteInterpProc);
}
/*
*----------------------------------------------------------------------
*
* DeleteInterpProc --
*
|
| ︙ | ︙ | |||
871 872 873 874 875 876 877 |
Tcl_HashSearch search;
Tcl_HashTable *hTablePtr;
ResolverScheme *resPtr, *nextResPtr;
/*
* Punt if there is an error in the Tcl_Release/Tcl_Preserve matchup.
*/
| | | | | | | | < < < < < < < < < < | | | | | | | | | | | | | | | | | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 |
Tcl_HashSearch search;
Tcl_HashTable *hTablePtr;
ResolverScheme *resPtr, *nextResPtr;
/*
* Punt if there is an error in the Tcl_Release/Tcl_Preserve matchup.
*/
if (iPtr->numLevels > 0) {
Tcl_Panic("DeleteInterpProc called with active evals");
}
/*
* The interpreter should already be marked deleted; otherwise how
* did we get here?
*/
if (!(iPtr->flags & DELETED)) {
Tcl_Panic("DeleteInterpProc called on interpreter not marked deleted");
}
/*
* Shut down all limit handler callback scripts that call back
* into this interpreter. Then eliminate all limit handlers for
* this interpreter.
*/
TclRemoveScriptLimitCallbacks(interp);
TclLimitRemoveAllHandlers(interp);
/*
* Dismantle the namespace here, before we clear the assocData. If any
* background errors occur here, they will be deleted below.
*
* Dismantle the namespace after freeing the iPtr->handle so that each
* bytecode releases its literals without caring to update the literal
* table, as it will be freed later in this function without further use.
*/
TclCleanupLiteralTable(interp, &(iPtr->literalTable));
TclHandleFree(iPtr->handle);
TclTeardownNamespace(iPtr->globalNsPtr);
/*
* Delete all the hidden commands.
*/
hTablePtr = iPtr->hiddenCmdTablePtr;
if (hTablePtr != NULL) {
/*
* Non-pernicious deletion. The deletion callbacks will not be
* allowed to create any new hidden or non-hidden commands.
* Tcl_DeleteCommandFromToken() will remove the entry from the
* hiddenCmdTablePtr.
*/
hPtr = Tcl_FirstHashEntry(hTablePtr, &search);
for (; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_DeleteCommandFromToken(interp,
(Tcl_Command) Tcl_GetHashValue(hPtr));
}
Tcl_DeleteHashTable(hTablePtr);
ckfree((char *) hTablePtr);
}
/*
* Invoke deletion callbacks; note that a callback can create new
* callbacks, so we iterate.
*/
while (iPtr->assocData != (Tcl_HashTable *) NULL) {
AssocData *dPtr;
hTablePtr = iPtr->assocData;
iPtr->assocData = (Tcl_HashTable *) NULL;
for (hPtr = Tcl_FirstHashEntry(hTablePtr, &search);
hPtr != NULL;
hPtr = Tcl_FirstHashEntry(hTablePtr, &search)) {
dPtr = (AssocData *) Tcl_GetHashValue(hPtr);
Tcl_DeleteHashEntry(hPtr);
if (dPtr->proc != NULL) {
(*dPtr->proc)(dPtr->clientData, interp);
}
ckfree((char *) dPtr);
}
Tcl_DeleteHashTable(hTablePtr);
ckfree((char *) hTablePtr);
}
/*
* Finish deleting the global namespace.
*/
Tcl_DeleteNamespace((Tcl_Namespace *) iPtr->globalNsPtr);
/*
* Free up the result *after* deleting variables, since variable
* deletion could have transferred ownership of the result string
* to Tcl.
*/
|
| ︙ | ︙ | |||
994 995 996 997 998 999 1000 |
iPtr->errorInfo = NULL;
}
if (iPtr->returnOpts) {
Tcl_DecrRefCount(iPtr->returnOpts);
}
if (iPtr->appendResult != NULL) {
ckfree(iPtr->appendResult);
| | | | | 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 |
iPtr->errorInfo = NULL;
}
if (iPtr->returnOpts) {
Tcl_DecrRefCount(iPtr->returnOpts);
}
if (iPtr->appendResult != NULL) {
ckfree(iPtr->appendResult);
iPtr->appendResult = NULL;
}
TclFreePackageInfo(iPtr);
while (iPtr->tracePtr != NULL) {
Tcl_DeleteTrace((Tcl_Interp*) iPtr, (Tcl_Trace) iPtr->tracePtr);
}
if (iPtr->execEnvPtr != NULL) {
TclDeleteExecEnv(iPtr->execEnvPtr);
}
Tcl_DecrRefCount(iPtr->emptyObjPtr);
iPtr->emptyObjPtr = NULL;
resPtr = iPtr->resolverPtr;
while (resPtr) {
nextResPtr = resPtr->nextPtr;
ckfree(resPtr->name);
ckfree((char *) resPtr);
resPtr = nextResPtr;
}
/*
* Free up literal objects created for scripts compiled by the
* interpreter.
*/
TclDeleteLiteralTable(interp, &(iPtr->literalTable));
ckfree((char *) iPtr);
|
| ︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 | * * Results: * A standard Tcl result; also leaves a message in the interp's result * if an error occurs. * * Side effects: * Removes a command from the command table and create an entry | | | | | | | | | 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 1202 1203 1204 1205 1206 1207 |
*
* Results:
* A standard Tcl result; also leaves a message in the interp's result
* if an error occurs.
*
* Side effects:
* Removes a command from the command table and create an entry
* into the hidden command table under the specified token name.
*
*---------------------------------------------------------------------------
*/
int
Tcl_HideCommand(interp, cmdName, hiddenCmdToken)
Tcl_Interp *interp; /* Interpreter in which to hide command. */
CONST char *cmdName; /* Name of command to hide. */
CONST char *hiddenCmdToken; /* Token name of the to-be-hidden command. */
{
Interp *iPtr = (Interp *) interp;
Tcl_Command cmd;
Command *cmdPtr;
Tcl_HashTable *hiddenCmdTablePtr;
Tcl_HashEntry *hPtr;
int new;
if (iPtr->flags & DELETED) {
/*
* The interpreter is being deleted. Do not create any new
* structures, because it is not safe to modify the interpreter.
*/
return TCL_ERROR;
}
/*
* Disallow hiding of commands that are currently in a namespace or
* renaming (as part of hiding) into a namespace.
*
* (because the current implementation with a single global table
|
| ︙ | ︙ | |||
1088 1089 1090 1091 1092 1093 1094 |
*
* But as we currently limit ourselves to the global namespace only
* for the source, in order to avoid potential confusion,
* lets prevent "::" in the token too. --dl
*/
if (strstr(hiddenCmdToken, "::") != NULL) {
| | | | | | | | | | | | | | | | | | 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 |
*
* But as we currently limit ourselves to the global namespace only
* for the source, in order to avoid potential confusion,
* lets prevent "::" in the token too. --dl
*/
if (strstr(hiddenCmdToken, "::") != NULL) {
Tcl_AppendResult(interp,
"cannot use namespace qualifiers in hidden command",
" token (rename)", (char *) NULL);
return TCL_ERROR;
}
/*
* Find the command to hide. An error is returned if cmdName can't
* be found. Look up the command only from the global namespace.
* Full path of the command must be given if using namespaces.
*/
cmd = Tcl_FindCommand(interp, cmdName, (Tcl_Namespace *) NULL,
/*flags*/ TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
if (cmd == (Tcl_Command) NULL) {
return TCL_ERROR;
}
cmdPtr = (Command *) cmd;
/*
* Check that the command is really in global namespace
*/
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
Tcl_AppendResult(interp, "can only hide global namespace commands",
" (use rename then hide)", (char *) NULL);
return TCL_ERROR;
}
/*
* Initialize the hidden command table if necessary.
*/
hiddenCmdTablePtr = iPtr->hiddenCmdTablePtr;
if (hiddenCmdTablePtr == NULL) {
hiddenCmdTablePtr = (Tcl_HashTable *)
ckalloc((unsigned) sizeof(Tcl_HashTable));
Tcl_InitHashTable(hiddenCmdTablePtr, TCL_STRING_KEYS);
iPtr->hiddenCmdTablePtr = hiddenCmdTablePtr;
}
/*
* It is an error to move an exposed command to a hidden command with
* hiddenCmdToken if a hidden command with the name hiddenCmdToken already
* exists.
*/
hPtr = Tcl_CreateHashEntry(hiddenCmdTablePtr, hiddenCmdToken, &new);
if (!new) {
Tcl_AppendResult(interp, "hidden command named \"", hiddenCmdToken,
"\" already exists", (char *) NULL);
return TCL_ERROR;
}
/*
* Nb : This code is currently 'like' a rename to a specialy set apart
* name table. Changes here and in TclRenameCommand must
* be kept in synch untill the common parts are actually
* factorized out.
*/
/*
* Remove the hash entry for the command from the interpreter command
* table. This is like deleting the command, so bump its command epoch;
* this invalidates any cached references that point to the command.
*/
if (cmdPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(cmdPtr->hPtr);
cmdPtr->hPtr = (Tcl_HashEntry *) NULL;
cmdPtr->cmdEpoch++;
}
/*
* The list of command exported from the namespace might have
* changed. However, we do not need to recompute this just yet;
* next time we need the info will be soon enough.
*/
TclInvalidateNsCmdLookup(cmdPtr->nsPtr);
/*
* Now link the hash table entry with the command structure.
* We ensured above that the nsPtr was right.
*/
cmdPtr->hPtr = hPtr;
Tcl_SetHashValue(hPtr, (ClientData) cmdPtr);
/*
* If the command being hidden has a compile procedure, increment the
* interpreter's compileEpoch to invalidate its compiled code. This
* makes sure that we don't later try to execute old code compiled with
|
| ︙ | ︙ | |||
1213 1214 1215 1216 1217 1218 1219 |
*
*----------------------------------------------------------------------
*/
int
Tcl_ExposeCommand(interp, hiddenCmdToken, cmdName)
Tcl_Interp *interp; /* Interpreter in which to make command
| | | | | | | | | | | | | < | | | | | | | | | | | < | 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 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 |
*
*----------------------------------------------------------------------
*/
int
Tcl_ExposeCommand(interp, hiddenCmdToken, cmdName)
Tcl_Interp *interp; /* Interpreter in which to make command
* callable. */
CONST char *hiddenCmdToken; /* Name of hidden command. */
CONST char *cmdName; /* Name of to-be-exposed command. */
{
Interp *iPtr = (Interp *) interp;
Command *cmdPtr;
Namespace *nsPtr;
Tcl_HashEntry *hPtr;
Tcl_HashTable *hiddenCmdTablePtr;
int new;
if (iPtr->flags & DELETED) {
/*
* The interpreter is being deleted. Do not create any new
* structures, because it is not safe to modify the interpreter.
*/
return TCL_ERROR;
}
/*
* 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_AppendResult(interp, "can not expose to a namespace ",
"(use expose to toplevel, then rename)", (char *) NULL);
return TCL_ERROR;
}
/*
* Get the command from the hidden command table:
*/
hPtr = NULL;
hiddenCmdTablePtr = iPtr->hiddenCmdTablePtr;
if (hiddenCmdTablePtr != NULL) {
hPtr = Tcl_FindHashEntry(hiddenCmdTablePtr, hiddenCmdToken);
}
if (hPtr == (Tcl_HashEntry *) NULL) {
Tcl_AppendResult(interp, "unknown hidden command \"", hiddenCmdToken,
"\"", (char *) NULL);
return TCL_ERROR;
}
cmdPtr = (Command *) Tcl_GetHashValue(hPtr);
/*
* Check that we have a true global namespace
* command (enforced by Tcl_HideCommand() but let's double
* check. (If it was not, we would not really know how to
* handle it).
*/
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
/*
* This case is theoritically impossible,
* we might rather Tcl_Panic() than 'nicely' erroring out ?
*/
Tcl_AppendResult(interp,
"trying to expose a non global command name space command",
(char *) NULL);
return TCL_ERROR;
}
/* This is the global table */
nsPtr = cmdPtr->nsPtr;
/*
* It is an error to overwrite an existing exposed command as a result
* of exposing a previously hidden command.
*/
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, cmdName, &new);
if (!new) {
Tcl_AppendResult(interp, "exposed command \"", cmdName,
"\" already exists", (char *) NULL);
return TCL_ERROR;
}
/*
* The list of command exported from the namespace might have
* changed. However, we do not need to recompute this just yet;
* next time we need the info will be soon enough.
*/
TclInvalidateNsCmdLookup(nsPtr);
/*
* Remove the hash entry for the command from the interpreter hidden
* command table.
*/
if (cmdPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(cmdPtr->hPtr);
cmdPtr->hPtr = NULL;
}
/*
* Now link the hash table entry with the command structure.
* This is like creating a new command, so deal with any shadowing
* of commands in the global namespace.
*/
cmdPtr->hPtr = hPtr;
Tcl_SetHashValue(hPtr, (ClientData) cmdPtr);
/*
* Not needed as we are only in the global namespace
* (but would be needed again if we supported namespace command hiding)
*
* TclResetShadowedCmdRefs(interp, cmdPtr);
*/
/*
* If the command being exposed has a compile procedure, increment
* interpreter's compileEpoch to invalidate its compiled code. This
* makes sure that we don't later try to execute old code compiled
* assuming the command is hidden. This field is checked in Tcl_EvalObj
* and ObjInterpProc, and code whose compilation epoch doesn't match is
|
| ︙ | ︙ | |||
1407 1408 1409 1410 1411 1412 1413 |
/*
* Determine where the command should reside. If its name contains
* namespace qualifiers, we put it in the specified namespace;
* otherwise, we always put it in the global namespace.
*/
if (strstr(cmdName, "::") != NULL) {
| | | | | | | > | 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 |
/*
* Determine where the command should reside. If its name contains
* namespace qualifiers, we put it in the specified namespace;
* otherwise, we always put it in the global namespace.
*/
if (strstr(cmdName, "::") != NULL) {
TclGetNamespaceForQualName(interp, cmdName, (Namespace *) NULL,
TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
if ((nsPtr == NULL) || (tail == NULL)) {
return (Tcl_Command) NULL;
}
} else {
nsPtr = iPtr->globalNsPtr;
tail = cmdName;
}
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &new);
if (!new) {
/*
* Command already exists. Delete the old one.
* Be careful to preserve any existing import links so we can
* restore them down below. That way, you can redefine a
* command and its import status will remain intact.
*/
cmdPtr = (Command *) Tcl_GetHashValue(hPtr);
oldRefPtr = cmdPtr->importRefPtr;
cmdPtr->importRefPtr = NULL;
Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr);
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &new);
if (!new) {
/*
* If the deletion callback recreated the command, just throw
* away the new command (if we try to delete it again, we
* could get stuck in an infinite loop).
*/
ckfree((char*) Tcl_GetHashValue(hPtr));
}
} else {
/*
* The list of command exported from the namespace might have
* changed. However, we do not need to recompute this just
* yet; next time we need the info will be soon enough.
*/
TclInvalidateNsCmdLookup(nsPtr);
TclInvalidateNsPath(nsPtr);
}
cmdPtr = (Command *) ckalloc(sizeof(Command));
Tcl_SetHashValue(hPtr, cmdPtr);
cmdPtr->hPtr = hPtr;
cmdPtr->nsPtr = nsPtr;
cmdPtr->refCount = 1;
cmdPtr->cmdEpoch = 0;
|
| ︙ | ︙ | |||
1488 1489 1490 1491 1492 1493 1494 |
/*
* We just created a command, so in its namespace and all of its parent
* namespaces, it may shadow global commands with the same name. If any
* shadowed commands are found, invalidate all cached command references
* in the affected namespaces.
*/
| | | 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 |
/*
* We just created a command, so in its namespace and all of its parent
* namespaces, it may shadow global commands with the same name. If any
* shadowed commands are found, invalidate all cached command references
* in the affected namespaces.
*/
TclResetShadowedCmdRefs(interp, cmdPtr);
return (Tcl_Command) cmdPtr;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1562 1563 1564 1565 1566 1567 1568 |
/*
* Determine where the command should reside. If its name contains
* namespace qualifiers, we put it in the specified namespace;
* otherwise, we always put it in the global namespace.
*/
if (strstr(cmdName, "::") != NULL) {
| | | | > | | | 1692 1693 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 1726 1727 1728 1729 1730 1731 |
/*
* Determine where the command should reside. If its name contains
* namespace qualifiers, we put it in the specified namespace;
* otherwise, we always put it in the global namespace.
*/
if (strstr(cmdName, "::") != NULL) {
TclGetNamespaceForQualName(interp, cmdName, (Namespace *) NULL,
TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
if ((nsPtr == NULL) || (tail == NULL)) {
return (Tcl_Command) NULL;
}
} else {
nsPtr = iPtr->globalNsPtr;
tail = cmdName;
}
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &new);
TclInvalidateNsPath(nsPtr);
if (!new) {
cmdPtr = (Command *) Tcl_GetHashValue(hPtr);
/*
* Command already exists. If its object-based Tcl_ObjCmdProc is
* TclInvokeStringCommand, we just set its Tcl_ObjCmdProc to the
* argument "proc". Otherwise, we delete the old command.
*/
if (cmdPtr->objProc == TclInvokeStringCommand) {
cmdPtr->objProc = proc;
cmdPtr->objClientData = clientData;
cmdPtr->deleteProc = deleteProc;
cmdPtr->deleteData = clientData;
return (Tcl_Command) cmdPtr;
}
/*
* Otherwise, we delete the old command. Be careful to preserve
* any existing import links so we can restore them down below.
* That way, you can redefine a command and its import status
|
| ︙ | ︙ | |||
1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 |
/*
* The list of command exported from the namespace might have
* changed. However, we do not need to recompute this just
* yet; next time we need the info will be soon enough.
*/
TclInvalidateNsCmdLookup(nsPtr);
}
cmdPtr = (Command *) ckalloc(sizeof(Command));
Tcl_SetHashValue(hPtr, cmdPtr);
cmdPtr->hPtr = hPtr;
cmdPtr->nsPtr = nsPtr;
cmdPtr->refCount = 1;
cmdPtr->cmdEpoch = 0;
| > | 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 |
/*
* The list of command exported from the namespace might have
* changed. However, we do not need to recompute this just
* yet; next time we need the info will be soon enough.
*/
TclInvalidateNsCmdLookup(nsPtr);
TclInvalidateNsPath(nsPtr);
}
cmdPtr = (Command *) ckalloc(sizeof(Command));
Tcl_SetHashValue(hPtr, cmdPtr);
cmdPtr->hPtr = hPtr;
cmdPtr->nsPtr = nsPtr;
cmdPtr->refCount = 1;
cmdPtr->cmdEpoch = 0;
|
| ︙ | ︙ | |||
1651 1652 1653 1654 1655 1656 1657 |
while (oldRefPtr != NULL) {
refCmdPtr = oldRefPtr->importedCmdPtr;
dataPtr = (ImportedCmdData*)refCmdPtr->objClientData;
dataPtr->realCmdPtr = cmdPtr;
oldRefPtr = oldRefPtr->nextPtr;
}
}
| | | | 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 |
while (oldRefPtr != NULL) {
refCmdPtr = oldRefPtr->importedCmdPtr;
dataPtr = (ImportedCmdData*)refCmdPtr->objClientData;
dataPtr->realCmdPtr = cmdPtr;
oldRefPtr = oldRefPtr->nextPtr;
}
}
/*
* We just created a command, so in its namespace and all of its parent
* namespaces, it may shadow global commands with the same name. If any
* shadowed commands are found, invalidate all cached command references
* in the affected namespaces.
*/
TclResetShadowedCmdRefs(interp, cmdPtr);
return (Tcl_Command) cmdPtr;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1787 1788 1789 1790 1791 1792 1793 |
/*
* Create the object argument array "objv". Make sure objv is large
* enough to hold the objc arguments plus 1 extra for the zero
* end-of-objv word.
*/
if (argc > NUM_ARGS) {
| < | < | | | 1919 1920 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 |
/*
* Create the object argument array "objv". Make sure objv is large
* enough to hold the objc arguments plus 1 extra for the zero
* end-of-objv word.
*/
if (argc > NUM_ARGS) {
objv = (Tcl_Obj **) ckalloc((unsigned)(argc * sizeof(Tcl_Obj *)));
}
for (i = 0; i < argc; i++) {
length = strlen(argv[i]);
TclNewStringObj(objPtr, argv[i], length);
Tcl_IncrRefCount(objPtr);
objv[i] = objPtr;
}
/*
* Invoke the command's object-based Tcl_ObjCmdProc.
*/
result = (*cmdPtr->objProc)(cmdPtr->objClientData, interp, argc, objv);
/*
* Move the interpreter's object result to the string result,
* then reset the object result.
*/
(void) Tcl_GetStringResult(interp);
/*
* Decrement the ref counts for the argument objects created above,
* then free the objv array if malloc'ed storage was used.
*/
for (i = 0; i < argc; i++) {
objPtr = objv[i];
|
| ︙ | ︙ | |||
1833 1834 1835 1836 1837 1838 1839 | } /* *---------------------------------------------------------------------- * * TclRenameCommand -- * | | | | | | | | | | | | | | | | | | | | | 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 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 |
}
/*
*----------------------------------------------------------------------
*
* TclRenameCommand --
*
* Called to give an existing Tcl command a different name. Both the
* old command name and the new command name can have "::" namespace
* qualifiers. If the new command has a different namespace context,
* the command will be moved to that namespace and will execute in
* the context of that new namespace.
*
* If the new command name is NULL or the null string, the command is
* deleted.
*
* Results:
* Returns TCL_OK if successful, and TCL_ERROR if anything goes wrong.
*
* Side effects:
* If anything goes wrong, an error message is returned in the
* interpreter's result object.
*
*----------------------------------------------------------------------
*/
int
TclRenameCommand(interp, oldName, newName)
Tcl_Interp *interp; /* Current interpreter. */
char *oldName; /* Existing command name. */
char *newName; /* New command name. */
{
Interp *iPtr = (Interp *) interp;
CONST char *newTail;
Namespace *cmdNsPtr, *newNsPtr, *dummy1, *dummy2;
Tcl_Command cmd;
Command *cmdPtr;
Tcl_HashEntry *hPtr, *oldHPtr;
int new, result;
Tcl_Obj* oldFullName;
Tcl_DString newFullName;
/*
* Find the existing command. An error is returned if cmdName can't
* be found.
*/
cmd = Tcl_FindCommand(interp, oldName, (Tcl_Namespace *) NULL,
/*flags*/ 0);
cmdPtr = (Command *) cmd;
if (cmdPtr == NULL) {
Tcl_AppendResult(interp, "can't ",
((newName == NULL)||(*newName == '\0'))? "delete":"rename",
" \"", oldName, "\": command doesn't exist", (char *) NULL);
return TCL_ERROR;
}
cmdNsPtr = cmdPtr->nsPtr;
oldFullName = Tcl_NewObj();
Tcl_IncrRefCount(oldFullName);
Tcl_GetCommandFullName(interp, cmd, oldFullName);
/*
* If the new command name is NULL or empty, delete the command. Do this
* with Tcl_DeleteCommandFromToken, since we already have the command.
*/
if ((newName == NULL) || (*newName == '\0')) {
Tcl_DeleteCommandFromToken(interp, cmd);
result = TCL_OK;
goto done;
}
/*
* Make sure that the destination command does not already exist.
* The rename operation is like creating a command, so we should
* automatically create the containing namespaces just like
* Tcl_CreateCommand would.
*/
TclGetNamespaceForQualName(interp, newName, (Namespace *) NULL,
TCL_CREATE_NS_IF_UNKNOWN, &newNsPtr, &dummy1, &dummy2, &newTail);
if ((newNsPtr == NULL) || (newTail == NULL)) {
Tcl_AppendResult(interp, "can't rename to \"", newName,
"\": bad command name", (char *) NULL);
result = TCL_ERROR;
goto done;
}
|
| ︙ | ︙ | |||
1932 1933 1934 1935 1936 1937 1938 |
*/
/*
* Put the command in the new namespace so we can check for an alias
* loop. Since we are adding a new command to a namespace, we must
* handle any shadowing of the global commands that this might create.
*/
| | | | | | 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 |
*/
/*
* Put the command in the new namespace so we can check for an alias
* loop. Since we are adding a new command to a namespace, we must
* handle any shadowing of the global commands that this might create.
*/
oldHPtr = cmdPtr->hPtr;
hPtr = Tcl_CreateHashEntry(&newNsPtr->cmdTable, newTail, &new);
Tcl_SetHashValue(hPtr, (ClientData) cmdPtr);
cmdPtr->hPtr = hPtr;
cmdPtr->nsPtr = newNsPtr;
TclResetShadowedCmdRefs(interp, cmdPtr);
/*
* Now check for an alias loop. If we detect one, put everything back
* the way it was and report the error.
*/
result = TclPreventAliasLoop(interp, interp, (Tcl_Command) cmdPtr);
if (result != TCL_OK) {
Tcl_DeleteHashEntry(cmdPtr->hPtr);
cmdPtr->hPtr = oldHPtr;
cmdPtr->nsPtr = cmdNsPtr;
goto done;
}
/*
* The list of command exported from the namespace might have
* changed. However, we do not need to recompute this just yet;
* next time we need the info will be soon enough. These might
|
| ︙ | ︙ | |||
1975 1976 1977 1978 1979 1980 1981 |
*
* The trace procedure needs to get a fully qualified name for
* old and new commands [Tcl bug #651271], or else there's no way
* for the trace procedure to get the namespace from which the old
* command is being renamed!
*/
| | | | | | | < | < | | | 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 |
*
* The trace procedure needs to get a fully qualified name for
* old and new commands [Tcl bug #651271], or else there's no way
* for the trace procedure to get the namespace from which the old
* command is being renamed!
*/
Tcl_DStringInit(&newFullName);
Tcl_DStringAppend(&newFullName, newNsPtr->fullName, -1);
if (newNsPtr != iPtr->globalNsPtr) {
Tcl_DStringAppend(&newFullName, "::", 2);
}
Tcl_DStringAppend(&newFullName, newTail, -1);
cmdPtr->refCount++;
CallCommandTraces(iPtr, cmdPtr, Tcl_GetString(oldFullName),
Tcl_DStringValue(&newFullName), TCL_TRACE_RENAME);
Tcl_DStringFree(&newFullName);
/*
* The new command name is okay, so remove the command from its
* current namespace. This is like deleting the command, so bump
* the cmdEpoch to invalidate any cached references to the command.
*/
Tcl_DeleteHashEntry(oldHPtr);
cmdPtr->cmdEpoch++;
/*
* If the command being renamed has a compile procedure, increment the
* interpreter's compileEpoch to invalidate its compiled code. This
* makes sure that we don't later try to execute old code compiled for
|
| ︙ | ︙ | |||
2016 2017 2018 2019 2020 2021 2022 |
* Now free the Command structure, if the "oldName" command has
* been deleted by invocation of rename traces.
*/
TclCleanupCommand(cmdPtr);
result = TCL_OK;
done:
| | | 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 |
* Now free the Command structure, if the "oldName" command has
* been deleted by invocation of rename traces.
*/
TclCleanupCommand(cmdPtr);
result = TCL_OK;
done:
TclDecrRefCount(oldFullName);
return result;
}
/*
*----------------------------------------------------------------------
*
* Tcl_SetCommandInfo --
|
| ︙ | ︙ | |||
2053 2054 2055 2056 2057 2058 2059 |
CONST char *cmdName; /* Name of desired command. */
CONST Tcl_CmdInfo *infoPtr; /* Where to find information
* to store in the command. */
{
Tcl_Command cmd;
cmd = Tcl_FindCommand(interp, cmdName, (Tcl_Namespace *) NULL,
| | | | 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 |
CONST char *cmdName; /* Name of desired command. */
CONST Tcl_CmdInfo *infoPtr; /* Where to find information
* to store in the command. */
{
Tcl_Command cmd;
cmd = Tcl_FindCommand(interp, cmdName, (Tcl_Namespace *) NULL,
/*flags*/ 0);
return Tcl_SetCommandInfoFromToken(cmd, infoPtr);
}
/*
*----------------------------------------------------------------------
*
* Tcl_SetCommandInfoFromToken --
|
| ︙ | ︙ | |||
2082 2083 2084 2085 2086 2087 2088 | * Side effects: * None. * *---------------------------------------------------------------------- */ int | | | | 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_SetCommandInfoFromToken(cmd, infoPtr)
Tcl_Command cmd;
CONST Tcl_CmdInfo* infoPtr;
{
Command* cmdPtr; /* Internal representation of the command */
if (cmd == (Tcl_Command) NULL) {
return 0;
}
/*
* The isNativeObjectProc and nsPtr members of *infoPtr are ignored.
*/
cmdPtr = (Command *) cmd;
cmdPtr->proc = infoPtr->proc;
cmdPtr->clientData = infoPtr->clientData;
if (infoPtr->objProc == (Tcl_ObjCmdProc *) NULL) {
cmdPtr->objProc = TclInvokeStringCommand;
cmdPtr->objClientData = (ClientData) cmdPtr;
} else {
|
| ︙ | ︙ | |||
2141 2142 2143 2144 2145 2146 2147 |
CONST char *cmdName; /* Name of desired command. */
Tcl_CmdInfo *infoPtr; /* Where to store information about
* command. */
{
Tcl_Command cmd;
cmd = Tcl_FindCommand(interp, cmdName, (Tcl_Namespace *) NULL,
| | | | 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 |
CONST char *cmdName; /* Name of desired command. */
Tcl_CmdInfo *infoPtr; /* Where to store information about
* command. */
{
Tcl_Command cmd;
cmd = Tcl_FindCommand(interp, cmdName, (Tcl_Namespace *) NULL,
/*flags*/ 0);
return Tcl_GetCommandInfoFromToken(cmd, infoPtr);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetCommandInfoFromToken --
|
| ︙ | ︙ | |||
2166 2167 2168 2169 2170 2171 2172 | * Side effects: * None. * *---------------------------------------------------------------------- */ int | | | | 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_GetCommandInfoFromToken(cmd, infoPtr)
Tcl_Command cmd;
Tcl_CmdInfo* infoPtr;
{
Command* cmdPtr; /* Internal representation of the command */
if (cmd == (Tcl_Command) NULL) {
return 0;
}
/*
* Set isNativeObjectProc 1 if objProc was registered by a call to
* Tcl_CreateObjCommand. Otherwise set it to 0.
*/
|
| ︙ | ︙ | |||
2321 2322 2323 2324 2325 2326 2327 |
Tcl_Command cmd;
/*
* Find the desired command and delete it.
*/
cmd = Tcl_FindCommand(interp, cmdName, (Tcl_Namespace *) NULL,
| | | 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 |
Tcl_Command cmd;
/*
* Find the desired command and delete it.
*/
cmd = Tcl_FindCommand(interp, cmdName, (Tcl_Namespace *) NULL,
/*flags*/ 0);
if (cmd == (Tcl_Command) NULL) {
return -1;
}
return Tcl_DeleteCommandFromToken(interp, cmd);
}
/*
|
| ︙ | ︙ | |||
2352 2353 2354 2355 2356 2357 2358 |
*----------------------------------------------------------------------
*/
int
Tcl_DeleteCommandFromToken(interp, cmd)
Tcl_Interp *interp; /* Token for command interpreter returned by
* a previous call to Tcl_CreateInterp. */
| | | 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 |
*----------------------------------------------------------------------
*/
int
Tcl_DeleteCommandFromToken(interp, cmd)
Tcl_Interp *interp; /* Token for command interpreter returned by
* a previous call to Tcl_CreateInterp. */
Tcl_Command cmd; /* Token for command to delete. */
{
Interp *iPtr = (Interp *) interp;
Command *cmdPtr = (Command *) cmd;
ImportRef *refPtr, *nextRefPtr;
Tcl_Command importCmd;
/*
|
| ︙ | ︙ | |||
2375 2376 2377 2378 2379 2380 2381 |
if (cmdPtr->flags & CMD_IS_DELETED) {
/*
* Another deletion is already in progress. Remove the hash
* table entry now, but don't invoke a callback or free the
* command structure.
*/
| | | 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 |
if (cmdPtr->flags & CMD_IS_DELETED) {
/*
* Another deletion is already in progress. Remove the hash
* table entry now, but don't invoke a callback or free the
* command structure.
*/
Tcl_DeleteHashEntry(cmdPtr->hPtr);
cmdPtr->hPtr = NULL;
return 0;
}
/*
* We must delete this command, even though both traces and
* delete procs may try to avoid this (renaming the command etc).
|
| ︙ | ︙ | |||
2427 2428 2429 2430 2431 2432 2433 |
* makes sure that we don't later try to execute old code compiled with
* command-specific (i.e., inline) bytecodes for the now-deleted
* command. This field is checked in Tcl_EvalObj and ObjInterpProc, and
* code whose compilation epoch doesn't match is recompiled.
*/
if (cmdPtr->compileProc != NULL) {
| | | | | | | 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 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 |
* makes sure that we don't later try to execute old code compiled with
* command-specific (i.e., inline) bytecodes for the now-deleted
* command. This field is checked in Tcl_EvalObj and ObjInterpProc, and
* code whose compilation epoch doesn't match is recompiled.
*/
if (cmdPtr->compileProc != NULL) {
iPtr->compileEpoch++;
}
if (cmdPtr->deleteProc != NULL) {
/*
* Delete the command's client data. If this was an imported command
* created when a command was imported into a namespace, this client
* data will be a pointer to a ImportedCmdData structure describing
* the "real" command that this imported command refers to.
*/
/*
* If you are getting a crash during the call to deleteProc and
* cmdPtr->deleteProc is a pointer to the function free(), the
* most likely cause is that your extension allocated memory
* for the clientData argument to Tcl_CreateObjCommand() with
* the ckalloc() macro and you are now trying to deallocate
* this memory with free() instead of ckfree(). You should
* pass a pointer to your own method that calls ckfree().
*/
(*cmdPtr->deleteProc)(cmdPtr->deleteData);
}
/*
* Bump the command epoch counter. This will invalidate all cached
* references that point to this command.
*/
cmdPtr->cmdEpoch++;
/*
* If this command was imported into other namespaces, then imported
* commands were created that refer back to this command. Delete these
* imported commands now.
*/
for (refPtr = cmdPtr->importRefPtr; refPtr != NULL;
refPtr = nextRefPtr) {
nextRefPtr = refPtr->nextPtr;
importCmd = (Tcl_Command) refPtr->importedCmdPtr;
Tcl_DeleteCommandFromToken(interp, importCmd);
}
/*
* Don't use hPtr to delete the hash entry here, because it's
* possible that the deletion callback renamed the command.
* Instead, use cmdPtr->hptr, and make sure that no-one else
* has already deleted the hash entry.
|
| ︙ | ︙ | |||
2500 2501 2502 2503 2504 2505 2506 |
* Now free the Command structure, unless there is another reference to
* it from a CmdName Tcl object in some ByteCode code sequence. In that
* case, delay the cleanup until all references are either discarded
* (when a ByteCode is freed) or replaced by a new reference (when a
* cached CmdName Command reference is found to be invalid and
* TclExecuteByteCode looks up the command in the command hashtable).
*/
| | | | | | | 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 |
* Now free the Command structure, unless there is another reference to
* it from a CmdName Tcl object in some ByteCode code sequence. In that
* case, delay the cleanup until all references are either discarded
* (when a ByteCode is freed) or replaced by a new reference (when a
* cached CmdName Command reference is found to be invalid and
* TclExecuteByteCode looks up the command in the command hashtable).
*/
TclCleanupCommand(cmdPtr);
return 0;
}
static char *
CallCommandTraces(iPtr, cmdPtr, oldName, newName, flags)
Interp *iPtr; /* Interpreter containing command. */
Command *cmdPtr; /* Command whose traces are to be
* invoked. */
CONST char *oldName; /* Command's old name, or NULL if we
* must get the name from cmdPtr */
CONST char *newName; /* Command's new name, or NULL if
* the command is not being renamed */
int flags; /* Flags indicating the type of traces
* to trigger, either TCL_TRACE_DELETE
* or TCL_TRACE_RENAME. */
{
register CommandTrace *tracePtr;
ActiveCommandTrace active;
char *result;
|
| ︙ | ︙ | |||
2543 2544 2545 2546 2547 2548 2549 |
}
if (flags == 0) {
return NULL;
}
}
cmdPtr->flags |= CMD_TRACE_ACTIVE;
cmdPtr->refCount++;
| | | | | | | 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 |
}
if (flags == 0) {
return NULL;
}
}
cmdPtr->flags |= CMD_TRACE_ACTIVE;
cmdPtr->refCount++;
result = NULL;
active.nextPtr = iPtr->activeCmdTracePtr;
iPtr->activeCmdTracePtr = &active;
if (flags & TCL_TRACE_DELETE) {
flags |= TCL_TRACE_DESTROYED;
}
active.cmdPtr = cmdPtr;
Tcl_Preserve((ClientData) iPtr);
for (tracePtr = cmdPtr->tracePtr; tracePtr != NULL;
tracePtr = active.nextTracePtr) {
active.nextTracePtr = tracePtr->nextPtr;
if (!(tracePtr->flags & flags)) {
continue;
}
cmdPtr->flags |= tracePtr->flags;
if (oldName == NULL) {
TclNewObj(oldNamePtr);
Tcl_IncrRefCount(oldNamePtr);
Tcl_GetCommandFullName((Tcl_Interp *) iPtr,
(Tcl_Command) cmdPtr, oldNamePtr);
oldName = TclGetString(oldNamePtr);
}
tracePtr->refCount++;
(*tracePtr->traceProc)(tracePtr->clientData,
(Tcl_Interp *) iPtr, oldName, newName, flags);
cmdPtr->flags &= ~tracePtr->flags;
if ((--tracePtr->refCount) <= 0) {
|
| ︙ | ︙ | |||
2668 2669 2670 2671 2672 2673 2674 |
Tcl_ValueType *argTypes; /* Array of types acceptable for
* each argument. */
Tcl_MathProc *proc; /* Procedure that implements the
* math function. */
ClientData clientData; /* Additional value to pass to the
* function. */
{
| < < < < < < < < < | < < < < < < < < < < < < < < < < < | | < | < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | > > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | 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 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 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 |
Tcl_ValueType *argTypes; /* Array of types acceptable for
* each argument. */
Tcl_MathProc *proc; /* Procedure that implements the
* math function. */
ClientData clientData; /* Additional value to pass to the
* function. */
{
Tcl_DString bigName;
OldMathFuncData* data = (OldMathFuncData*)
Tcl_Alloc(sizeof(OldMathFuncData));
if (numArgs > MAX_MATH_ARGS) {
Tcl_Panic("attempt to create a math function with too many args");
}
data->proc = proc;
data->numArgs = numArgs;
data->argTypes = (Tcl_ValueType*)
Tcl_Alloc(numArgs * sizeof(Tcl_ValueType));
memcpy(data->argTypes, argTypes, numArgs * sizeof(Tcl_ValueType));
data->clientData = clientData;
Tcl_DStringInit(&bigName);
Tcl_DStringAppend(&bigName, "::tcl::mathfunc::", -1);
Tcl_DStringAppend(&bigName, name, -1);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&bigName),
OldMathFuncProc, (ClientData) data, OldMathFuncDeleteProc);
Tcl_DStringFree(&bigName);
}
/*
*----------------------------------------------------------------------
*
* OldMathFuncProc --
*
* Dispatch to a math function created with Tcl_CreateMathFunc
*
* Results:
* Returns a standard Tcl result.
*
* Side effects:
* Whatever the math function does.
*
*----------------------------------------------------------------------
*/
static int
OldMathFuncProc(clientData, interp, objc, objv)
ClientData clientData; /* Ponter to OldMathFuncData describing
* the function being called */
Tcl_Interp* interp; /* Tcl interpreter */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Parameter vector */
{
Tcl_Obj* valuePtr;
OldMathFuncData* dataPtr = (OldMathFuncData*) clientData;
Tcl_Value args[MAX_MATH_ARGS];
Tcl_Value funcResult;
int result;
int i, j, k;
double d;
/* Check argument count */
if (objc != dataPtr->numArgs + 1) {
MathFuncWrongNumArgs(interp, dataPtr->numArgs+1, objc, objv);
return TCL_ERROR;
}
/* Convert arguments from Tcl_Obj's to Tcl_Value's */
for (j = 1, k = 0; j < objc; ++j, ++k) {
valuePtr = objv[j];
if (VerifyExprObjType(interp, valuePtr) != TCL_OK) {
return TCL_ERROR;
}
/*
* Copy the object's numeric value to the argument record,
* converting it if necessary.
*/
if (valuePtr->typePtr == &tclIntType) {
i = valuePtr->internalRep.longValue;
if (dataPtr->argTypes[k] == TCL_DOUBLE) {
args[k].type = TCL_DOUBLE;
args[k].doubleValue = i;
} else if (dataPtr->argTypes[k] == TCL_WIDE_INT) {
args[k].type = TCL_WIDE_INT;
args[k].wideValue = Tcl_LongAsWide(i);
} else {
args[k].type = TCL_INT;
args[k].intValue = i;
}
} else if (valuePtr->typePtr == &tclWideIntType) {
Tcl_WideInt w;
TclGetWide(w,valuePtr);
if (dataPtr->argTypes[k] == TCL_DOUBLE) {
args[k].type = TCL_DOUBLE;
args[k].doubleValue = Tcl_WideAsDouble(w);
} else if (dataPtr->argTypes[k] == TCL_INT) {
args[k].type = TCL_INT;
args[k].intValue = Tcl_WideAsLong(w);
} else {
args[k].type = TCL_WIDE_INT;
args[k].wideValue = w;
}
} else {
d = valuePtr->internalRep.doubleValue;
if (dataPtr->argTypes[k] == TCL_INT) {
args[k].type = TCL_INT;
args[k].intValue = (long) d;
} else if (dataPtr->argTypes[k] == TCL_WIDE_INT) {
args[k].type = TCL_WIDE_INT;
args[k].wideValue = Tcl_DoubleAsWide(d);
} else {
args[k].type = TCL_DOUBLE;
args[k].doubleValue = d;
}
}
}
/* Call the function */
result = (*dataPtr->proc)(dataPtr->clientData, interp, args,
&funcResult);
if (result != TCL_OK) {
return result;
}
/* Return the result of the call */
if (funcResult.type == TCL_INT) {
TclNewLongObj(valuePtr, funcResult.intValue);
} else if (funcResult.type == TCL_WIDE_INT) {
TclNewWideIntObj(valuePtr, funcResult.wideValue);
} else {
d = funcResult.doubleValue;
if (IS_NAN(d) || IS_INF(d)) {
TclExprFloatError(interp, d);
return TCL_ERROR;
}
TclNewDoubleObj(valuePtr, d);
}
Tcl_SetObjResult(interp, valuePtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* OldMathFuncDeleteProc --
*
* Cleans up after deleting a math function registered with
* Tcl_CreateMathFunc
*
* Results:
* None.
*
* Side effects:
* Frees allocated memory.
*
*----------------------------------------------------------------------
*/
static void
OldMathFuncDeleteProc(clientData)
ClientData clientData;
{
OldMathFuncData* dataPtr = (OldMathFuncData*) clientData;
Tcl_Free((VOID*) dataPtr->argTypes);
Tcl_Free((VOID*) dataPtr);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetMathFuncInfo --
*
|
| ︙ | ︙ | |||
2750 2751 2752 2753 2754 2755 2756 |
Tcl_Interp *interp;
CONST char *name;
int *numArgsPtr;
Tcl_ValueType **argTypesPtr;
Tcl_MathProc **procPtr;
ClientData *clientDataPtr;
{
| | | | | > | > > > > > > | | > | > > > | > < < < | < > > > | > > | < | | < | < < | > > > | < > | 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 |
Tcl_Interp *interp;
CONST char *name;
int *numArgsPtr;
Tcl_ValueType **argTypesPtr;
Tcl_MathProc **procPtr;
ClientData *clientDataPtr;
{
Tcl_Obj* cmdNameObj;
Command* cmdPtr;
/* Get the command that implements the math function */
cmdNameObj = Tcl_NewStringObj("tcl::mathfunc::", -1);
Tcl_AppendToObj(cmdNameObj, name, -1);
Tcl_IncrRefCount(cmdNameObj);
cmdPtr = (Command*) Tcl_GetCommandFromObj(interp, cmdNameObj);
Tcl_DecrRefCount(cmdNameObj);
/* Report unknown functions */
if (cmdPtr == NULL) {
Tcl_Obj* message;
message = Tcl_NewStringObj("unknown math function \"", -1);
Tcl_AppendToObj(message, name, -1);
Tcl_AppendToObj(message, "\"", 1);
*numArgsPtr = -1; *argTypesPtr = NULL;
*procPtr = NULL;
*clientDataPtr = NULL;
return TCL_ERROR;
}
/*
* Retrieve function info for user defined functions; return
* dummy information for builtins.
*/
if (cmdPtr->objProc == &OldMathFuncProc) {
OldMathFuncData* dataPtr = (OldMathFuncData*) cmdPtr->clientData;
*procPtr = dataPtr->proc;
*numArgsPtr = dataPtr->numArgs;
*argTypesPtr = dataPtr->argTypes;
*clientDataPtr = dataPtr->clientData;
} else {
*procPtr = NULL;
*numArgsPtr = -1;
*argTypesPtr = NULL;
*procPtr = NULL;
*clientDataPtr = NULL;
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_ListMathFuncs --
*
|
| ︙ | ︙ | |||
2809 2810 2811 2812 2813 2814 2815 |
*/
Tcl_Obj *
Tcl_ListMathFuncs(interp, pattern)
Tcl_Interp *interp;
CONST char *pattern;
{
| | > > > > | | | | > > > > > > > > > > > | > | | | < | | < < | | > > | | | | | 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 |
*/
Tcl_Obj *
Tcl_ListMathFuncs(interp, pattern)
Tcl_Interp *interp;
CONST char *pattern;
{
Namespace* globalNsPtr = (Namespace*) Tcl_GetGlobalNamespace(interp);
Namespace* nsPtr;
Namespace* dummy1NsPtr;
Namespace* dummy2NsPtr;
CONST char* dummyNamePtr;
Tcl_Obj* result = Tcl_NewObj();
Tcl_HashEntry* cmdHashEntry;
Tcl_HashSearch cmdHashSearch;
CONST char* cmdNamePtr;
TclGetNamespaceForQualName(interp, "::tcl::mathfunc",
globalNsPtr, TCL_FIND_ONLY_NS | TCL_GLOBAL_ONLY,
&nsPtr, &dummy1NsPtr, &dummy2NsPtr, &dummyNamePtr);
if (nsPtr != NULL) {
if ((pattern != NULL) && TclMatchIsTrivial(pattern)) {
if (Tcl_FindHashEntry(&nsPtr->cmdTable, pattern) != NULL) {
Tcl_ListObjAppendElement(NULL, result,
Tcl_NewStringObj(pattern, -1));
}
} else {
cmdHashEntry = Tcl_FirstHashEntry(&nsPtr->cmdTable,&cmdHashSearch);
for (; cmdHashEntry != NULL;
cmdHashEntry = Tcl_NextHashEntry(&cmdHashSearch)) {
cmdNamePtr = Tcl_GetHashKey(&nsPtr->cmdTable, cmdHashEntry);
if (pattern == NULL || Tcl_StringMatch(cmdNamePtr, pattern)) {
Tcl_ListObjAppendElement(NULL, result,
Tcl_NewStringObj(cmdNamePtr, -1));
}
}
}
}
return result;
}
/*
*----------------------------------------------------------------------
*
* TclInterpReady --
*
* Check if an interpreter is ready to eval commands or scripts,
* i.e., if it was not deleted and if the nesting level is not
* too high.
*
* Results:
* The return value is TCL_OK if it the interpreter is ready,
* TCL_ERROR otherwise.
*
* Side effects:
* The interpreters object and string results are cleared.
*
*----------------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
2864 2865 2866 2867 2868 2869 2870 |
*/
Tcl_ResetResult(interp);
/*
* If the interpreter has been deleted, return an error.
*/
| | | | < | 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 |
*/
Tcl_ResetResult(interp);
/*
* If the interpreter has been deleted, return an error.
*/
if (iPtr->flags & DELETED) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp,
"attempt to call eval in deleted interpreter", (char *) NULL);
Tcl_SetErrorCode(interp, "CORE", "IDELETE",
"attempt to call eval in deleted interpreter", (char *) NULL);
return TCL_ERROR;
}
/*
* Check depth of nested calls to Tcl_Eval: if this gets too large,
* it's probably because of an infinite loop somewhere.
*/
|
| ︙ | ︙ | |||
2897 2898 2899 2900 2901 2902 2903 | /* *---------------------------------------------------------------------- * * TclEvalObjvInternal -- * * This procedure evaluates a Tcl command that has already been * parsed into words, with one Tcl_Obj holding each word. The caller | | | 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 | /* *---------------------------------------------------------------------- * * TclEvalObjvInternal -- * * This procedure evaluates a Tcl command that has already been * parsed into words, with one Tcl_Obj holding each word. The caller * is responsible for managing the iPtr->numLevels. * * Results: * The return value is a standard Tcl completion code such as * TCL_OK or TCL_ERROR. A result or error message is left in * interp's result. If an error occurs, this procedure does * NOT add any information to the errorInfo variable. * |
| ︙ | ︙ | |||
2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 |
}
if (objc == 0) {
return TCL_OK;
}
/*
* If any execution traces rename or delete the current command,
* we may need (at most) two passes here.
*/
| > > > > > > > > > > < | < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | | < > | < < | 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 |
}
if (objc == 0) {
return TCL_OK;
}
/*
* Find the procedure to execute this command. If there isn't one,
* then see if there is a command "unknown". If so, create a new
* word array with "unknown" as the first word and the original
* command words as arguments. Then call ourselves recursively to
* execute it.
*
* If caller requests, or if we're resolving the target end of an
* interpeter alias (TCL_EVAL_INVOKE), be sure to do command name
* resolution in the global namespace.
*
* If any execution traces rename or delete the current command,
* we may need (at most) two passes here.
*/
reparseBecauseOfTraces:
savedVarFramePtr = iPtr->varFramePtr;
if (flags & (TCL_EVAL_INVOKE | TCL_EVAL_GLOBAL)) {
iPtr->varFramePtr = NULL;
}
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[0]);
iPtr->varFramePtr = savedVarFramePtr;
if (cmdPtr == NULL) {
newObjv = (Tcl_Obj **) ckalloc((unsigned)
((objc + 1) * sizeof(Tcl_Obj *)));
for (i = objc-1; i >= 0; i--) {
newObjv[i+1] = objv[i];
}
newObjv[0] = Tcl_NewStringObj("::unknown", -1);
Tcl_IncrRefCount(newObjv[0]);
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, newObjv[0]);
if (cmdPtr == NULL) {
Tcl_AppendResult(interp, "invalid command name \"",
TclGetString(objv[0]), "\"", (char *) NULL);
code = TCL_ERROR;
} else {
iPtr->numLevels++;
code = TclEvalObjvInternal(interp, objc+1, newObjv,
command, length, 0);
iPtr->numLevels--;
}
Tcl_DecrRefCount(newObjv[0]);
ckfree((char *) newObjv);
goto done;
}
/*
* Call trace procedures if needed.
*/
if ((checkTraces) && (command != NULL)) {
int cmdEpoch = cmdPtr->cmdEpoch;
cmdPtr->refCount++;
/*
* If the first set of traces modifies/deletes the command or
* any existing traces, then the set checkTraces to 0 and go
* through this while loop one more time.
*/
if (iPtr->tracePtr != NULL && traceCode == TCL_OK) {
traceCode = TclCheckInterpTraces(interp, command, length,
cmdPtr, code, TCL_TRACE_ENTER_EXEC, objc, objv);
}
if ((cmdPtr->flags & CMD_HAS_EXEC_TRACES) && (traceCode == TCL_OK)) {
traceCode = TclCheckExecutionTraces(interp, command, length,
cmdPtr, code, TCL_TRACE_ENTER_EXEC, objc, objv);
}
cmdPtr->refCount--;
if (cmdEpoch != cmdPtr->cmdEpoch) {
/* The command has been modified in some way */
checkTraces = 0;
goto reparseBecauseOfTraces;
}
}
/*
* Finally, invoke the command's Tcl_ObjCmdProc.
*/
cmdPtr->refCount++;
iPtr->cmdCount++;
|
| ︙ | ︙ | |||
3060 3061 3062 3063 3064 3065 3066 |
code = Tcl_LimitCheck(interp);
}
/*
* Call 'leave' command traces
*/
if (!(cmdPtr->flags & CMD_IS_DELETED)) {
| | | | | | | | | | | | 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 |
code = Tcl_LimitCheck(interp);
}
/*
* Call 'leave' command traces
*/
if (!(cmdPtr->flags & CMD_IS_DELETED)) {
if ((cmdPtr->flags & CMD_HAS_EXEC_TRACES) && (traceCode == TCL_OK)) {
traceCode = TclCheckExecutionTraces(interp, command, length,
cmdPtr, code, TCL_TRACE_LEAVE_EXEC, objc, objv);
}
if (iPtr->tracePtr != NULL && traceCode == TCL_OK) {
traceCode = TclCheckInterpTraces(interp, command, length,
cmdPtr, code, TCL_TRACE_LEAVE_EXEC, objc, objv);
}
}
TclCleanupCommand(cmdPtr);
/*
* If one of the trace invocation resulted in error, then
* change the result code accordingly. Note, that the
* interp->result should already be set correctly by the
* call to TraceExecutionProc.
*/
if (traceCode != TCL_OK) {
code = traceCode;
}
/*
* If the interpreter has a non-empty string result, the result
* object is either empty or stale because some procedure set
* interp->result directly. If so, move the string result to the
* result object, then reset the string result.
*/
if (*(iPtr->result) != 0) {
(void) Tcl_GetObjResult(interp);
}
done:
return code;
}
|
| ︙ | ︙ | |||
3148 3149 3150 3151 3152 3153 3154 |
for (tracePtr = iPtr->tracePtr; tracePtr; tracePtr = tracePtr->nextPtr) {
if ((tracePtr->level == 0) || (iPtr->numLevels <= tracePtr->level)) {
/*
* The command may be needed for an execution trace. Generate a
* command string.
*/
| | | | | 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 |
for (tracePtr = iPtr->tracePtr; tracePtr; tracePtr = tracePtr->nextPtr) {
if ((tracePtr->level == 0) || (iPtr->numLevels <= tracePtr->level)) {
/*
* The command may be needed for an execution trace. Generate a
* command string.
*/
Tcl_DStringInit(&cmdBuf);
for (i = 0; i < objc; i++) {
Tcl_DStringAppendElement(&cmdBuf, Tcl_GetString(objv[i]));
}
cmdString = Tcl_DStringValue(&cmdBuf);
cmdLen = Tcl_DStringLength(&cmdBuf);
break;
}
}
iPtr->numLevels++;
code = TclEvalObjvInternal(interp, objc, objv, cmdString, cmdLen, flags);
iPtr->numLevels--;
/*
* If we are again at the top level, process any unusual
* return code returned by the evaluated code.
*/
if (iPtr->numLevels == 0) {
if (code == TCL_RETURN) {
code = TclUpdateReturnInfo(iPtr);
}
if ((code != TCL_OK) && (code != TCL_ERROR)
&& !allowExceptions) {
ProcessUnexpectedResult(interp, code);
code = TCL_ERROR;
}
}
if ((code == TCL_ERROR) && !(flags & TCL_EVAL_INVOKE)) {
/*
* If there was an error, a command string will be needed for the
* error log: generate it now if it was not done previously.
*/
|
| ︙ | ︙ | |||
3342 3343 3344 3345 3346 3347 3348 |
Tcl_Token *tokenPtr; /* Pointer to first in an array of tokens
* to evaluate and concatenate. */
int count; /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
int code;
Tcl_Obj *resPtr;
| | | 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 |
Tcl_Token *tokenPtr; /* Pointer to first in an array of tokens
* to evaluate and concatenate. */
int count; /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
int code;
Tcl_Obj *resPtr;
code = Tcl_EvalTokensStandard(interp, tokenPtr, count);
if (code == TCL_OK) {
resPtr = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(resPtr);
Tcl_ResetResult(interp);
return resPtr;
} else {
|
| ︙ | ︙ | |||
3400 3401 3402 3403 3404 3405 3406 |
Tcl_Obj *staticObjArray[NUM_STATIC_OBJS], **objv, **objvSpace;
int expandStatic[NUM_STATIC_OBJS], *expand;
Tcl_Token *tokenPtr;
int i, code, commandLength, bytesLeft, expandRequested;
CallFrame *savedVarFramePtr; /* Saves old copy of iPtr->varFramePtr
* in case TCL_EVAL_GLOBAL was set. */
int allowExceptions = (iPtr->evalFlags & TCL_ALLOW_EXCEPTIONS);
| | | 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 |
Tcl_Obj *staticObjArray[NUM_STATIC_OBJS], **objv, **objvSpace;
int expandStatic[NUM_STATIC_OBJS], *expand;
Tcl_Token *tokenPtr;
int i, code, commandLength, bytesLeft, expandRequested;
CallFrame *savedVarFramePtr; /* Saves old copy of iPtr->varFramePtr
* in case TCL_EVAL_GLOBAL was set. */
int allowExceptions = (iPtr->evalFlags & TCL_ALLOW_EXCEPTIONS);
/*
* The variables below keep track of how much state has been
* allocated while evaluating the script, so that it can be freed
* properly if an error occurs.
*/
int gotParse = 0, objectsUsed = 0;
|
| ︙ | ︙ | |||
3430 3431 3432 3433 3434 3435 3436 |
objv = objvSpace = staticObjArray;
expand = expandStatic;
p = script;
bytesLeft = numBytes;
iPtr->evalFlags = 0;
do {
| | < | | | | | > | | | 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 |
objv = objvSpace = staticObjArray;
expand = expandStatic;
p = script;
bytesLeft = numBytes;
iPtr->evalFlags = 0;
do {
if (Tcl_ParseCommand(interp, p, bytesLeft, 0, &parse) != TCL_OK) {
code = TCL_ERROR;
goto error;
}
gotParse = 1;
if (parse.numWords > 0) {
/*
* Generate an array of objects for the words of the command.
*/
int objectsNeeded = 0;
if (parse.numWords > NUM_STATIC_OBJS) {
expand = (int *) ckalloc((unsigned)
(parse.numWords * sizeof(int)));
objvSpace = (Tcl_Obj **) ckalloc((unsigned)
(parse.numWords * sizeof(Tcl_Obj *)));
}
expandRequested = 0;
objv = objvSpace;
for (objectsUsed = 0, tokenPtr = parse.tokenPtr;
objectsUsed < parse.numWords;
objectsUsed++, tokenPtr += (tokenPtr->numComponents + 1)) {
code = TclSubstTokens(interp, tokenPtr+1,
tokenPtr->numComponents, NULL);
if (code != TCL_OK) {
goto error;
}
objv[objectsUsed] = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(objv[objectsUsed]);
if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
int numElements;
code = Tcl_ListObjLength(interp,
objv[objectsUsed], &numElements);
if (code == TCL_ERROR) {
/* Attempt to expand a non-list */
Tcl_Obj *msg;
Tcl_Obj *wordNum;
msg = Tcl_NewStringObj("\n (expanding word ", -1);
TclNewIntObj(wordNum, objectsUsed);
Tcl_IncrRefCount(wordNum);
Tcl_IncrRefCount(msg);
Tcl_AppendObjToObj(msg, wordNum);
Tcl_DecrRefCount(wordNum);
Tcl_AppendToObj(msg, ")", -1);
TclAppendObjToErrorInfo(interp, msg);
Tcl_DecrRefCount(msg);
|
| ︙ | ︙ | |||
3497 3498 3499 3500 3501 3502 3503 |
Tcl_Obj **copy = objvSpace;
int wordIdx = parse.numWords;
int objIdx = objectsNeeded - 1;
if ((parse.numWords > NUM_STATIC_OBJS)
|| (objectsNeeded > NUM_STATIC_OBJS)) {
objv = objvSpace = (Tcl_Obj **) ckalloc((unsigned)
| | | 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 |
Tcl_Obj **copy = objvSpace;
int wordIdx = parse.numWords;
int objIdx = objectsNeeded - 1;
if ((parse.numWords > NUM_STATIC_OBJS)
|| (objectsNeeded > NUM_STATIC_OBJS)) {
objv = objvSpace = (Tcl_Obj **) ckalloc((unsigned)
(objectsNeeded * sizeof(Tcl_Obj *)));
}
objectsUsed = 0;
while (wordIdx--) {
if (expand[wordIdx]) {
int numElements;
Tcl_Obj **elements, *temp = copy[wordIdx];
|
| ︙ | ︙ | |||
3524 3525 3526 3527 3528 3529 3530 |
}
objv += objIdx+1;
if (copy != staticObjArray) {
ckfree((char *) copy);
}
}
| | | < < < < < < < < < < | 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 |
}
objv += objIdx+1;
if (copy != staticObjArray) {
ckfree((char *) copy);
}
}
/*
* Execute the command and free the objects for its words.
*/
iPtr->numLevels++;
code = TclEvalObjvInternal(interp, objectsUsed, objv,
parse.commandStart, parse.commandSize, 0);
iPtr->numLevels--;
if (code != TCL_OK) {
goto error;
}
for (i = 0; i < objectsUsed; i++) {
Tcl_DecrRefCount(objv[i]);
}
objectsUsed = 0;
if (objvSpace != staticObjArray) {
|
| ︙ | ︙ | |||
3579 3580 3581 3582 3583 3584 3585 |
gotParse = 0;
} while (bytesLeft > 0);
iPtr->varFramePtr = savedVarFramePtr;
return TCL_OK;
error:
/* Generate and log various pieces of error information. */
| > > > | > > > > > | | | 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 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 |
gotParse = 0;
} while (bytesLeft > 0);
iPtr->varFramePtr = savedVarFramePtr;
return TCL_OK;
error:
/* Generate and log various pieces of error information. */
if (iPtr->numLevels == 0) {
if (code == TCL_RETURN) {
code = TclUpdateReturnInfo(iPtr);
}
if ((code != TCL_OK) && (code != TCL_ERROR) && !allowExceptions) {
ProcessUnexpectedResult(interp, code);
code = TCL_ERROR;
}
}
if ((code == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) {
commandLength = parse.commandSize;
if (parse.term == parse.commandStart + commandLength - 1) {
/*
* The terminator character (such as ; or ]) of the command where
* the error occurred is the last character in the parsed command.
* Reduce the length by one so that the error message doesn't
* include the terminator character.
*/
commandLength -= 1;
}
Tcl_LogCommandInfo(interp, script, parse.commandStart, commandLength);
}
iPtr->flags &= ~ERR_ALREADY_LOGGED;
/* Then free resources that had been allocated to the command. */
for (i = 0; i < objectsUsed; i++) {
Tcl_DecrRefCount(objv[i]);
}
if (gotParse) {
Tcl_FreeParse(&parse);
|
| ︙ | ︙ | |||
3639 3640 3641 3642 3643 3644 3645 | * Side effects: * Can be almost arbitrary, depending on the commands in the script. * *---------------------------------------------------------------------- */ int | | | | | 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 |
* Side effects:
* Can be almost arbitrary, depending on the commands in the script.
*
*----------------------------------------------------------------------
*/
int
Tcl_Eval(interp, script)
Tcl_Interp *interp; /* Token for command interpreter (returned
* by previous call to Tcl_CreateInterp). */
CONST char *script; /* Pointer to TCL command to execute. */
{
int code = Tcl_EvalEx(interp, script, -1, 0);
/*
* For backwards compatibility with old C code that predates the
* object system in Tcl 8.0, we have to mirror the object result
* back into the string result (some callers may expect it there).
*/
|
| ︙ | ︙ | |||
3749 3750 3751 3752 3753 3754 3755 3756 | * * Pure List Optimization (no string representation). In this * case, we can safely use Tcl_EvalObjv instead and get an * appreciable improvement in execution speed. This is because it * allows us to avoid a setFromAny step that would just pack * everything into a string and back out again. */ if ((objPtr->typePtr == &tclListType) && /* is a list... */ | > | | < < < | | | > > | | | | > > > | | > > > | | | | > | | | 4020 4021 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 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 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 4086 4087 4088 4089 |
*
* Pure List Optimization (no string representation). In this
* case, we can safely use Tcl_EvalObjv instead and get an
* appreciable improvement in execution speed. This is because it
* allows us to avoid a setFromAny step that would just pack
* everything into a string and back out again.
*/
if ((objPtr->typePtr == &tclListType) && /* is a list... */
(objPtr->bytes == NULL) /* ...without a string rep */) {
List *listRepPtr;
/*
* Increase the reference count of the List structure, to avoid a
* segfault if objPtr loses its List internal rep [Bug 1119369]
*/
listRepPtr = (List *) objPtr->internalRep.twoPtrValue.ptr1;
listRepPtr->refCount++;
result = Tcl_EvalObjv(interp, listRepPtr->elemCount,
&listRepPtr->elements, flags);
/*
* If we are the last users of listRepPtr, free it.
*/
if (--listRepPtr->refCount <= 0) {
int i, elemCount = listRepPtr->elemCount;
Tcl_Obj **elements = &listRepPtr->elements;
for (i=0; i<elemCount; i++) {
Tcl_DecrRefCount(elements[i]);
}
ckfree((char *) listRepPtr);
}
} else {
script = Tcl_GetStringFromObj(objPtr, &numSrcBytes);
result = Tcl_EvalEx(interp, script, numSrcBytes, flags);
}
} else {
/*
* Let the compiler/engine subsystem do the evaluation.
*/
savedVarFramePtr = iPtr->varFramePtr;
if (flags & TCL_EVAL_GLOBAL) {
iPtr->varFramePtr = NULL;
}
result = TclCompEvalObj(interp, objPtr);
/*
* If we are again at the top level, process any unusual
* return code returned by the evaluated code.
*/
if (iPtr->numLevels == 0) {
if (result == TCL_RETURN) {
result = TclUpdateReturnInfo(iPtr);
}
if ((result != TCL_OK) && (result != TCL_ERROR)
&& !allowExceptions) {
ProcessUnexpectedResult(interp, result);
result = TCL_ERROR;
script = Tcl_GetStringFromObj(objPtr, &numSrcBytes);
Tcl_LogCommandInfo(interp, script, script, numSrcBytes);
}
}
iPtr->evalFlags = 0;
|
| ︙ | ︙ | |||
3846 3847 3848 3849 3850 3851 3852 |
if (returnCode == TCL_BREAK) {
Tcl_AppendResult(interp,
"invoked \"break\" outside of a loop", (char *) NULL);
} else if (returnCode == TCL_CONTINUE) {
Tcl_AppendResult(interp,
"invoked \"continue\" outside of a loop", (char *) NULL);
} else {
| | | 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 |
if (returnCode == TCL_BREAK) {
Tcl_AppendResult(interp,
"invoked \"break\" outside of a loop", (char *) NULL);
} else if (returnCode == TCL_CONTINUE) {
Tcl_AppendResult(interp,
"invoked \"continue\" outside of a loop", (char *) NULL);
} else {
char buf[30 + TCL_INTEGER_SPACE];
sprintf(buf, "command returned bad code: %d", returnCode);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
}
}
/*
|
| ︙ | ︙ | |||
3875 3876 3877 3878 3879 3880 3881 | * Side effects: * None. * *--------------------------------------------------------------------------- */ int | | | | | | 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
int
Tcl_ExprLong(interp, exprstring, ptr)
Tcl_Interp *interp; /* Context in which to evaluate the
* expression. */
CONST char *exprstring; /* Expression to evaluate. */
long *ptr; /* Where to store result. */
{
register Tcl_Obj *exprPtr;
Tcl_Obj *resultPtr;
int length = strlen(exprstring);
int result = TCL_OK;
if (length > 0) {
exprPtr = Tcl_NewStringObj(exprstring, length);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprObj(interp, exprPtr, &resultPtr);
if (result == TCL_OK) {
/*
* Store an integer based on the expression result.
*/
|
| ︙ | ︙ | |||
3919 3920 3921 3922 3923 3924 3925 |
result = TCL_ERROR;
}
#else
*ptr = resultPtr->internalRep.longValue;
#endif
} else {
Tcl_SetResult(interp,
| | | | | | | | 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 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 |
result = TCL_ERROR;
}
#else
*ptr = resultPtr->internalRep.longValue;
#endif
} else {
Tcl_SetResult(interp,
"expression didn't have numeric value", TCL_STATIC);
result = TCL_ERROR;
}
Tcl_DecrRefCount(resultPtr); /* discard the result object */
} else {
/*
* Move the interpreter's object result to the string result,
* then reset the object result.
*/
(void) Tcl_GetStringResult(interp);
}
Tcl_DecrRefCount(exprPtr); /* discard the expression object */
} else {
/*
* An empty string. Just set the result integer to 0.
*/
*ptr = 0;
}
return result;
}
int
Tcl_ExprDouble(interp, exprstring, ptr)
Tcl_Interp *interp; /* Context in which to evaluate the
* expression. */
CONST char *exprstring; /* Expression to evaluate. */
double *ptr; /* Where to store result. */
{
register Tcl_Obj *exprPtr;
Tcl_Obj *resultPtr;
int length = strlen(exprstring);
int result = TCL_OK;
if (length > 0) {
exprPtr = Tcl_NewStringObj(exprstring, length);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprObj(interp, exprPtr, &resultPtr);
if (result == TCL_OK) {
/*
* Store a double based on the expression result.
*/
|
| ︙ | ︙ | |||
3987 3988 3989 3990 3991 3992 3993 |
result = TCL_ERROR;
}
#else
*ptr = (double) resultPtr->internalRep.longValue;
#endif
} else {
Tcl_SetResult(interp,
| | | | | | < < < < | < < < < < | | | < | < < < | < < < < | > > > | < | < < < < < < | < < | 4265 4266 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 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 |
result = TCL_ERROR;
}
#else
*ptr = (double) resultPtr->internalRep.longValue;
#endif
} else {
Tcl_SetResult(interp,
"expression didn't have numeric value", TCL_STATIC);
result = TCL_ERROR;
}
Tcl_DecrRefCount(resultPtr); /* discard the result object */
} else {
/*
* Move the interpreter's object result to the string result,
* then reset the object result.
*/
(void) Tcl_GetStringResult(interp);
}
Tcl_DecrRefCount(exprPtr); /* discard the expression object */
} else {
/*
* An empty string. Just set the result double to 0.0.
*/
*ptr = 0.0;
}
return result;
}
int
Tcl_ExprBoolean(interp, exprstring, ptr)
Tcl_Interp *interp; /* Context in which to evaluate the
* expression. */
CONST char *exprstring; /* Expression to evaluate. */
int *ptr; /* Where to store 0/1 result. */
{
if (*exprstring == '\0') {
/*
* An empty string. Just set the result boolean to 0 (false).
*/
*ptr = 0;
return TCL_OK;
} else {
int result;
Tcl_Obj *exprPtr = Tcl_NewStringObj(exprstring, -1);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprBooleanObj(interp, exprPtr, ptr);
Tcl_DecrRefCount(exprPtr);
if (result != TCL_OK) {
/*
* Move the interpreter's object result to the string result,
* then reset the object result.
*/
(void) Tcl_GetStringResult(interp);
}
return result;
}
}
/*
*--------------------------------------------------------------
*
* Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj --
*
|
| ︙ | ︙ | |||
4153 4154 4155 4156 4157 4158 4159 |
int *ptr; /* Where to store 0/1 result. */
{
Tcl_Obj *resultPtr;
int result;
result = Tcl_ExprObj(interp, objPtr, &resultPtr);
if (result == TCL_OK) {
| < < < < < | < | 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 |
int *ptr; /* Where to store 0/1 result. */
{
Tcl_Obj *resultPtr;
int result;
result = Tcl_ExprObj(interp, objPtr, &resultPtr);
if (result == TCL_OK) {
result = Tcl_GetBooleanFromObj(interp, resultPtr, ptr);
Tcl_DecrRefCount(resultPtr); /* discard the result object */
}
return result;
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
4209 4210 4211 4212 4213 4214 4215 |
/*
* Make the specified namespace the current namespace and invoke
* the command.
*/
result = TclPushStackFrame(interp, &framePtr, nsPtr, /*isProcCallFrame*/ 0);
if (result != TCL_OK) {
| | | 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 |
/*
* Make the specified namespace the current namespace and invoke
* the command.
*/
result = TclPushStackFrame(interp, &framePtr, nsPtr, /*isProcCallFrame*/ 0);
if (result != TCL_OK) {
return TCL_ERROR;
}
result = TclObjInvoke(interp, objc, objv, flags);
TclPopStackFrame(interp);
return result;
}
|
| ︙ | ︙ | |||
4255 4256 4257 4258 4259 4260 4261 |
Tcl_HashTable *hTblPtr; /* Table of hidden commands. */
char *cmdName; /* Name of the command from objv[0]. */
Tcl_HashEntry *hPtr = NULL;
Command *cmdPtr;
int result;
if (interp == (Tcl_Interp *) NULL) {
| | | | | 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 |
Tcl_HashTable *hTblPtr; /* Table of hidden commands. */
char *cmdName; /* Name of the command from objv[0]. */
Tcl_HashEntry *hPtr = NULL;
Command *cmdPtr;
int result;
if (interp == (Tcl_Interp *) NULL) {
return TCL_ERROR;
}
if ((objc < 1) || (objv == (Tcl_Obj **) NULL)) {
Tcl_AppendResult(interp, "illegal argument vector", (char *) NULL);
return TCL_ERROR;
}
if ((flags & TCL_INVOKE_HIDDEN) == 0) {
Tcl_Panic("TclObjInvoke: called without TCL_INVOKE_HIDDEN");
}
if (TclInterpReady(interp) == TCL_ERROR) {
|
| ︙ | ︙ | |||
4298 4299 4300 4301 4302 4303 4304 |
*/
if ((result == TCL_ERROR)
&& ((flags & TCL_INVOKE_NO_TRACEBACK) == 0)
&& ((iPtr->flags & ERR_ALREADY_LOGGED) == 0)) {
int length;
Tcl_Obj *command = Tcl_NewListObj(objc, objv);
| | | > > | 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 |
*/
if ((result == TCL_ERROR)
&& ((flags & TCL_INVOKE_NO_TRACEBACK) == 0)
&& ((iPtr->flags & ERR_ALREADY_LOGGED) == 0)) {
int length;
Tcl_Obj *command = Tcl_NewListObj(objc, objv);
CONST char* cmdString;
Tcl_IncrRefCount(command);
cmdString = Tcl_GetStringFromObj(command, &length);
Tcl_LogCommandInfo(interp, cmdString, cmdString, length);
Tcl_DecrRefCount(command);
iPtr->flags &= ~ERR_ALREADY_LOGGED;
}
return result;
}
/*
*---------------------------------------------------------------------------
|
| ︙ | ︙ | |||
4328 4329 4330 4331 4332 4333 4334 | * This expression object is passed to Tcl_ExprObj and then * deallocated. * *--------------------------------------------------------------------------- */ int | | | < < < < | | < < < < | < < < < < < < < | < < < < | < | < | | > | < > | < < < < < | < | < < < < < | | | | 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 |
* This expression object is passed to Tcl_ExprObj and then
* deallocated.
*
*---------------------------------------------------------------------------
*/
int
Tcl_ExprString(interp, expr)
Tcl_Interp *interp; /* Context in which to evaluate the
* expression. */
CONST char *expr; /* Expression to evaluate. */
{
int code = TCL_OK;
if (expr[0] == '\0') {
/* An empty string. Just set the interpreter's result to 0. */
Tcl_SetResult(interp, "0", TCL_VOLATILE);
} else {
Tcl_Obj *resultPtr, *exprObj = Tcl_NewStringObj(expr, -1);
Tcl_IncrRefCount(exprObj);
code = Tcl_ExprObj(interp, exprObj, &resultPtr);
Tcl_DecrRefCount(exprObj);
if (code == TCL_OK) {
Tcl_SetObjResult(interp, resultPtr);
Tcl_DecrRefCount(resultPtr);
}
/* Force the string rep of the interp result */
(void) Tcl_GetStringResult(interp);
}
return code;
}
/*
*----------------------------------------------------------------------
*
* TclAppendObjToErrorInfo --
*
|
| ︙ | ︙ | |||
4475 4476 4477 4478 4479 4480 4481 |
CONST char *message; /* Points to the first byte of an array of
* bytes of the message. */
int length; /* The number of bytes in the message.
* If < 0, then append all bytes up to a
* NULL byte. */
{
register Interp *iPtr = (Interp *) interp;
| | | 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 |
CONST char *message; /* Points to the first byte of an array of
* bytes of the message. */
int length; /* The number of bytes in the message.
* If < 0, then append all bytes up to a
* NULL byte. */
{
register Interp *iPtr = (Interp *) interp;
/*
* If we are just starting to log an error, errorInfo is initialized
* from the error message in the interpreter's result.
*/
if (iPtr->errorInfo == NULL) { /* just starting to log error */
if (iPtr->result[0] != 0) {
|
| ︙ | ︙ | |||
4533 4534 4535 4536 4537 4538 4539 | * Side effects: * Depends on what was done by the command. * *--------------------------------------------------------------------------- */ int | | | 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 |
* Side effects:
* Depends on what was done by the command.
*
*---------------------------------------------------------------------------
*/
int
Tcl_VarEvalVA(interp, argList)
Tcl_Interp *interp; /* Interpreter in which to evaluate command. */
va_list argList; /* Variable argument list. */
{
Tcl_DString buf;
char *string;
int result;
|
| ︙ | ︙ | |||
4699 4700 4701 4702 4703 4704 4705 | /* *---------------------------------------------------------------------- * * Tcl_GetVersion -- * * Get the Tcl major, minor, and patchlevel version numbers and | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 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 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 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 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 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 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 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 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 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 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 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 |
/*
*----------------------------------------------------------------------
*
* Tcl_GetVersion --
*
* Get the Tcl major, minor, and patchlevel version numbers and
* the release type. A patch is a release type TCL_FINAL_RELEASE
* with a patchLevel > 0.
*
* Results:
* None.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
void
Tcl_GetVersion(majorV, minorV, patchLevelV, type)
int *majorV;
int *minorV;
int *patchLevelV;
int *type;
{
if (majorV != NULL) {
*majorV = TCL_MAJOR_VERSION;
}
if (minorV != NULL) {
*minorV = TCL_MINOR_VERSION;
}
if (patchLevelV != NULL) {
*patchLevelV = TCL_RELEASE_SERIAL;
}
if (type != NULL) {
*type = TCL_RELEASE_LEVEL;
}
}
/*
*----------------------------------------------------------------------
*
* Math Functions --
*
* This page contains the procedures that implement all of the
* built-in math functions for expressions.
*
* Results:
* Each procedure returns TCL_OK if it succeeds and pushes an
* Tcl object holding the result. If it fails it returns TCL_ERROR
* and leaves an error message in the interpreter's result.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static int
ExprUnaryFunc(clientData, interp, objc, objv)
ClientData clientData; /* Contains the address of a procedure that
* takes one double argument and returns a
* double result. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Actual parameter list */
{
double d, dResult;
Tcl_Obj* oResult;
double (*func) _ANSI_ARGS_((double)) =
(double (*)_ANSI_ARGS_((double))) clientData;
/*
* Convert the function's argument to a double if necessary.
*/
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
} else if (Tcl_GetDoubleFromObj(interp, objv[1], &d) == TCL_OK) {
/* Evaluate the function */
dResult = (*func)(d);
if ((errno != 0) || IS_NAN(dResult)) {
if (errno != ERANGE || (dResult != 0.0 && !IS_INF(dResult))) {
TclExprFloatError(interp, dResult);
return TCL_ERROR;
}
}
TclNewDoubleObj(oResult, dResult);
Tcl_SetObjResult(interp, oResult);
return TCL_OK;
}
return TCL_ERROR;
}
static int
ExprBinaryFunc(clientData, interp, objc, objv)
ClientData clientData; /* Contains the address of a procedure that
* takes two double arguments and
* returns a double result. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Parameter vector */
{
double d1, d2, dResult;
Tcl_Obj* oResult;
double (*func) _ANSI_ARGS_((double, double)) =
(double (*)_ANSI_ARGS_((double, double))) clientData;
/*
* Convert the function's two arguments to doubles if necessary.
*/
if (objc != 3) {
MathFuncWrongNumArgs(interp, 3, objc, objv);
} else if (Tcl_GetDoubleFromObj(interp, objv[1], &d1) == TCL_OK
&& Tcl_GetDoubleFromObj(interp, objv[2], &d2) == TCL_OK) {
/* Evaluate the function */
errno = 0;
dResult = (*func)(d1, d2);
if ((errno != 0) || IS_NAN(dResult)) {
if (errno != ERANGE || (dResult != 0.0 && !IS_INF(dResult))) {
TclExprFloatError(interp, dResult);
return TCL_ERROR;
}
}
TclNewDoubleObj(oResult, dResult);
Tcl_SetObjResult(interp, oResult);
return TCL_OK;
}
return TCL_ERROR;
}
static int
ExprAbsFunc(clientData, interp, objc, objv)
ClientData clientData; /* Ignored. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Parameter vector */
{
register Tcl_Obj *valuePtr;
long i, iResult;
double d, dResult;
Tcl_Obj* oResult;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
valuePtr = objv[1];
if (VerifyExprObjType(interp, valuePtr) != TCL_OK) {
return TCL_ERROR;
}
/*
* Derive the absolute value according to the arg type.
*/
if (valuePtr->typePtr == &tclIntType) {
i = valuePtr->internalRep.longValue;
if (i < 0) {
iResult = -i;
if (iResult < 0) {
/* FIXME: This should promote to wide! */
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"integer value too large to represent", -1));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW",
"integer value too large to represent", (char *) NULL);
return TCL_ERROR;
}
} else {
iResult = i;
}
TclNewLongObj(oResult, iResult);
Tcl_SetObjResult(interp, oResult);
} else if (valuePtr->typePtr == &tclWideIntType) {
Tcl_WideInt wResult, w;
TclGetWide(w,valuePtr);
if (w < (Tcl_WideInt)0) {
wResult = -w;
if (wResult < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"integer value too large to represent", -1));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW",
"integer value too large to represent", (char *) NULL);
return TCL_ERROR;
}
} else {
wResult = w;
}
TclNewWideIntObj(oResult, wResult);
Tcl_SetObjResult(interp, oResult);
} else {
d = valuePtr->internalRep.doubleValue;
if (d < 0.0) {
dResult = -d;
} else {
dResult = d;
}
if (IS_NAN(dResult)) {
TclExprFloatError(interp, dResult);
return TCL_ERROR;
}
TclNewDoubleObj(oResult, dResult);
Tcl_SetObjResult(interp, oResult);
}
return TCL_OK;
}
static int
ExprBoolFunc(clientData, interp, objc, objv)
ClientData clientData; /* Ignored. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Actual parameter vector */
{
int value;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
if (Tcl_GetBooleanFromObj(interp, objv[1], &value) != TCL_OK) {
return TCL_ERROR;
}
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value));
return TCL_OK;
}
static int
ExprDoubleFunc(clientData, interp, objc, objv)
ClientData clientData; /* Ignored. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Actual parameter vector */
{
Tcl_Obj* valuePtr;
double dResult;
Tcl_Obj* oResult;
/*
* Check parameter type
*/
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
} else {
valuePtr = objv[1];
if (VerifyExprObjType(interp, valuePtr) == TCL_OK) {
GET_DOUBLE_VALUE(dResult, valuePtr, valuePtr->typePtr);
TclNewDoubleObj(oResult, dResult);
Tcl_SetObjResult(interp, oResult);
return TCL_OK;
}
}
return TCL_ERROR;
}
static int
ExprIntFunc(clientData, interp, objc, objv)
ClientData clientData; /* Ignored. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Actual parameter vector */
{
register Tcl_Obj *valuePtr;
long iResult;
double d;
Tcl_Obj* oResult;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
} else {
valuePtr = objv[1];
if (VerifyExprObjType(interp, valuePtr) == TCL_OK) {
if (valuePtr->typePtr == &tclIntType) {
iResult = valuePtr->internalRep.longValue;
} else if (valuePtr->typePtr == &tclWideIntType) {
TclGetLongFromWide(iResult,valuePtr);
} else {
d = valuePtr->internalRep.doubleValue;
if (d < 0.0) {
if (d < (double) (long) LONG_MIN) {
tooLarge:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"integer value too large to represent", -1));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW",
"integer value too large to represent",
(char *) NULL);
return TCL_ERROR;
}
} else if (d > (double) LONG_MAX) {
goto tooLarge;
}
if (IS_NAN(d) || IS_INF(d)) {
TclExprFloatError(interp, d);
return TCL_ERROR;
}
iResult = (long) d;
}
TclNewIntObj(oResult, iResult);
Tcl_SetObjResult(interp, oResult);
return TCL_OK;
}
}
return TCL_ERROR;
}
static int
ExprWideFunc(clientData, interp, objc, objv)
ClientData clientData; /* Ignored. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Actual parameter vector */
{
register Tcl_Obj *valuePtr;
Tcl_WideInt wResult;
double d;
Tcl_Obj* oResult;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
} else {
valuePtr = objv[1];
if (VerifyExprObjType(interp, valuePtr) == TCL_OK) {
if (valuePtr->typePtr == &tclIntType) {
wResult = valuePtr->internalRep.longValue;
} else if (valuePtr->typePtr == &tclWideIntType) {
wResult = valuePtr->internalRep.wideValue;
} else {
d = valuePtr->internalRep.doubleValue;
if (d < 0.0) {
if (d < Tcl_WideAsDouble(LLONG_MIN)) {
tooLarge:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"integer value too large to represent", -1));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW",
"integer value too large to represent",
(char *) NULL);
return TCL_ERROR;
}
} else if (d > Tcl_WideAsDouble(LLONG_MAX)) {
goto tooLarge;
}
if (IS_NAN(d) || IS_INF(d)) {
TclExprFloatError(interp, d);
return TCL_ERROR;
}
wResult = (Tcl_WideInt) d;
}
TclNewWideIntObj(oResult, wResult);
Tcl_SetObjResult(interp, oResult);
return TCL_OK;
}
}
return TCL_ERROR;
}
static int
ExprRandFunc(clientData, interp, objc, objv)
ClientData clientData; /* Ignored. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Actual parameter vector */
{
Interp *iPtr = (Interp *) interp;
double dResult;
long tmp; /* Algorithm assumes at least 32 bits.
* Only long guarantees that. See below. */
Tcl_Obj* oResult;
if (objc != 1) {
MathFuncWrongNumArgs(interp, 1, objc, objv);
return TCL_ERROR;
}
if (!(iPtr->flags & RAND_SEED_INITIALIZED)) {
iPtr->flags |= RAND_SEED_INITIALIZED;
/*
* Take into consideration the thread this interp is running in order
* to insure different seeds in different threads (bug #416643)
*/
iPtr->randSeed = TclpGetClicks() + ((long)Tcl_GetCurrentThread()<<12);
/*
* Make sure 1 <= randSeed <= (2^31) - 2. See below.
*/
iPtr->randSeed &= (unsigned long) 0x7fffffff;
if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) {
iPtr->randSeed ^= 123459876;
}
}
/*
* Generate the random number using the linear congruential
* generator defined by the following recurrence:
* seed = ( IA * seed ) mod IM
* where IA is 16807 and IM is (2^31) - 1. The recurrence maps
* a seed in the range [1, IM - 1] to a new seed in that same range.
* The recurrence maps IM to 0, and maps 0 back to 0, so those two
* values must not be allowed as initial values of seed.
*
* In order to avoid potential problems with integer overflow, the
* recurrence is implemented in terms of additional constants
* IQ and IR such that
* IM = IA*IQ + IR
* None of the operations in the implementation overflows a 32-bit
* signed integer, and the C type long is guaranteed to be at least
* 32 bits wide.
*
* For more details on how this algorithm works, refer to the following
* papers:
*
* S.K. Park & K.W. Miller, "Random number generators: good ones
* are hard to find," Comm ACM 31(10):1192-1201, Oct 1988
*
* W.H. Press & S.A. Teukolsky, "Portable random number
* generators," Computers in Physics 6(5):522-524, Sep/Oct 1992.
*/
#define RAND_IA 16807
#define RAND_IM 2147483647
#define RAND_IQ 127773
#define RAND_IR 2836
#define RAND_MASK 123459876
tmp = iPtr->randSeed/RAND_IQ;
iPtr->randSeed = RAND_IA*(iPtr->randSeed - tmp*RAND_IQ) - RAND_IR*tmp;
if (iPtr->randSeed < 0) {
iPtr->randSeed += RAND_IM;
}
/*
* Since the recurrence keeps seed values in the range [1, RAND_IM - 1],
* dividing by RAND_IM yields a double in the range (0, 1).
*/
dResult = iPtr->randSeed * (1.0/RAND_IM);
/*
* Push a Tcl object with the result.
*/
TclNewDoubleObj(oResult, dResult);
Tcl_SetObjResult(interp, oResult);
return TCL_OK;
}
static int
ExprRoundFunc(clientData, interp, objc, objv)
ClientData clientData; /* Ignored. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Parameter vector */
{
Tcl_Obj *valuePtr, *resPtr;
double d, a, f;
/* Check the argument count. */
if (objc != 2) {
MathFuncWrongNumArgs(interp, 1, objc, objv);
return TCL_ERROR;
}
valuePtr = objv[1];
/* Coerce the argument to a number. Integers are already rounded. */
if (VerifyExprObjType(interp, valuePtr) != TCL_OK) {
return TCL_ERROR;
}
if ((valuePtr->typePtr == &tclIntType) ||
(valuePtr->typePtr == &tclWideIntType)) {
Tcl_SetObjResult(interp, valuePtr);
return TCL_OK;
}
GET_DOUBLE_VALUE(d, valuePtr, valuePtr->typePtr);
/*
* Round the number to the nearest integer. I'd like to use rint()
* or nearbyint(), but they are far from universal.
*/
a = fabs(d);
if (a < Tcl_WideAsDouble(LLONG_MAX) + 0.5) {
d = valuePtr->internalRep.doubleValue;
f = floor(d);
d -= f;
if (d > 0.5 || (d == 0.5 && fmod(f, 2.0) != 0.0)) {
f = f + 1.0;
}
if (f >= (double) LONG_MIN && f <= (double) LONG_MAX) {
TclNewLongObj(resPtr, (long) f);
} else {
TclNewWideIntObj(resPtr, Tcl_DoubleAsWide(f));
}
Tcl_SetObjResult(interp, resPtr);
return TCL_OK;
}
/*
* Error return: result cannot be represented as an integer.
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"integer value too large to represent", -1));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW",
"integer value too large to represent", (char *) NULL);
return TCL_ERROR;
}
static int
ExprSrandFunc(clientData, interp, objc, objv)
ClientData clientData; /* Ignored. */
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
int objc; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Parameter vector */
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *valuePtr;
long i = 0; /* Initialized to avoid compiler warning. */
/*
* Convert argument and use it to reset the seed.
*/
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
valuePtr = objv[1];
if (VerifyExprObjType(interp, valuePtr) != TCL_OK) {
return TCL_ERROR;
}
if (Tcl_GetLongFromObj(NULL, valuePtr, &i) != TCL_OK) {
/*
* At this point, the only other possible type is double
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't use floating-point value as argument to srand", -1));
return TCL_ERROR;
}
/*
* Reset the seed. Make sure 1 <= randSeed <= 2^31 - 2.
* See comments in ExprRandFunc() for more details.
*/
iPtr->flags |= RAND_SEED_INITIALIZED;
iPtr->randSeed = i;
iPtr->randSeed &= (unsigned long) 0x7fffffff;
if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) {
iPtr->randSeed ^= 123459876;
}
/*
* To avoid duplicating the random number generation code we simply
* clean up our state and call the real random number function. That
* function will always succeed.
*/
return ExprRandFunc(clientData, interp, 1, objv);
}
/*
*----------------------------------------------------------------------
*
* VerifyExprObjType --
*
* This procedure is called by the math functions to verify that
* the object is either an int or double, coercing it if necessary.
* If an error occurs during conversion, an error message is left
* in the interpreter's result unless "interp" is NULL.
*
* Results:
* TCL_OK if it was int or double, TCL_ERROR otherwise
*
* Side effects:
* objPtr is ensured to be of tclIntType, tclWideIntType or
* tclDoubleType.
*
*----------------------------------------------------------------------
*/
static int
VerifyExprObjType(interp, objPtr)
Tcl_Interp *interp; /* The interpreter in which to execute the
* function. */
Tcl_Obj *objPtr; /* Points to the object to type check. */
{
if (IS_NUMERIC_TYPE(objPtr->typePtr)) {
return TCL_OK;
} else {
int length, result = TCL_OK;
char *s = Tcl_GetStringFromObj(objPtr, &length);
if (TclLooksLikeInt(s, length)) {
long i; /* Set but never used, needed in GET_WIDE_OR_INT */
Tcl_WideInt w;
GET_WIDE_OR_INT(result, objPtr, i, w);
} else {
double d;
result = Tcl_GetDoubleFromObj((Tcl_Interp *) NULL, objPtr, &d);
}
if ((result != TCL_OK) && (interp != NULL)) {
if (TclCheckBadOctal((Tcl_Interp *) NULL, s)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"argument to math function was an invalid octal number",
-1));
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"argument to math function didn't have numeric value",
-1));
}
}
return result;
}
}
/*
*----------------------------------------------------------------------
*
* MathFuncWrongNumArgs --
*
* Generate an error message when a math function presents the
* wrong number of arguments
*
* Results:
* None.
*
* Side effects:
* An error message is stored in the interpreter result
*
*----------------------------------------------------------------------
*/
static void
MathFuncWrongNumArgs(interp, expected, found, objv)
Tcl_Interp* interp; /* Tcl interpreter */
int expected; /* Formal parameter count */
int found; /* Actual parameter count */
Tcl_Obj *CONST *objv; /* Actual parameter vector */
{
Tcl_Obj* errorMessage;
CONST char* name = Tcl_GetString(objv[0]);
CONST char* tail = name + strlen(name);
while (tail > name+1) {
--tail;
if (*tail == ':' && tail[-1] == ':') {
name = tail+1;
break;
}
}
errorMessage = Tcl_NewStringObj("too ", -1);
if (found < expected) {
Tcl_AppendToObj(errorMessage, "few", -1);
} else {
Tcl_AppendToObj(errorMessage, "many", -1);
}
Tcl_AppendToObj(errorMessage, " arguments for math function \"", -1);
Tcl_AppendToObj(errorMessage, name, -1);
Tcl_AppendToObj(errorMessage, "\"", -1);
Tcl_SetObjResult(interp, errorMessage);
}
|
Changes to generic/tclBinary.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclBinary.c -- * * This file contains the implementation of the "binary" Tcl built-in * command and the Tcl binary data object. * * Copyright (c) 1997 by Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* * tclBinary.c -- * * This file contains the implementation of the "binary" Tcl built-in * command and the Tcl binary data object. * * Copyright (c) 1997 by Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclBinary.c,v 1.21.4.1 2005/06/13 01:45:42 msofer Exp $ */ #include "tclInt.h" #include <math.h> /* * The following constants are used by GetFormatSpec to indicate various * special conditions in the parsing of a format specifier. */ #define BINARY_ALL -1 /* Use all elements in the argument. */ |
| ︙ | ︙ | |||
1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 |
switch (type) {
case 'd':
case 'q':
case 'Q':
/*
* Double-precision floating point values.
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
| > > > | > > > > > | > > | 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 |
switch (type) {
case 'd':
case 'q':
case 'Q':
/*
* Double-precision floating point values.
* Tcl_GetDoubleFromObj returns TCL_ERROR for NaN, but
* we can check by comparing the object's type pointer.
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
if ( src->typePtr != &tclDoubleType ) {
return TCL_ERROR;
}
dvalue = src->internalRep.doubleValue;
}
CopyNumber(&dvalue, *cursorPtr, sizeof(double), type);
*cursorPtr += sizeof(double);
return TCL_OK;
case 'f':
case 'r':
case 'R':
/*
* Single-precision floating point values.
* Tcl_GetDoubleFromObj returns TCL_ERROR for NaN, but
* we can check by comparing the object's type pointer.
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
if ( src->typePtr != &tclDoubleType ) {
return TCL_ERROR;
}
dvalue = src->internalRep.doubleValue;
}
/*
* Because some compilers will generate floating point exceptions
* on an overflow cast (e.g. Borland), we restrict the values
* to the valid range for float.
*/
|
| ︙ | ︙ |
Changes to generic/tclCmdAH.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclCmdAH.c -- * * This file contains the top-level command routines for most of * the Tcl built-in commands whose names begin with the letters * A to H. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclCmdAH.c -- * * This file contains the top-level command routines for most of * the Tcl built-in commands whose names begin with the letters * A to H. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclCmdAH.c,v 1.58.2.1 2005/06/13 01:45:43 msofer Exp $ */ #include "tclInt.h" #include <locale.h> /* * Prototypes for local procedures defined in this file: |
| ︙ | ︙ | |||
451 452 453 454 455 456 457 |
&index) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum options) index) {
case ENC_CONVERTTO:
case ENC_CONVERTFROM: {
| < | > | > > < < < < < | 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 |
&index) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum options) index) {
case ENC_CONVERTTO:
case ENC_CONVERTFROM: {
Tcl_Obj *data;
if (objc == 3) {
encoding = Tcl_GetEncoding(interp, NULL);
data = objv[2];
} else if (objc == 4) {
if (TclGetEncodingFromObj(interp, objv[2], &encoding)
!= TCL_OK) {
return TCL_ERROR;
}
data = objv[3];
} else {
Tcl_WrongNumArgs(interp, 2, objv, "?encoding? data");
return TCL_ERROR;
}
if ((enum options) index == ENC_CONVERTFROM) {
/*
* Treat the string as binary data.
*/
stringPtr = (char *) Tcl_GetByteArrayFromObj(data, &length);
Tcl_ExternalToUtfDString(encoding, stringPtr, length, &ds);
|
| ︙ | ︙ | |||
525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
return Tcl_SetSystemEncoding(interp, TclGetString(objv[2]));
}
break;
}
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_ErrorObjCmd --
*
* This procedure is invoked to process the "error" Tcl command.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
return Tcl_SetSystemEncoding(interp, TclGetString(objv[2]));
}
break;
}
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclEncodingDirsObjCmd --
*
* This command manipulates the encoding search path.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* Can set the encoding search path.
*
*----------------------------------------------------------------------
*/
int
TclEncodingDirsObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?dirList?");
return TCL_ERROR;
}
if (objc == 1) {
Tcl_SetObjResult(interp, TclGetEncodingSearchPath());
return TCL_OK;
}
if (TclSetEncodingSearchPath(objv[1]) == TCL_ERROR) {
Tcl_AppendResult(interp, "expected directory list but got \"",
Tcl_GetString(objv[1]), "\"", NULL);
return TCL_ERROR;
}
Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_ErrorObjCmd --
*
* This procedure is invoked to process the "error" Tcl command.
|
| ︙ | ︙ |
Changes to generic/tclCmdIL.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tclCmdIL.c -- * * This file contains the top-level command routines for most of * the Tcl built-in commands whose names begin with the letters * I through L. It contains only commands in the generic core * (i.e. those that don't depend much upon UNIX facilities). * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1993-1997 Lucent Technologies. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | > | > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 |
/*
* tclCmdIL.c --
*
* This file contains the top-level command routines for most of
* the Tcl built-in commands whose names begin with the letters
* I through L. It contains only commands in the generic core
* (i.e. those that don't depend much upon UNIX facilities).
*
* Copyright (c) 1987-1993 The Regents of the University of California.
* Copyright (c) 1993-1997 Lucent Technologies.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
* Copyright (c) 2005 Donal K. Fellows.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclCmdIL.c,v 1.71.2.6 2005/10/09 13:56:36 msofer Exp $
*/
#include "tclInt.h"
#include "tclRegexp.h"
/*
* During execution of the "lsort" command, structures of the following
* type are used to arrange the objects being sorted into a collection
* of linked lists.
*/
typedef struct SortElement {
Tcl_Obj *objPtr; /* Object being sorted. */
int count; /* number of same elements in list */
struct SortElement *nextPtr; /* Next element in the list, or
* NULL for end of list. */
} SortElement;
/*
* These function pointer types are used with the "lsearch" and "lsort"
* commands to facilitate the "-nocase" option.
*/
typedef int (*SortStrCmpFn_t) _ANSI_ARGS_((const char *, const char *));
typedef int (*SortMemCmpFn_t) _ANSI_ARGS_((const void *, const void *,
size_t));
/*
* The "lsort" command needs to pass certain information down to the
* function that compares two list elements, and the comparison function
* needs to pass success or failure information back up to the top-level
* "lsort" command. The following structure is used to pass this
* information.
*/
typedef struct SortInfo {
int isIncreasing; /* Nonzero means sort in increasing order. */
int sortMode; /* The sort mode. One of SORTMODE_*
* values defined below */
SortStrCmpFn_t strCmpFn; /* Basic string compare command (used with
* ASCII mode). */
Tcl_Obj *compareCmdPtr; /* The Tcl comparison command when sortMode
* is SORTMODE_COMMAND. Pre-initialized to
* hold base of command.*/
int *indexv; /* If the -index option was specified, this
* holds the indexes contained in the list
* supplied as an argument to that option.
* NULL if no indexes supplied, and points
|
| ︙ | ︙ | |||
708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
Tcl_HashSearch search;
Namespace *nsPtr;
Namespace *globalNsPtr = (Namespace *) Tcl_GetGlobalNamespace(interp);
Namespace *currNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
Tcl_Obj *listPtr, *elemObjPtr;
int specificNsInPattern = 0; /* Init. to avoid compiler warning. */
Tcl_Command cmd;
/*
* Get the pattern and find the "effective namespace" in which to
* list commands.
*/
if (objc == 2) {
| > | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 |
Tcl_HashSearch search;
Namespace *nsPtr;
Namespace *globalNsPtr = (Namespace *) Tcl_GetGlobalNamespace(interp);
Namespace *currNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
Tcl_Obj *listPtr, *elemObjPtr;
int specificNsInPattern = 0; /* Init. to avoid compiler warning. */
Tcl_Command cmd;
int i;
/*
* Get the pattern and find the "effective namespace" in which to
* list commands.
*/
if (objc == 2) {
|
| ︙ | ︙ | |||
775 776 777 778 779 780 781 |
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
}
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
| > > > | > > > > > > > > > | > > > > > > | > | > > > > > > > > | | 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 |
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
}
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
if ((nsPtr != globalNsPtr) && !specificNsInPattern) {
Tcl_HashTable *tablePtr;
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
Namespace *pathNsPtr = nsPtr->commandPathArray[i].nsPtr;
if (pathNsPtr == NULL) {
continue;
}
tablePtr = &pathNsPtr->cmdTable;
entryPtr = Tcl_FindHashEntry(tablePtr, simplePattern);
if (entryPtr != NULL) {
break;
}
}
if (entryPtr == NULL) {
tablePtr = &globalNsPtr->cmdTable;
entryPtr = Tcl_FindHashEntry(tablePtr, simplePattern);
}
if (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(tablePtr, entryPtr);
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(cmdName, -1));
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
}
} else if (nsPtr->commandPathLength == 0 || specificNsInPattern) {
/*
* The pattern is non-trivial, but either there is no explicit
* path or there is an explicit namespace in the pattern. In
* both cases, the old matching scheme is perfect.
*/
entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (specificNsInPattern) {
cmd = (Tcl_Command) Tcl_GetHashValue(entryPtr);
|
| ︙ | ︙ | |||
824 825 826 827 828 829 830 831 832 833 834 835 836 837 |
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(cmdName, -1));
}
}
entryPtr = Tcl_NextHashEntry(&search);
}
}
}
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
/*
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 |
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(cmdName, -1));
}
}
entryPtr = Tcl_NextHashEntry(&search);
}
}
} else {
/*
* The pattern is non-trivial (can match more than one command
* name), there is an explicit path, and there is no explicit
* namespace in the pattern. This means that we have to
* traverse the path to discover all the commands defined.
*/
Tcl_HashTable addedCommandsTable;
int isNew;
int foundGlobal = (nsPtr == globalNsPtr);
/*
* We keep a hash of the objects already added to the result
* list.
*/
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)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
(void) Tcl_CreateHashEntry(&addedCommandsTable,
(char *)elemObjPtr, &isNew);
}
entryPtr = Tcl_NextHashEntry(&search);
}
/*
* Search the path next.
*/
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
Namespace *pathNsPtr = nsPtr->commandPathArray[i].nsPtr;
if (pathNsPtr == NULL) {
continue;
}
if (pathNsPtr == globalNsPtr) {
foundGlobal = 1;
}
entryPtr = Tcl_FirstHashEntry(&pathNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&pathNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
(void) Tcl_CreateHashEntry(&addedCommandsTable,
(char *) elemObjPtr, &isNew);
if (isNew) {
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
} else {
TclDecrRefCount(elemObjPtr);
}
}
entryPtr = Tcl_NextHashEntry(&search);
}
}
/*
* If the effective namespace isn't the global :: namespace, and a
* specific namespace wasn't requested in the pattern, then add in
* all global :: commands that match the simple pattern. Of course,
* we add in only those commands that aren't hidden by a command in
* the effective namespace.
*/
if (!foundGlobal) {
entryPtr = Tcl_FirstHashEntry(&globalNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
if (Tcl_FindHashEntry(&addedCommandsTable,
(char *) elemObjPtr) == NULL) {
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
} else {
TclDecrRefCount(elemObjPtr);
}
}
entryPtr = Tcl_NextHashEntry(&search);
}
}
Tcl_DeleteHashTable(&addedCommandsTable);
}
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
/*
|
| ︙ | ︙ | |||
1108 1109 1110 1111 1112 1113 1114 |
/*
* Scan through the global :: namespace's variable table and create a
* list of all global variables that match the pattern.
*/
listPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
if (pattern != NULL && TclMatchIsTrivial(pattern)) {
| | > | > | > | 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 |
/*
* Scan through the global :: namespace's variable table and create a
* list of all global variables that match the pattern.
*/
listPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
if (pattern != NULL && TclMatchIsTrivial(pattern)) {
entryPtr = Tcl_FindHashEntry(
(Tcl_HashTable *)&globalNsPtr->varTable, pattern);
if (entryPtr != NULL) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(pattern, -1));
}
} else {
for (entryPtr = Tcl_FirstHashEntry(
(Tcl_HashTable *)&globalNsPtr->varTable, &search);
entryPtr != NULL;
entryPtr = Tcl_NextHashEntry(&search)) {
varPtr = (Var *) Tcl_GetHashValue(entryPtr);
if (TclIsVarUndefined(varPtr)) {
continue;
}
varName = Tcl_GetHashKey(
(Tcl_HashTable *)&globalNsPtr->varTable, entryPtr);
if ((pattern == NULL) || Tcl_StringMatch(varName, pattern)) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(varName, -1));
}
}
}
Tcl_SetObjResult(interp, listPtr);
|
| ︙ | ︙ | |||
1421 1422 1423 1424 1425 1426 1427 |
Tcl_Interp *interp; /* Current interpreter. */
Tcl_Obj *listPtr; /* List object to append names to. */
CONST char *pattern; /* Pattern to match against. */
int includeLinks; /* 1 if upvars should be included, else 0. */
{
Interp *iPtr = (Interp *) interp;
CompiledLocal *localPtr;
| | | > < | | > > > > > > > | | 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 |
Tcl_Interp *interp; /* Current interpreter. */
Tcl_Obj *listPtr; /* List object to append names to. */
CONST char *pattern; /* Pattern to match against. */
int includeLinks; /* 1 if upvars should be included, else 0. */
{
Interp *iPtr = (Interp *) interp;
CompiledLocal *localPtr;
ShortVar *varPtr;
int i, localVarCt;
char **varNames, *varName;
Tcl_HashTable *localVarTablePtr;
register Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
localPtr = iPtr->varFramePtr->procPtr->firstLocalPtr;
localVarCt = iPtr->varFramePtr->numCompiledLocals;
varPtr = iPtr->varFramePtr->compiledLocals;
localVarTablePtr = iPtr->varFramePtr->varTablePtr;
varNames = (char **) &(varPtr[localVarCt]);
for (i = 0; i < localVarCt; i++) {
/*
* Skip nameless (temporary) variables and undefined variables
*/
if (!TclIsVarTemporary(localPtr) && !TclIsVarUndefined(varPtr)
&& (includeLinks || !TclIsVarLink(varPtr))) {
if ((pattern == NULL) || Tcl_StringMatch(varNames[i], pattern)) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(varNames[i], -1));
}
}
varPtr++;
localPtr = localPtr->nextPtr;
}
if (localVarTablePtr != NULL) {
if ((pattern != NULL) && TclMatchIsTrivial(pattern)) {
if (Tcl_FindHashEntry(localVarTablePtr, pattern)) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(pattern,-1));
}
return;
}
for (entryPtr = Tcl_FirstHashEntry(localVarTablePtr, &search);
entryPtr != NULL;
entryPtr = Tcl_NextHashEntry(&search)) {
varPtr = (ShortVar *) Tcl_GetHashValue(entryPtr);
if (!TclIsVarUndefined(varPtr)
&& (includeLinks || !TclIsVarLink(varPtr))) {
varName = Tcl_GetHashKey(localVarTablePtr, entryPtr);
if ((pattern == NULL)
|| Tcl_StringMatch(varName, pattern)) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(varName, -1));
|
| ︙ | ︙ | |||
1971 1972 1973 1974 1975 1976 1977 |
if (simplePattern != NULL && TclMatchIsTrivial(simplePattern)) {
/*
* If we can just do hash lookups, that simplifies things
* a lot.
*/
| | > | > | > | > | 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 |
if (simplePattern != NULL && TclMatchIsTrivial(simplePattern)) {
/*
* If we can just do hash lookups, that simplifies things
* a lot.
*/
entryPtr = Tcl_FindHashEntry(
(Tcl_HashTable *)&nsPtr->varTable, simplePattern);
if (entryPtr != NULL) {
varPtr = (Var *) Tcl_GetHashValue(entryPtr);
if (!TclIsVarUndefined(varPtr)
|| TclIsVarNamespaceVar(varPtr)) {
if (specificNsInPattern) {
elemObjPtr = Tcl_NewObj();
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr,
elemObjPtr);
} else {
elemObjPtr = Tcl_NewStringObj(simplePattern, -1);
}
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
}
} else if ((nsPtr != globalNsPtr) && !specificNsInPattern) {
entryPtr = Tcl_FindHashEntry(
(Tcl_HashTable *)&globalNsPtr->varTable,
simplePattern);
if (entryPtr != NULL) {
varPtr = (Var *) Tcl_GetHashValue(entryPtr);
if (!TclIsVarUndefined(varPtr)
|| TclIsVarNamespaceVar(varPtr)) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(simplePattern, -1));
}
}
}
} else {
/*
* Have to scan the tables of variables.
*/
entryPtr = Tcl_FirstHashEntry(
(Tcl_HashTable *)&nsPtr->varTable, &search);
while (entryPtr != NULL) {
varPtr = (Var *) Tcl_GetHashValue(entryPtr);
if (!TclIsVarUndefined(varPtr)
|| TclIsVarNamespaceVar(varPtr)) {
varName = Tcl_GetHashKey(
(Tcl_HashTable *)&nsPtr->varTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(varName, simplePattern)) {
if (specificNsInPattern) {
elemObjPtr = Tcl_NewObj();
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, elemObjPtr);
} else {
elemObjPtr = Tcl_NewStringObj(varName, -1);
|
| ︙ | ︙ | |||
2033 2034 2035 2036 2037 2038 2039 |
* names), then add in all global :: variables that match
* the simple pattern. Of course, add in only those
* variables that aren't hidden by a variable in the
* effective namespace.
*/
if ((nsPtr != globalNsPtr) && !specificNsInPattern) {
| | > | > | | > | 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 |
* names), then add in all global :: variables that match
* the simple pattern. Of course, add in only those
* variables that aren't hidden by a variable in the
* effective namespace.
*/
if ((nsPtr != globalNsPtr) && !specificNsInPattern) {
entryPtr = Tcl_FirstHashEntry(
(Tcl_HashTable *)&globalNsPtr->varTable, &search);
while (entryPtr != NULL) {
varPtr = (Var *) Tcl_GetHashValue(entryPtr);
if (!TclIsVarUndefined(varPtr)
|| TclIsVarNamespaceVar(varPtr)) {
varName = Tcl_GetHashKey(
(Tcl_HashTable *)&globalNsPtr->varTable,
entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(varName, simplePattern)) {
if (Tcl_FindHashEntry(
(Tcl_HashTable *)&nsPtr->varTable,
varName) == NULL) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(varName, -1));
}
}
}
entryPtr = Tcl_NextHashEntry(&search);
|
| ︙ | ︙ | |||
2862 2863 2864 2865 2866 2867 2868 |
Tcl_LrepeatObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
register int objc; /* Number of arguments. */
register Tcl_Obj *CONST objv[]; /* The argument objects. */
{
int elementCount, i, result;
| | > | | 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 |
Tcl_LrepeatObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
register int objc; /* Number of arguments. */
register Tcl_Obj *CONST objv[]; /* The argument objects. */
{
int elementCount, i, result;
Tcl_Obj *listPtr, **dataArray;
List *listRepPtr;
/*
* Check arguments for legality:
* lrepeat posInt value ?value ...?
*/
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "positiveCount value ?value ...?");
|
| ︙ | ︙ | |||
2892 2893 2894 2895 2896 2897 2898 |
* parsing.
*/
objc -= 2;
objv += 2;
/*
| | | < < < < < < < < < < < | < < < | < < | | < < < > > < < < < | | 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 |
* parsing.
*/
objc -= 2;
objv += 2;
/*
* Get an empty list object that is allocated large enough to hold each
* init value elementCount times.
*/
listPtr = Tcl_NewListObj(elementCount*objc, NULL);
listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
listRepPtr->elemCount = elementCount*objc;
dataArray = &listRepPtr->elements;
/*
* Set the elements. Note that we handle the common degenerate
* case of a single value being repeated separately to permit the
* compiler as much room as possible to optimize a loop that might
* be run a very large number of times.
*/
if (objc == 1) {
register Tcl_Obj *tmpPtr = objv[0];
tmpPtr->refCount += elementCount;
for (i=0 ; i<elementCount ; i++) {
dataArray[i] = tmpPtr;
}
} else {
int j, k = 0;
for (i=0 ; i<elementCount ; i++) {
for (j=0 ; j<objc ; j++) {
Tcl_IncrRefCount(objv[j]);
dataArray[k++] = objv[j];
}
}
}
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_LreplaceObjCmd --
|
| ︙ | ︙ | |||
3092 3093 3094 3095 3096 3097 3098 |
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument values. */
{
char *bytes, *patternBytes;
int i, match, mode, index, result, listc, length, elemLen;
int dataType, isIncreasing, lower, upper, patInt, objInt;
| | | > | | | > > > | 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 |
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument values. */
{
char *bytes, *patternBytes;
int i, match, mode, index, result, listc, length, elemLen;
int dataType, isIncreasing, lower, upper, patInt, objInt;
int offset, allMatches, inlineReturn, negatedMatch, returnSubindices, noCase;
double patDouble, objDouble;
SortInfo sortInfo;
Tcl_Obj *patObj, **listv, *listPtr, *startPtr, *itemPtr;
Tcl_RegExp regexp = NULL;
static CONST char *options[] = {
"-all", "-ascii", "-decreasing", "-dictionary",
"-exact", "-glob", "-increasing", "-index",
"-inline", "-integer", "-nocase", "-not",
"-real", "-regexp", "-sorted", "-start",
"-subindices",
NULL
};
enum options {
LSEARCH_ALL, LSEARCH_ASCII, LSEARCH_DECREASING, LSEARCH_DICTIONARY,
LSEARCH_EXACT, LSEARCH_GLOB, LSEARCH_INCREASING, LSEARCH_INDEX,
LSEARCH_INLINE, LSEARCH_INTEGER, LSEARCH_NOCASE, LSEARCH_NOT,
LSEARCH_REAL, LSEARCH_REGEXP, LSEARCH_SORTED, LSEARCH_START,
LSEARCH_SUBINDICES
};
enum datatypes {
ASCII, DICTIONARY, INTEGER, REAL
};
enum modes {
EXACT, GLOB, REGEXP, SORTED
};
SortStrCmpFn_t strCmpFn = strcmp;
mode = GLOB;
dataType = ASCII;
isIncreasing = 1;
allMatches = 0;
inlineReturn = 0;
returnSubindices = 0;
negatedMatch = 0;
listPtr = NULL;
startPtr = NULL;
offset = 0;
noCase = 0;
sortInfo.compareCmdPtr = NULL;
sortInfo.isIncreasing = 0;
sortInfo.sortMode = 0;
sortInfo.interp = interp;
sortInfo.resultCode = TCL_OK;
sortInfo.indexv = NULL;
sortInfo.indexc = 0;
|
| ︙ | ︙ | |||
3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 | isIncreasing = 1; break; case LSEARCH_INLINE: /* -inline */ inlineReturn = 1; break; case LSEARCH_INTEGER: /* -integer */ dataType = INTEGER; break; case LSEARCH_NOT: /* -not */ negatedMatch = 1; break; case LSEARCH_REAL: /* -real */ dataType = REAL; break; | > > > > | 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 | isIncreasing = 1; break; case LSEARCH_INLINE: /* -inline */ inlineReturn = 1; break; case LSEARCH_INTEGER: /* -integer */ dataType = INTEGER; break; case LSEARCH_NOCASE: /* -nocase */ strCmpFn = strcasecmp; noCase = 1; break; case LSEARCH_NOT: /* -not */ negatedMatch = 1; break; case LSEARCH_REAL: /* -real */ dataType = REAL; break; |
| ︙ | ︙ | |||
3313 3314 3315 3316 3317 3318 3319 |
if ((enum modes) mode == REGEXP) {
/*
* We can shimmer regexp/list if listv[i] == pattern, so get the
* regexp rep before the list rep.
*/
regexp = Tcl_GetRegExpFromObj(interp, objv[objc - 1],
| | > | 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 |
if ((enum modes) mode == REGEXP) {
/*
* We can shimmer regexp/list if listv[i] == pattern, so get the
* regexp rep before the list rep.
*/
regexp = Tcl_GetRegExpFromObj(interp, objv[objc - 1],
TCL_REG_ADVANCED | TCL_REG_NOSUB |
(noCase ? TCL_REG_NOCASE : 0));
if (regexp == NULL) {
if (startPtr != NULL) {
Tcl_DecrRefCount(startPtr);
}
if (sortInfo.indexc > 1) {
ckfree((char *) sortInfo.indexv);
}
|
| ︙ | ︙ | |||
3422 3423 3424 3425 3426 3427 3428 |
ckfree((char *) sortInfo.indexv);
}
return sortInfo.resultCode;
}
switch ((enum datatypes) dataType) {
case ASCII:
bytes = TclGetString(itemPtr);
| | | 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 |
ckfree((char *) sortInfo.indexv);
}
return sortInfo.resultCode;
}
switch ((enum datatypes) dataType) {
case ASCII:
bytes = TclGetString(itemPtr);
match = strCmpFn(patternBytes, bytes);
break;
case DICTIONARY:
bytes = TclGetString(itemPtr);
match = DictionaryCompare(patternBytes, bytes);
break;
case INTEGER:
result = Tcl_GetIntFromObj(interp, itemPtr, &objInt);
|
| ︙ | ︙ | |||
3520 3521 3522 3523 3524 3525 3526 |
switch ((enum modes) mode) {
case SORTED:
case EXACT:
switch ((enum datatypes) dataType) {
case ASCII:
bytes = Tcl_GetStringFromObj(itemPtr, &elemLen);
if (length == elemLen) {
| > > > > > > > | | > | 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 |
switch ((enum modes) mode) {
case SORTED:
case EXACT:
switch ((enum datatypes) dataType) {
case ASCII:
bytes = Tcl_GetStringFromObj(itemPtr, &elemLen);
if (length == elemLen) {
/*
* This split allows for more optimal
* compilation of memcmp
*/
if (noCase) {
match = (strcasecmp(bytes, patternBytes) == 0);
} else {
match = (memcmp(bytes, patternBytes,
(size_t) length) == 0);
}
}
break;
case DICTIONARY:
bytes = TclGetString(itemPtr);
match = (DictionaryCompare(bytes, patternBytes) == 0);
break;
|
| ︙ | ︙ | |||
3560 3561 3562 3563 3564 3565 3566 | } match = (objDouble == patDouble); break; } break; case GLOB: | | > | 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 |
}
match = (objDouble == patDouble);
break;
}
break;
case GLOB:
match = Tcl_StringCaseMatch(TclGetString(itemPtr),
patternBytes, noCase);
break;
case REGEXP:
match = Tcl_RegExpExecObj(interp, regexp, itemPtr, 0, 0, 0);
if (match < 0) {
Tcl_DecrRefCount(patObj);
if (listPtr != NULL) {
Tcl_DecrRefCount(listPtr);
|
| ︙ | ︙ | |||
3762 3763 3764 3765 3766 3767 3768 |
SortElement *elementArray;
SortElement *elementPtr;
SortInfo sortInfo; /* Information about this sort that
* needs to be passed to the
* comparison function */
static CONST char *switches[] = {
"-ascii", "-command", "-decreasing", "-dictionary", "-increasing",
| | > | > | 3906 3907 3908 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 |
SortElement *elementArray;
SortElement *elementPtr;
SortInfo sortInfo; /* Information about this sort that
* needs to be passed to the
* comparison function */
static CONST char *switches[] = {
"-ascii", "-command", "-decreasing", "-dictionary", "-increasing",
"-index", "-indices", "-integer", "-nocase", "-real", "-unique",
(char *) NULL
};
enum Lsort_Switches {
LSORT_ASCII, LSORT_COMMAND, LSORT_DECREASING, LSORT_DICTIONARY,
LSORT_INCREASING, LSORT_INDEX, LSORT_INDICES, LSORT_INTEGER,
LSORT_NOCASE, LSORT_REAL, LSORT_UNIQUE
};
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?options? list");
return TCL_ERROR;
}
/*
* Parse arguments to set up the mode for the sort.
*/
sortInfo.isIncreasing = 1;
sortInfo.sortMode = SORTMODE_ASCII;
sortInfo.strCmpFn = strcmp;
sortInfo.indexv = NULL;
sortInfo.indexc = 0;
sortInfo.interp = interp;
sortInfo.resultCode = TCL_OK;
cmdPtr = NULL;
unique = 0;
indices = 0;
|
| ︙ | ︙ | |||
3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 | } i++; break; } case LSORT_INTEGER: sortInfo.sortMode = SORTMODE_INTEGER; break; case LSORT_REAL: sortInfo.sortMode = SORTMODE_REAL; break; case LSORT_UNIQUE: unique = 1; break; case LSORT_INDICES: | > > > | 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 | } i++; break; } case LSORT_INTEGER: sortInfo.sortMode = SORTMODE_INTEGER; break; case LSORT_NOCASE: sortInfo.strCmpFn = strcasecmp; break; case LSORT_REAL: sortInfo.sortMode = SORTMODE_REAL; break; case LSORT_UNIQUE: unique = 1; break; case LSORT_INDICES: |
| ︙ | ︙ | |||
4153 4154 4155 4156 4157 4158 4159 |
}
objPtr2 = SelectObjFromSublist(objPtr2, infoPtr);
if (infoPtr->resultCode != TCL_OK) {
return order;
}
if (infoPtr->sortMode == SORTMODE_ASCII) {
| | | 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 |
}
objPtr2 = SelectObjFromSublist(objPtr2, infoPtr);
if (infoPtr->resultCode != TCL_OK) {
return order;
}
if (infoPtr->sortMode == SORTMODE_ASCII) {
order = infoPtr->strCmpFn(TclGetString(objPtr1), TclGetString(objPtr2));
} else if (infoPtr->sortMode == SORTMODE_DICTIONARY) {
order = DictionaryCompare(
TclGetString(objPtr1), TclGetString(objPtr2));
} else if (infoPtr->sortMode == SORTMODE_INTEGER) {
long a, b;
if ((Tcl_GetLongFromObj(infoPtr->interp, objPtr1, &a) != TCL_OK)
|
| ︙ | ︙ |
Changes to generic/tclCmdMZ.c.
| ︙ | ︙ | |||
11 12 13 14 15 16 17 | * Copyright (c) 1998-2000 Scriptics Corporation. * Copyright (c) 2002 ActiveState Corporation. * Copyright (c) 2003 Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * Copyright (c) 1998-2000 Scriptics Corporation. * Copyright (c) 2002 ActiveState Corporation. * Copyright (c) 2003 Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclCmdMZ.c,v 1.115.4.1 2005/06/13 01:45:44 msofer Exp $ */ #include "tclInt.h" #include "tclRegexp.h" /* *---------------------------------------------------------------------- |
| ︙ | ︙ | |||
86 87 88 89 90 91 92 |
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
int i, indices, match, about, offset, all, doinline, numMatchesSaved;
int cflags, eflags, stringLength;
Tcl_RegExp regExpr;
| | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
int i, indices, match, about, offset, all, doinline, numMatchesSaved;
int cflags, eflags, stringLength;
Tcl_RegExp regExpr;
Tcl_Obj *objPtr, *startIndex = NULL, *resultPtr = NULL;
Tcl_RegExpInfo info;
static CONST char *options[] = {
"-all", "-about", "-indices", "-inline",
"-expanded", "-line", "-linestop", "-lineanchor",
"-nocase", "-start", "--", (char *) NULL
};
enum options {
|
| ︙ | ︙ | |||
117 118 119 120 121 122 123 |
name = TclGetString(objv[i]);
if (name[0] != '-') {
break;
}
if (Tcl_GetIndexFromObj(interp, objv[i], options, "switch", TCL_EXACT,
&index) != TCL_OK) {
| | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
name = TclGetString(objv[i]);
if (name[0] != '-') {
break;
}
if (Tcl_GetIndexFromObj(interp, objv[i], options, "switch", TCL_EXACT,
&index) != TCL_OK) {
goto optionError;
}
switch ((enum options) index) {
case REGEXP_ALL: {
all = 1;
break;
}
case REGEXP_INDICES: {
|
| ︙ | ︙ | |||
157 158 159 160 161 162 163 164 165 166 |
break;
}
case REGEXP_LINEANCHOR: {
cflags |= TCL_REG_NLANCH;
break;
}
case REGEXP_START: {
if (++i >= objc) {
goto endOfForLoop;
}
| > | | | | > > | | | > > > > > > > > > > > > | 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 |
break;
}
case REGEXP_LINEANCHOR: {
cflags |= TCL_REG_NLANCH;
break;
}
case REGEXP_START: {
int temp;
if (++i >= objc) {
goto endOfForLoop;
}
if (TclGetIntForIndex(interp, objv[i], 0, &temp) != TCL_OK) {
goto optionError;
}
if (startIndex) {
Tcl_DecrRefCount(startIndex);
}
startIndex = objv[i];
Tcl_IncrRefCount(startIndex);
break;
}
case REGEXP_LAST: {
i++;
goto endOfForLoop;
}
}
}
endOfForLoop:
if ((objc - i) < (2 - about)) {
Tcl_WrongNumArgs(interp, 1, objv,
"?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?");
goto optionError;
}
objc -= i;
objv += i;
if (doinline && ((objc - 2) != 0)) {
/*
* User requested -inline, but specified match variables - a no-no.
*/
Tcl_AppendResult(interp, "regexp match variables not allowed",
" when using -inline", (char *) NULL);
goto optionError;
}
/*
* Handle the odd about case separately.
*/
if (about) {
regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags);
if ((regExpr == NULL) || (TclRegAbout(interp, regExpr) < 0)) {
optionError:
if (startIndex) {
Tcl_DecrRefCount(startIndex);
}
return TCL_ERROR;
}
return TCL_OK;
}
/*
* Get the length of the string that we are matching against so
* we can do the termination test for -all matches. Do this before
* getting the regexp to avoid shimmering problems.
*/
objPtr = objv[1];
stringLength = Tcl_GetCharLength(objPtr);
if (startIndex) {
TclGetIntForIndex(NULL, startIndex, stringLength, &offset);
Tcl_DecrRefCount(startIndex);
if (offset < 0) {
offset = 0;
}
}
regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags);
if (regExpr == NULL) {
return TCL_ERROR;
}
if (offset > 0) {
|
| ︙ | ︙ | |||
422 423 424 425 426 427 428 |
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
int idx, result, cflags, all, wlen, wsublen, numMatches, offset;
int start, end, subStart, subEnd, match;
Tcl_RegExp regExpr;
Tcl_RegExpInfo info;
| | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
int idx, result, cflags, all, wlen, wsublen, numMatches, offset;
int start, end, subStart, subEnd, match;
Tcl_RegExp regExpr;
Tcl_RegExpInfo info;
Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL;
Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend;
static CONST char *options[] = {
"-all", "-nocase", "-expanded",
"-line", "-linestop", "-lineanchor", "-start",
"--", NULL
};
|
| ︙ | ︙ | |||
451 452 453 454 455 456 457 |
name = TclGetString(objv[idx]);
if (name[0] != '-') {
break;
}
if (Tcl_GetIndexFromObj(interp, objv[idx], options, "switch",
TCL_EXACT, &index) != TCL_OK) {
| | | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
name = TclGetString(objv[idx]);
if (name[0] != '-') {
break;
}
if (Tcl_GetIndexFromObj(interp, objv[idx], options, "switch",
TCL_EXACT, &index) != TCL_OK) {
goto optionError;
}
switch ((enum options) index) {
case REGSUB_ALL: {
all = 1;
break;
}
case REGSUB_NOCASE: {
|
| ︙ | ︙ | |||
479 480 481 482 483 484 485 486 487 488 |
break;
}
case REGSUB_LINEANCHOR: {
cflags |= TCL_REG_NLANCH;
break;
}
case REGSUB_START: {
if (++idx >= objc) {
goto endOfForLoop;
}
| > | | | | > > | > > > > > > > > > > > > > | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 |
break;
}
case REGSUB_LINEANCHOR: {
cflags |= TCL_REG_NLANCH;
break;
}
case REGSUB_START: {
int temp;
if (++idx >= objc) {
goto endOfForLoop;
}
if (TclGetIntForIndex(interp, objv[idx], 0, &temp) != TCL_OK) {
goto optionError;
}
if (startIndex) {
Tcl_DecrRefCount(startIndex);
}
startIndex = objv[idx];
Tcl_IncrRefCount(startIndex);
break;
}
case REGSUB_LAST: {
idx++;
goto endOfForLoop;
}
}
}
endOfForLoop:
if (objc-idx < 3 || objc-idx > 4) {
Tcl_WrongNumArgs(interp, 1, objv,
"?switches? exp string subSpec ?varName?");
optionError:
if (startIndex) {
Tcl_DecrRefCount(startIndex);
}
return TCL_ERROR;
}
objc -= idx;
objv += idx;
if (startIndex) {
int stringLength = Tcl_GetCharLength(objv[1]);
TclGetIntForIndex(NULL, startIndex, stringLength, &offset);
Tcl_DecrRefCount(startIndex);
if (offset < 0) {
offset = 0;
}
}
if (all && (offset == 0)
&& (strpbrk(TclGetString(objv[2]), "&\\") == NULL)
&& (strpbrk(TclGetString(objv[0]), "*+?{}()[].\\|^$") == NULL)) {
/*
* This is a simple one pair string map situation. We make use of
* a slightly modified version of the one pair STR_MAP code.
|
| ︙ | ︙ | |||
1445 1446 1447 1448 1449 1450 1451 | break; } } break; case STR_IS_BOOL: case STR_IS_TRUE: case STR_IS_FALSE: | > | > | < < < < < < < < | 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 |
break;
}
}
break;
case STR_IS_BOOL:
case STR_IS_TRUE:
case STR_IS_FALSE:
if (TCL_OK != Tcl_ConvertToType(NULL, objPtr,
&tclBooleanType)) {
result = 0;
} else if ((((enum isOptions) index == STR_IS_TRUE) &&
objPtr->internalRep.longValue == 0) ||
(((enum isOptions) index == STR_IS_FALSE) &&
objPtr->internalRep.longValue != 0)) {
result = 0;
}
break;
case STR_IS_CONTROL:
chcomp = Tcl_UniCharIsControl;
break;
case STR_IS_DIGIT:
|
| ︙ | ︙ | |||
1501 1502 1503 1504 1505 1506 1507 | result = 0; failat = -1; } break; } } errno = 0; | | < < < < < < < < < | | 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 |
result = 0;
failat = -1;
}
break;
}
}
errno = 0;
TclStrToD(string1, (CONST char **) &stop); /* INTL: Tcl source. */
if (stop == string1) {
/*
* In this case, nothing like a number was found
*/
result = 0;
failat = 0;
} else {
/*
|
| ︙ | ︙ | |||
1881 1882 1883 1884 1885 1886 1887 | * This will be >30% faster on larger strings. */ int mapLen; Tcl_UniChar *mapString, u2lc; ustring2 = Tcl_GetUnicodeFromObj(mapElemv[0], &length2); p = ustring1; | | > | 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 |
* This will be >30% faster on larger strings.
*/
int mapLen;
Tcl_UniChar *mapString, u2lc;
ustring2 = Tcl_GetUnicodeFromObj(mapElemv[0], &length2);
p = ustring1;
if ((length2 > length1) || (length2 == 0)) {
/* match string is either longer than input or empty */
ustring1 = end;
} else {
mapString = Tcl_GetUnicodeFromObj(mapElemv[1], &mapLen);
u2lc = (nocase ? Tcl_UniCharToLower(*ustring2) : 0);
for (; ustring1 < end; ustring1++) {
if (((*ustring1 == *ustring2) ||
(nocase && (Tcl_UniCharToLower(*ustring1) ==
|
| ︙ | ︙ | |||
1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 |
* Get the key string to match on.
*/
ustring2 = mapStrings[index];
length2 = mapLens[index];
if ((length2 > 0) && ((*ustring1 == *ustring2) ||
(nocase && (Tcl_UniCharToLower(*ustring1) ==
u2lc[index/2]))) &&
((length2 == 1) || strCmpFn(ustring2, ustring1,
(unsigned long) length2) == 0)) {
if (p != ustring1) {
/*
* Put the skipped chars onto the result first
*/
Tcl_AppendUnicodeToObj(resultPtr, p,
| > > | 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 |
* Get the key string to match on.
*/
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) || strCmpFn(ustring2, ustring1,
(unsigned long) length2) == 0)) {
if (p != ustring1) {
/*
* Put the skipped chars onto the result first
*/
Tcl_AppendUnicodeToObj(resultPtr, p,
|
| ︙ | ︙ | |||
2123 2124 2125 2126 2127 2128 2129 |
}
case STR_REPLACE: {
Tcl_UniChar *ustring1;
int first, last;
if (objc < 5 || objc > 6) {
Tcl_WrongNumArgs(interp, 2, objv,
| | | 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 |
}
case STR_REPLACE: {
Tcl_UniChar *ustring1;
int first, last;
if (objc < 5 || objc > 6) {
Tcl_WrongNumArgs(interp, 2, objv,
"string first last ?string?");
return TCL_ERROR;
}
ustring1 = Tcl_GetUnicodeFromObj(objv[2], &length1);
length1--;
if ((TclGetIntForIndex(interp, objv[3], length1, &first) != TCL_OK)
|
| ︙ | ︙ | |||
2497 2498 2499 2500 2501 2502 2503 |
int
Tcl_SwitchObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
| | > > > > > | | | > > > > | 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 2553 2554 2555 |
int
Tcl_SwitchObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
int i, j, index, mode, result, splitObjs, numMatchesSaved, noCase;
char *pattern;
Tcl_Obj *stringObj, *indexVarObj, *matchVarObj;
Tcl_Obj *CONST *savedObjv = objv;
Tcl_RegExp regExpr = NULL;
/*
* If you add options that make -e and -g not unique prefixes of
* -exact or -glob, you *must* fix TclCompileSwitchCmd's option
* parser as well.
*/
static CONST char *options[] = {
"-exact", "-glob", "-indexvar", "-matchvar", "-nocase", "-regexp",
"--", NULL
};
enum options {
OPT_EXACT, OPT_GLOB, OPT_INDEXV, OPT_MATCHV, OPT_NOCASE, OPT_REGEXP,
OPT_LAST
};
typedef int (*strCmpFn_t) _ANSI_ARGS_((const char *, const char *));
strCmpFn_t strCmpFn = strcmp;
mode = OPT_EXACT;
indexVarObj = NULL;
matchVarObj = NULL;
numMatchesSaved = 0;
noCase = 0;
for (i = 1; i < objc; i++) {
if (TclGetString(objv[i])[0] != '-') {
break;
}
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
&index) != TCL_OK) {
return TCL_ERROR;
|
| ︙ | ︙ | |||
2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 |
Tcl_AppendResult(interp,
"missing variable name argument to -matchvar option",
(char *) NULL);
return TCL_ERROR;
}
matchVarObj = objv[i];
numMatchesSaved = -1;
} else {
mode = index;
}
}
if (objc - i < 2) {
Tcl_WrongNumArgs(interp, 1, objv,
| > > > | 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 |
Tcl_AppendResult(interp,
"missing variable name argument to -matchvar option",
(char *) NULL);
return TCL_ERROR;
}
matchVarObj = objv[i];
numMatchesSaved = -1;
} else if (index == OPT_NOCASE) {
strCmpFn = strcasecmp;
noCase = 1;
} else {
mode = index;
}
}
if (objc - i < 2) {
Tcl_WrongNumArgs(interp, 1, objv,
|
| ︙ | ︙ | |||
2690 2691 2692 2693 2694 2695 2696 |
return TCL_ERROR;
}
}
goto matchFound;
} else {
switch (mode) {
case OPT_EXACT:
| | | > | | 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 |
return TCL_ERROR;
}
}
goto matchFound;
} else {
switch (mode) {
case OPT_EXACT:
if (strCmpFn(TclGetString(stringObj), pattern) == 0) {
goto matchFound;
}
break;
case OPT_GLOB:
if (Tcl_StringCaseMatch(TclGetString(stringObj), pattern,
noCase)) {
goto matchFound;
}
break;
case OPT_REGEXP:
regExpr = Tcl_GetRegExpFromObj(interp, objv[i],
TCL_REG_ADVANCED | (noCase ? TCL_REG_NOCASE : 0));
if (regExpr == NULL) {
return TCL_ERROR;
} else {
int matched = Tcl_RegExpExecObj(interp, regExpr,
stringObj, 0, numMatchesSaved, 0);
if (matched < 0) {
return TCL_ERROR;
|
| ︙ | ︙ | |||
2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 |
Tcl_TimeObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
register Tcl_Obj *objPtr;
register int i, result;
int count;
double totalMicroSec;
Tcl_Time start, stop;
| > < | 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 |
Tcl_TimeObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
register Tcl_Obj *objPtr;
Tcl_Obj *objs[4];
register int i, result;
int count;
double totalMicroSec;
Tcl_Time start, stop;
if (objc == 2) {
count = 1;
} else if (objc == 3) {
result = Tcl_GetIntFromObj(interp, objv[2], &count);
if (result != TCL_OK) {
return result;
|
| ︙ | ︙ | |||
2892 2893 2894 2895 2896 2897 2898 |
return result;
}
}
Tcl_GetTime(&stop);
totalMicroSec = ( ( (double) ( stop.sec - start.sec ) ) * 1.0e6
+ ( stop.usec - start.usec ) );
| | > > > | > > > > | | 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 |
return result;
}
}
Tcl_GetTime(&stop);
totalMicroSec = ( ( (double) ( stop.sec - start.sec ) ) * 1.0e6
+ ( stop.usec - start.usec ) );
if (count <= 1) {
/* Use int obj since we know time is not fractional [Bug 1202178] */
objs[0] = Tcl_NewIntObj((count <= 0) ? 0 : (int) totalMicroSec);
} else {
objs[0] = Tcl_NewDoubleObj(totalMicroSec/count);
}
objs[1] = Tcl_NewStringObj("microseconds", -1);
objs[2] = Tcl_NewStringObj("per", -1);
objs[3] = Tcl_NewStringObj("iteration", -1);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, objs));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_WhileObjCmd --
|
| ︙ | ︙ |
Changes to generic/tclCompCmds.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
/*
* tclCompCmds.c --
*
* This file contains compilation procedures that compile various
* Tcl commands into a sequence of instructions ("bytecodes").
*
* Copyright (c) 1997-1998 Sun Microsystems, Inc.
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
* Copyright (c) 2002 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
| | > > > > > > > > > > > > > > > > > > > > < > | < | > | | < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | < | > > | | | | | > > > > > > > > > > > > > > > > > | | | < | | | < < < < < < > | < | > > < < < | < < | < < < < | < < < < < < < < < < | < < < < < < | < < < | < < | < < < | | < < < < < < < < < < < < | | | | | | | | | | | | < < < < < < < < < < < < | | > | | | | > < | | | < | < < | < < < < < | < < | < | < < | < | < < < | < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
/*
* tclCompCmds.c --
*
* This file contains compilation procedures that compile various
* Tcl commands into a sequence of instructions ("bytecodes").
*
* Copyright (c) 1997-1998 Sun Microsystems, Inc.
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
* Copyright (c) 2002 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclCompCmds.c,v 1.59.4.15 2005/06/13 01:45:44 msofer Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
/*
* Macro that encapsulates an efficiency trick that avoids a function
* call for the simplest of compiles. The ANSI C "prototype" for this
* macro is:
*
* static void CompileWord _ANSI_ARGS((CompileEnv *envPtr,
* Tcl_Token *tokenPtr, Tcl_Inter *interp));
*/
#define CompileWord(envPtr, tokenPtr, interp) \
if ((tokenPtr)->type == TCL_TOKEN_SIMPLE_WORD) { \
TclEmitPush(TclRegisterNewLiteral((envPtr), (tokenPtr)[1].start, \
(tokenPtr)[1].size), (envPtr)); \
} else { \
TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \
(envPtr)); \
}
/*
* Prototypes for procedures defined later in this file:
*/
static int CompileSetCmdInternal _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Parse *parsePtr, CompileEnv *envPtr, int varFlags));
static ClientData DupForeachInfo _ANSI_ARGS_((ClientData clientData));
static void FreeForeachInfo _ANSI_ARGS_((ClientData clientData));
static int PushVarName _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags,
int *localIndexPtr, int *simpleVarNamePtr, int *isScalarPtr));
/*
* Flags bits used by PushVarName.
*/
#define TCL_CREATE_VAR 1 /* Create a compiled local if none is found */
/*
* The structures below define the AuxData types defined in this file.
*/
AuxDataType tclForeachInfoType = {
"ForeachInfo", /* name */
DupForeachInfo, /* dupProc */
FreeForeachInfo /* freeProc */
};
/*
*----------------------------------------------------------------------
*
* TclCompileAppendCmd --
*
* Procedure called to compile the "append" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "append" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileAppendCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
int numWords;
int flags = TCL_APPEND_VALUE;
numWords = parsePtr->numWords;
if (numWords == 1) {
return TCL_ERROR;
} else if (numWords == 2) {
/*
* append varName == set varName
*/
return TclCompileSetCmd(interp, parsePtr, envPtr);
} else if (numWords > 3) {
/*
* APPEND instructions currently only handle one value
*/
return TCL_ERROR;
}
return CompileSetCmdInternal(interp, parsePtr, envPtr, flags);
}
/*
*----------------------------------------------------------------------
*
* TclCompileBreakCmd --
*
* Procedure called to compile the "break" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "break" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileBreakCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
if (parsePtr->numWords != 1) {
return TCL_ERROR;
}
/*
* Emit a break instruction.
*/
TclEmitInst1(INST_BREAK, envPtr->exceptArrayCurr, envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileCatchCmd --
*
* Procedure called to compile the "catch" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "catch" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileCatchCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
Tcl_Token *cmdTokenPtr, *nameTokenPtr;
CONST char *name;
int localIndex, nameChars, startOffset;
int savedStackDepth = envPtr->currStackDepth;
int savedOpenRange = envPtr->exceptArrayCurr;
/*
* If syntax does not match what we expect for [catch], do not
* compile. Let runtime checks determine if syntax has changed.
*/
if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) {
return TCL_ERROR;
}
/*
* If a variable was specified and the catch command is at global level
* (not in a procedure), don't compile it inline: the payoff is
* too small.
*/
if ((parsePtr->numWords == 3) && (envPtr->procPtr == NULL)) {
return TCL_ERROR;
}
/*
* Make sure the variable name, if any, has no substitutions and just
* refers to a local scaler.
*/
localIndex = -1;
cmdTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
if (parsePtr->numWords == 3) {
nameTokenPtr = cmdTokenPtr + (cmdTokenPtr->numComponents + 1);
if (nameTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
name = nameTokenPtr[1].start;
nameChars = nameTokenPtr[1].size;
if (!TclIsLocalScalar(name, nameChars)) {
return TCL_ERROR;
}
localIndex = TclFindCompiledLocal(nameTokenPtr[1].start,
nameTokenPtr[1].size, /*create*/ 1,
/*flags*/ 0, envPtr->procPtr);
} else {
return TCL_ERROR;
}
}
/*
* If the body is not a simple word, compile the instructions
* to generate it outside the catch range.
*/
if (cmdTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
/*
* REMARK: this will store an off-by-one stack depth in the
* catchStack: we rely on INST_EVAL_STK to pop its argument before
* going to checkForCatch.
*/
TclCompileTokens(interp, cmdTokenPtr+1,
cmdTokenPtr->numComponents, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
}
/*
* We will compile the catch command. Emit a beginCatch instruction at
* the start of the catch body: the subcommand it controls.
*/
envPtr->catchDepth++;
envPtr->maxCatchDepth =
TclMax(envPtr->catchDepth, envPtr->maxCatchDepth);
envPtr->exceptArrayCurr = -2;
/*
* Emit the instructions to eval the body. The INST_BEGIN_CATCH
* operand will be the set later to the distance to the INST_END_CATCH.
*/
startOffset = (envPtr->codeNext - envPtr->codeStart);
TclEmitInst1(INST_BEGIN_CATCH, 0, envPtr);
if (cmdTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
TclCompileCmdWord(interp, cmdTokenPtr+1, 1, envPtr);
} else {
TclEmitInst0(INST_EVAL_STK, envPtr);
}
TclSetStackDepth((savedStackDepth+1), envPtr);
/*
* Store the offset between INST_BEGIN_CATCH and INST_END_CATCH at the
* BEGIN instruction, then emit the END instruction.
*/
TclSetJumpTarget(envPtr, startOffset);
TclEmitInst1(INST_END_CATCH, localIndex, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
envPtr->catchDepth--;
envPtr->exceptArrayCurr = savedOpenRange;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileContinueCmd --
*
* Procedure called to compile the "continue" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "continue" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileContinueCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
/*
* There should be no argument after the "continue".
*/
if (parsePtr->numWords != 1) {
return TCL_ERROR;
}
/*
* Emit a continue instruction.
*/
TclEmitInst1(INST_CONTINUE, envPtr->exceptArrayCurr, envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileExprCmd --
*
* Procedure called to compile the "expr" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "expr" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileExprCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
Tcl_Token *firstWordPtr;
if (parsePtr->numWords == 1) {
return TCL_ERROR;
}
firstWordPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
TclCompileExprWords(interp, firstWordPtr, (parsePtr->numWords-1), envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileForCmd --
*
* Procedure called to compile the "for" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "for" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileForCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr;
int jumpEvalCondOffset;
int bodyCodeOffset, nextCodeOffset, jumpDist;
int bodyRange, nextRange;
int savedStackDepth = envPtr->currStackDepth;
if (parsePtr->numWords != 5) {
return TCL_ERROR;
}
/*
* If the test expression requires substitutions, don't compile the for
* command inline. E.g., the expression might cause the loop to never
* execute or execute forever, as in "for {} "$x > 5" {incr x} {}".
*/
startTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
testTokenPtr = startTokenPtr + (startTokenPtr->numComponents + 1);
if (testTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
return TCL_ERROR;
}
/*
* Bail out also if the body or the next expression require substitutions
* in order to insure correct behaviour [Bug 219166]
*/
nextTokenPtr = testTokenPtr + (testTokenPtr->numComponents + 1);
bodyTokenPtr = nextTokenPtr + (nextTokenPtr->numComponents + 1);
if ((nextTokenPtr->type != TCL_TOKEN_SIMPLE_WORD)
|| (bodyTokenPtr->type != TCL_TOKEN_SIMPLE_WORD)) {
return TCL_ERROR;
}
/*
* Inline compile the initial command.
*/
TclCompileCmdWord(interp, startTokenPtr+1,
startTokenPtr->numComponents, envPtr);
TclEmitInst0(INST_POP, envPtr);
/*
* Jump to the evaluation of the condition. This code uses the "loop
* rotation" optimisation (which eliminates one branch from the loop).
* "for start cond next body" produces then:
* start
* goto A
* B: body : bodyCodeOffset
* next : nextCodeOffset, continueOffset
* A: cond -> result : testCodeOffset
* if (result) goto B
*/
TclEmitForwardJump(envPtr, INST_JUMP, jumpEvalCondOffset);
/*
* Compile the loop body.
*/
bodyRange = TclBeginExceptRange(envPtr);
bodyCodeOffset = (envPtr->codeNext - envPtr->codeStart);
TclCompileCmdWord(interp, bodyTokenPtr+1,
bodyTokenPtr->numComponents, envPtr);
TclEndExceptRange(bodyRange, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
TclEmitInst0(INST_POP, envPtr);
/*
* Compile the "next" subcommand.
*/
nextRange = TclBeginExceptRange(envPtr);
nextCodeOffset = (envPtr->codeNext - envPtr->codeStart);
TclCompileCmdWord(interp, nextTokenPtr+1,
nextTokenPtr->numComponents, envPtr);
TclEndExceptRange(nextRange, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
TclEmitInst0(INST_POP, envPtr);
/*
* Compile the test expression then emit the conditional jump that
* terminates the for.
*/
TclSetJumpTarget(envPtr, jumpEvalCondOffset);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
jumpDist = (envPtr->codeNext - envPtr->codeStart) - bodyCodeOffset;
TclEmitInst1(INST_JUMP_TRUE, -jumpDist, envPtr);
/*
* Set the loop's break and continue targets.
*/
envPtr->exceptArrayPtr[bodyRange].continueOffset = nextCodeOffset;
envPtr->exceptArrayPtr[bodyRange].breakOffset =
envPtr->exceptArrayPtr[nextRange].breakOffset =
(envPtr->codeNext - envPtr->codeStart);
/*
* The for command's result is an empty string.
*/
TclSetStackDepth(savedStackDepth, envPtr);
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileForeachCmd --
*
* Procedure called to compile the "foreach" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "foreach" command
* at runtime.
*
n*----------------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
629 630 631 632 633 634 635 |
* foreach command. Stored in a AuxData
* record in the ByteCode. */
int firstValueTemp; /* Index of the first temp var in the frame
* used to point to a value list. */
int loopCtTemp; /* Index of temp var holding the loop's
* iteration count. */
Tcl_Token *tokenPtr, *bodyTokenPtr;
| < < | > | | | | < < < < < < < < | | | | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 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 |
* foreach command. Stored in a AuxData
* record in the ByteCode. */
int firstValueTemp; /* Index of the first temp var in the frame
* used to point to a value list. */
int loopCtTemp; /* Index of temp var holding the loop's
* iteration count. */
Tcl_Token *tokenPtr, *bodyTokenPtr;
int infoIndex, range;
int numWords, numLists, numVars, loopIndex, tempVar, i, j, code;
int savedStackDepth = envPtr->currStackDepth;
int bodyOffset;
/*
* 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
*/
#define STATIC_VAR_LIST_SIZE 5
int varcListStaticSpace[STATIC_VAR_LIST_SIZE];
CONST char **varvListStaticSpace[STATIC_VAR_LIST_SIZE];
int *varcList = varcListStaticSpace;
CONST char ***varvList = varvListStaticSpace;
/*
* If the foreach command isn't in a procedure, don't compile it inline:
* the payoff is too small.
*/
if (procPtr == NULL) {
return TCL_ERROR;
}
numWords = parsePtr->numWords;
if ((numWords < 4) || (numWords%2 != 0)) {
return TCL_ERROR;
}
/*
* Bail out if the body requires substitutions
* in order to insure correct behaviour [Bug 219166]
*/
for (i = 0, tokenPtr = parsePtr->tokenPtr;
i < numWords-1;
i++, tokenPtr += (tokenPtr->numComponents + 1)) {
}
bodyTokenPtr = tokenPtr;
if (bodyTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
return TCL_ERROR;
}
/*
* Allocate storage for the varcList and varvList arrays if necessary.
*/
numLists = (numWords - 2)/2;
if (numLists > STATIC_VAR_LIST_SIZE) {
varcList = (int *) ckalloc(numLists * sizeof(int));
varvList = (CONST char ***) ckalloc(numLists * sizeof(CONST char **));
}
for (loopIndex = 0; loopIndex < numLists; loopIndex++) {
varcList[loopIndex] = 0;
varvList[loopIndex] = NULL;
}
/*
* Break up each var list and set the varcList and varvList arrays.
* Don't compile the foreach inline if any var name needs substitutions
* or isn't a scalar, or if any var list needs substitutions.
*/
loopIndex = 0;
for (i = 0, tokenPtr = parsePtr->tokenPtr;
i < numWords-1;
i++, tokenPtr += (tokenPtr->numComponents + 1)) {
if (i%2 == 1) {
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
code = TCL_ERROR;
goto done;
} else {
/* Lots of copying going on here. Need a ListObj wizard
* to show a better way. */
Tcl_DString varList;
Tcl_DStringInit(&varList);
Tcl_DStringAppend(&varList, tokenPtr[1].start,
tokenPtr[1].size);
code = Tcl_SplitList(interp, Tcl_DStringValue(&varList),
&varcList[loopIndex], &varvList[loopIndex]);
Tcl_DStringFree(&varList);
if (code != TCL_OK) {
code = TCL_ERROR;
goto done;
}
numVars = varcList[loopIndex];
for (j = 0; j < numVars; j++) {
CONST char *varName = varvList[loopIndex][j];
if (!TclIsLocalScalar(varName, (int) strlen(varName))) {
code = TCL_ERROR;
goto done;
}
}
}
loopIndex++;
}
}
|
| ︙ | ︙ | |||
752 753 754 755 756 757 758 |
* nonoverlapping foreach loops, they don't share any temps.
*/
code = TCL_OK;
firstValueTemp = -1;
for (loopIndex = 0; loopIndex < numLists; loopIndex++) {
tempVar = TclFindCompiledLocal(NULL, /*nameChars*/ 0,
| | | | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
* nonoverlapping foreach loops, they don't share any temps.
*/
code = TCL_OK;
firstValueTemp = -1;
for (loopIndex = 0; loopIndex < numLists; loopIndex++) {
tempVar = TclFindCompiledLocal(NULL, /*nameChars*/ 0,
/*create*/ 1, /*flags*/ 0, procPtr);
if (loopIndex == 0) {
firstValueTemp = tempVar;
}
}
loopCtTemp = TclFindCompiledLocal(NULL, /*nameChars*/ 0,
/*create*/ 1, /*flags*/ 0, procPtr);
/*
* Create and initialize the ForeachInfo and ForeachVarList data
* structures describing this command. Then create a AuxData record
* pointing to the ForeachInfo structure.
*/
|
| ︙ | ︙ | |||
781 782 783 784 785 786 787 |
varListPtr = (ForeachVarList *) ckalloc((unsigned)
sizeof(ForeachVarList) + (numVars * sizeof(int)));
varListPtr->numVars = numVars;
for (j = 0; j < numVars; j++) {
CONST char *varName = varvList[loopIndex][j];
int nameChars = strlen(varName);
varListPtr->varIndexes[j] = TclFindCompiledLocal(varName,
| | < < < | < < < < | > > | < < < < < < < < < > > | | > | < < < < < < < < < < | < < < < | < < | < < < | < < < | | | < < < < | < < < < < < < < < < | | < | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 |
varListPtr = (ForeachVarList *) ckalloc((unsigned)
sizeof(ForeachVarList) + (numVars * sizeof(int)));
varListPtr->numVars = numVars;
for (j = 0; j < numVars; j++) {
CONST char *varName = varvList[loopIndex][j];
int nameChars = strlen(varName);
varListPtr->varIndexes[j] = TclFindCompiledLocal(varName,
nameChars, /*create*/ 1, /*flags*/ 0, procPtr);
}
infoPtr->varLists[loopIndex] = varListPtr;
}
infoIndex = TclCreateAuxData((ClientData) infoPtr, &tclForeachInfoType, envPtr);
/*
* Evaluate then store each value list in the associated temporary.
*/
loopIndex = 0;
for (i = 0, tokenPtr = parsePtr->tokenPtr;
i < numWords-1;
i++, tokenPtr += (tokenPtr->numComponents + 1)) {
if ((i%2 == 0) && (i > 0)) {
TclCompileTokens(interp, tokenPtr+1,
tokenPtr->numComponents, envPtr);
tempVar = (firstValueTemp + loopIndex);
TclEmitInst2(INST_STORE, VM_VAR_OMIT_PUSH, tempVar, envPtr);
loopIndex++;
}
}
/*
* Initialize the temporary var that holds the count of loop
* iterations. This jumps to the INST_FOREACH_STEP code after the body
* (loop rotation optimisation).
*/
TclEmitInst1(INST_FOREACH_START, infoIndex, envPtr);
/*
* Inline compile the loop body.
*/
range = TclBeginExceptRange(envPtr);
infoPtr->rangeIndex = range;
bodyOffset = (envPtr->codeNext - envPtr->codeStart);
TclCompileCmdWord(interp, bodyTokenPtr+1,
bodyTokenPtr->numComponents, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
TclEndExceptRange(range, envPtr);
TclEmitInst0(INST_POP, envPtr);
/*
* Test for loop end, jump back to the top of the loop if not ended.
*/
envPtr->exceptArrayPtr[range].continueOffset
= (envPtr->codeNext - envPtr->codeStart);
TclEmitInst1(INST_FOREACH_STEP, infoIndex, envPtr);
/*
* Set the loop's break target.
*/
envPtr->exceptArrayPtr[range].breakOffset =
(envPtr->codeNext - envPtr->codeStart);
/*
* The foreach command's result is an empty string.
*/
TclEmitPush(TclRegisterLiteral(envPtr, "", 0, /*onHeap*/ 0), envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
done:
for (loopIndex = 0; loopIndex < numLists; loopIndex++) {
if (varvList[loopIndex] != (CONST char **) NULL) {
ckfree((char *) varvList[loopIndex]);
}
}
if (varcList != varcListStaticSpace) {
ckfree((char *) varcList);
ckfree((char *) varvList);
}
return code;
}
/*
*----------------------------------------------------------------------
*
* DupForeachInfo --
|
| ︙ | ︙ | |||
950 951 952 953 954 955 956 |
int numVars, i, j;
dupPtr = (ForeachInfo *) ckalloc((unsigned)
(sizeof(ForeachInfo) + (numLists * sizeof(ForeachVarList *))));
dupPtr->numLists = numLists;
dupPtr->firstValueTemp = srcPtr->firstValueTemp;
dupPtr->loopCtTemp = srcPtr->loopCtTemp;
| > | | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 |
int numVars, i, j;
dupPtr = (ForeachInfo *) ckalloc((unsigned)
(sizeof(ForeachInfo) + (numLists * sizeof(ForeachVarList *))));
dupPtr->numLists = numLists;
dupPtr->firstValueTemp = srcPtr->firstValueTemp;
dupPtr->loopCtTemp = srcPtr->loopCtTemp;
dupPtr->rangeIndex = srcPtr->rangeIndex;
for (i = 0; i < numLists; i++) {
srcListPtr = srcPtr->varLists[i];
numVars = srcListPtr->numVars;
dupListPtr = (ForeachVarList *) ckalloc((unsigned)
sizeof(ForeachVarList) + numVars*sizeof(int));
dupListPtr->numVars = numVars;
for (j = 0; j < numVars; j++) {
|
| ︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | * * TclCompileIfCmd -- * * Procedure called to compile the "if" command. * * Results: * Returns TCL_OK for a successful compile. | | | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | * * TclCompileIfCmd -- * * Procedure called to compile the "if" command. * * Results: * Returns TCL_OK for a successful compile. * Returns TCL_ERROR to defer evaluation to runtime. * * Side effects: * Instructions are added to envPtr to execute the "if" command * at runtime. * *---------------------------------------------------------------------- */ |
| ︙ | ︙ | |||
1033 1034 1035 1036 1037 1038 1039 |
/* Used to fix the ifFalse jump after each
* test when its target PC is determined. */
JumpFixupArray jumpEndFixupArray;
/* Used to fix the jump after each "then"
* body to the end of the "if" when that PC
* is determined. */
Tcl_Token *tokenPtr, *testTokenPtr;
| < | 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
/* Used to fix the ifFalse jump after each
* test when its target PC is determined. */
JumpFixupArray jumpEndFixupArray;
/* Used to fix the jump after each "then"
* body to the end of the "if" when that PC
* is determined. */
Tcl_Token *tokenPtr, *testTokenPtr;
int jumpIndex = 0; /* avoid compiler warning. */
int numWords, wordIdx, numBytes, j, code;
CONST char *word;
int savedStackDepth = envPtr->currStackDepth;
/* Saved stack depth at the start of the first
* test; the envPtr current depth is restored
* to this value at the start of each test. */
|
| ︙ | ︙ | |||
1056 1057 1058 1059 1060 1061 1062 |
tokenPtr = parsePtr->tokenPtr;
wordIdx = 0;
numWords = parsePtr->numWords;
for (wordIdx = 0; wordIdx < numWords; wordIdx++) {
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
| | | 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
tokenPtr = parsePtr->tokenPtr;
wordIdx = 0;
numWords = parsePtr->numWords;
for (wordIdx = 0; wordIdx < numWords; wordIdx++) {
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
return TCL_ERROR;
}
tokenPtr += 2;
}
TclInitJumpFixupArray(&jumpFalseFixupArray);
TclInitJumpFixupArray(&jumpEndFixupArray);
|
| ︙ | ︙ | |||
1088 1089 1090 1091 1092 1093 1094 |
|| ((numBytes == 6) && (strncmp(word, "elseif", 6) == 0))) {
tokenPtr += (tokenPtr->numComponents + 1);
wordIdx++;
} else {
break;
}
if (wordIdx >= numWords) {
| | | | 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
|| ((numBytes == 6) && (strncmp(word, "elseif", 6) == 0))) {
tokenPtr += (tokenPtr->numComponents + 1);
wordIdx++;
} else {
break;
}
if (wordIdx >= numWords) {
code = TCL_ERROR;
goto done;
}
/*
* Compile the test expression then emit the conditional jump
* around the "then" part.
*/
TclSetStackDepth((savedStackDepth), envPtr);
testTokenPtr = tokenPtr;
if (realCond) {
/*
* Find out if the condition is a constant.
*/
|
| ︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 |
Tcl_ResetResult(interp);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) {
TclExpandJumpFixupArray(&jumpFalseFixupArray);
}
jumpIndex = jumpFalseFixupArray.next;
jumpFalseFixupArray.next++;
| | | | | | | | < | < < < < < < < | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
Tcl_ResetResult(interp);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) {
TclExpandJumpFixupArray(&jumpFalseFixupArray);
}
jumpIndex = jumpFalseFixupArray.next;
jumpFalseFixupArray.next++;
TclEmitForwardJump(envPtr, INST_JUMP_FALSE,
(jumpFalseFixupArray.fixup[jumpIndex]));
}
code = TCL_OK;
}
/*
* Skip over the optional "then" before the then clause.
*/
tokenPtr = testTokenPtr + (testTokenPtr->numComponents + 1);
wordIdx++;
if (wordIdx >= numWords) {
code = TCL_ERROR;
goto done;
}
if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
word = tokenPtr[1].start;
numBytes = tokenPtr[1].size;
if ((numBytes == 4) && (strncmp(word, "then", 4) == 0)) {
tokenPtr += (tokenPtr->numComponents + 1);
wordIdx++;
if (wordIdx >= numWords) {
code = TCL_ERROR;
goto done;
}
}
}
/*
* Compile the "then" command body.
*/
if (compileScripts) {
TclSetStackDepth((savedStackDepth), envPtr);
TclCompileCmdWord(interp, tokenPtr+1,
tokenPtr->numComponents, envPtr);
}
if (realCond) {
/*
* Jump to the end of the "if" command. Both jumpFalseFixupArray and
* jumpEndFixupArray are indexed by "jumpIndex".
*/
if (jumpEndFixupArray.next >= jumpEndFixupArray.end) {
TclExpandJumpFixupArray(&jumpEndFixupArray);
}
jumpEndFixupArray.next++;
TclEmitForwardJump(envPtr, INST_JUMP,
(jumpEndFixupArray.fixup[jumpIndex]));
/*
* Fix the target of the jumpFalse after the test. Generate a 4 byte
* jump if the distance is > 120 bytes. This is conservative, and
* ensures that we won't have to replace this jump if we later also
* need to replace the proceeding jump to the end of the "if" with a
* 4 byte jump.
*/
TclSetJumpTarget(envPtr, (jumpFalseFixupArray.fixup[jumpIndex]));
} else if (boolVal) {
/*
*We were processing an "if 1 {...}"; stop compiling
* scripts
*/
compileScripts = 0;
|
| ︙ | ︙ | |||
1223 1224 1225 1226 1227 1228 1229 |
}
/*
* Restore the current stack depth in the environment; the
* "else" clause (or its default) will add 1 to this.
*/
| | | | < | < < < < < < < < < < < < < < < < < < < < | | | > > | | | < > > > > < < < | | | < | | | | | | < > > | | > > > > | > | > > < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < | > | | | < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 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 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 |
}
/*
* Restore the current stack depth in the environment; the
* "else" clause (or its default) will add 1 to this.
*/
TclSetStackDepth((savedStackDepth), envPtr);
/*
* Check for the optional else clause. Do not compile
* anything if this was an "if 1 {...}" case.
*/
if ((wordIdx < numWords)
&& (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD)) {
/*
* There is an else clause. Skip over the optional "else" word.
*/
word = tokenPtr[1].start;
numBytes = tokenPtr[1].size;
if ((numBytes == 4) && (strncmp(word, "else", 4) == 0)) {
tokenPtr += (tokenPtr->numComponents + 1);
wordIdx++;
if (wordIdx >= numWords) {
code = TCL_ERROR;
goto done;
}
}
if (compileScripts) {
/*
* Compile the else command body.
*/
TclCompileCmdWord(interp, tokenPtr+1,
tokenPtr->numComponents, envPtr);
}
/*
* Make sure there are no words after the else clause.
*/
wordIdx++;
if (wordIdx < numWords) {
code = TCL_ERROR;
goto done;
}
} else {
/*
* No else clause: the "if" command's result is an empty string.
*/
if (compileScripts) {
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
}
}
/*
* Fix the unconditional jumps to the end of the "if" command.
*/
for (j = jumpEndFixupArray.next; j > 0; j--) {
jumpIndex = (j - 1); /* i.e. process the closest jump first */
TclSetJumpTarget(envPtr, (jumpEndFixupArray.fixup[jumpIndex]));
}
/*
* Free the jumpFixupArray array if malloc'ed storage was used.
*/
done:
TclSetStackDepth((savedStackDepth+1), envPtr);
TclFreeJumpFixupArray(&jumpFalseFixupArray);
TclFreeJumpFixupArray(&jumpEndFixupArray);
return code;
}
/*
*----------------------------------------------------------------------
*
* TclCompileIncrCmd --
*
* Procedure called to compile the "incr" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "incr" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileIncrCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *incrTokenPtr;
int simpleVarName, isScalar, localIndex;
int stackDepth = envPtr->currStackDepth + 1;
int valAndFlags = 0;
if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) {
return TCL_ERROR;
}
varTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
PushVarName(interp, varTokenPtr, envPtr, TCL_CREATE_VAR,
&localIndex, &simpleVarName, &isScalar);
if (localIndex == -1) {
localIndex = HPUINT_MAX;
}
/*
* If an increment is given, push it, but see first if it's a small
* integer.
*/
if (parsePtr->numWords == 3) {
incrTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
if (incrTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
CONST char *word = incrTokenPtr[1].start;
int numBytes = incrTokenPtr[1].size;
int n;
/*
* Note there is a danger that modifying the string could have
* undesirable side effects. In this case, TclLooksLikeInt has
* no dependencies on shared strings so we should be safe.
*/
if (TclLooksLikeInt(word, numBytes)) {
int code;
Tcl_Obj *intObj = Tcl_NewStringObj(word, numBytes);
Tcl_IncrRefCount(intObj);
code = Tcl_GetIntFromObj(NULL, intObj, &n);
Tcl_DecrRefCount(intObj);
if ((code == TCL_OK)
&& ((TclPSizedInt) HPINT_MIN < ((TclPSizedInt)n<<2))
&& (((TclPSizedInt)n<<2) <= (TclPSizedInt)HPINT_MAX)) {
valAndFlags = (n << 2);
}
}
if (!valAndFlags) {
valAndFlags = HPINT_MIN;
TclEmitPush(
TclRegisterNewLiteral(envPtr, word, numBytes), envPtr);
stackDepth--;
}
} else {
valAndFlags = HPINT_MIN;
TclCompileTokens(interp, incrTokenPtr+1,
incrTokenPtr->numComponents, envPtr);
stackDepth--;
}
} else { /* no incr amount given so use 1 */
valAndFlags = (1 << 2);
}
if (!isScalar) {
valAndFlags |= VM_VAR_ARRAY;
}
/*
* Emit the instruction to increment the variable.
*/
TclEmitInst2(INST_INCR, valAndFlags, localIndex, envPtr);
TclSetStackDepth((stackDepth+1), envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileLappendCmd --
*
* Procedure called to compile the "lappend" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "lappend" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileLappendCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
int numWords;
int flags =(TCL_APPEND_VALUE|TCL_LIST_ELEMENT|TCL_TRACE_READS);
/*
* If we're not in a procedure, don't compile.
*/
if (envPtr->procPtr == NULL) {
return TCL_ERROR;
}
numWords = parsePtr->numWords;
if (numWords == 1) {
return TCL_ERROR;
}
if (numWords != 3) {
/*
* LAPPEND instructions currently only handle one value appends
*/
return TCL_ERROR;
}
return CompileSetCmdInternal(interp, parsePtr, envPtr, flags);
}
/*
*----------------------------------------------------------------------
*
* TclCompileLassignCmd --
*
* Procedure called to compile the "lassign" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "lassign" command
* at runtime.
*
*----------------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
1594 1595 1596 1597 1598 1599 1600 |
int simpleVarName, isScalar, localIndex, numWords, idx;
numWords = parsePtr->numWords;
/*
* Check for command syntax error, but we'll punt that to runtime
*/
if (numWords < 3) {
| | > > > > > > > < < | < < < > < < < < < < < | < < | < < < | > > > | | < < | | > | | < < < | < < < | < < | | < < | | | < | < > | < | | 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 |
int simpleVarName, isScalar, localIndex, numWords, idx;
numWords = parsePtr->numWords;
/*
* Check for command syntax error, but we'll punt that to runtime
*/
if (numWords < 3) {
return TCL_ERROR;
}
/*
* Check that the number of variables to be assigned is small enough
*/
if (numWords > HPUINT_MAX) {
return TCL_ERROR;
}
/*
* Generate code to push list being taken apart by [lassign].
*/
tokenPtr = parsePtr->tokenPtr + (parsePtr->tokenPtr->numComponents + 1);
CompileWord(envPtr, tokenPtr, interp);
/*
* Generate code to assign values from the list to variables
*/
for (idx=0 ; idx<numWords-2 ; idx++) {
int flags = (TCL_LEAVE_ERR_MSG|VM_VAR_OMIT_PUSH);
tokenPtr += tokenPtr->numComponents + 1;
/*
* Generate the next variable name
*/
PushVarName(interp, tokenPtr, envPtr, TCL_CREATE_VAR,
&localIndex, &simpleVarName, &isScalar);
if (localIndex < 0) {
localIndex = HPUINT_MAX;
}
if (isScalar || !simpleVarName) {
if ((localIndex & HP_MASK) != HPUINT_MAX) {
TclEmitInst0(INST_DUP, envPtr);
} else {
TclEmitInst1(INST_OVER, 1, envPtr);
}
} else {
flags |= VM_VAR_ARRAY;
if ((localIndex & HP_MASK) != HPUINT_MAX) {
TclEmitInst1(INST_OVER, 1, envPtr);
} else {
TclEmitInst1(INST_OVER, 2, envPtr);
}
}
TclEmitInst1(INST_LIST_INDEX_IMM, idx, envPtr);
TclEmitInst2(INST_STORE, flags, localIndex, envPtr);
}
/*
* Generate code to leave the rest of the list on the stack.
* Note that -2 == "end"
*/
TclEmitInst2(INST_LIST_RANGE_IMM, -2, idx, envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileLindexCmd --
*
* Procedure called to compile the "lindex" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "lindex" command
* at runtime.
*
*----------------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
1705 1706 1707 1708 1709 1710 1711 |
numWords = parsePtr->numWords;
/*
* Quit if too few args
*/
if (numWords <= 1) {
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < | < < < | < < | | | | < < < < | < < | | | < < < < < | < < < < < | | | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 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 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 |
numWords = parsePtr->numWords;
/*
* Quit if too few args
*/
if (numWords <= 1) {
return TCL_ERROR;
}
varTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
if ((numWords == 3) && (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) &&
TclLooksLikeInt(varTokenPtr[1].start, varTokenPtr[1].size)) {
Tcl_Obj *tmpObj;
int idx;
tmpObj = Tcl_NewStringObj(varTokenPtr[1].start, varTokenPtr[1].size);
if (Tcl_GetIntFromObj(NULL, tmpObj, &idx) == TCL_OK && idx >= 0) {
TclDecrRefCount(tmpObj);
varTokenPtr += varTokenPtr->numComponents + 1;
/*
* All checks have been completed, and we have exactly
* this construct:
* lindex <posInt> <arbitraryValue>
* This is best compiled as a push of the arbitrary value
* followed by an "immediate lindex" which is the most
* efficient variety.
*/
CompileWord(envPtr, varTokenPtr, interp);
TclEmitInst1(INST_LIST_INDEX_IMM, idx, envPtr);
return TCL_OK;
} else {
/*
* If the conversion failed or the value was negative, we
* just keep on going with the more complex compilation.
*/
TclDecrRefCount(tmpObj);
}
}
/*
* Push the operands onto the stack.
*/
for (i=1 ; i<numWords ; i++) {
CompileWord(envPtr, varTokenPtr, interp);
varTokenPtr += varTokenPtr->numComponents + 1;
}
/*
* Emit INST_LIST_INDEX if objc==3, or INST_LIST_INDEX_MULTI
* if there are multiple index args.
*/
if (numWords == 3) {
TclEmitInst0(INST_LIST_INDEX, envPtr);
} else {
TclEmitInst1(INST_LIST_INDEX_MULTI, numWords-1, envPtr);
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileListCmd --
*
* Procedure called to compile the "list" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "list" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileListCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
/*
* If we're not in a procedure, don't compile.
*/
if (envPtr->procPtr == NULL) {
return TCL_ERROR;
}
if (parsePtr->numWords == 1) {
/*
* Empty args case
*/
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
} else {
/*
* Push the all values onto the stack.
*/
Tcl_Token *valueTokenPtr;
int i, numWords;
numWords = parsePtr->numWords;
valueTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
for (i = 1; i < numWords; i++) {
CompileWord(envPtr, valueTokenPtr, interp);
valueTokenPtr = valueTokenPtr + (valueTokenPtr->numComponents + 1);
}
TclEmitInst1(INST_LIST, numWords - 1, envPtr);
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileLlengthCmd --
*
* Procedure called to compile the "llength" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "llength" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileLlengthCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
}
varTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
CompileWord(envPtr, varTokenPtr, interp);
TclEmitInst0(INST_LIST_LENGTH, envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileLsetCmd --
*
* Procedure called to compile the "lset" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "lset" command
* at runtime.
*
* The general template for execution of the "lset" command is:
* (1) Instructions to push the variable name, unless the
|
| ︙ | ︙ | |||
1888 1889 1890 1891 1892 1893 1894 | * (6) At this point, the stack contains: * varName? arrayElementName? index1 index2 ... newValue oldList * The compiler emits one of INST_LSET_FLAT or INST_LSET_LIST * according as whether there is exactly one index element (LIST) * or either zero or else two or more (FLAT). This instruction * removes everything from the stack except for the two names * and pushes the new value of the variable. | | > | | > > > > < | < < < < < | | | | > | > < < < < < < | < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < | < < < < < < < < < < < < | | 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 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 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 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 |
* (6) At this point, the stack contains:
* varName? arrayElementName? index1 index2 ... newValue oldList
* The compiler emits one of INST_LSET_FLAT or INST_LSET_LIST
* according as whether there is exactly one index element (LIST)
* or either zero or else two or more (FLAT). This instruction
* removes everything from the stack except for the two names
* and pushes the new value of the variable.
* (7) Finally, INST_STORE stores the new value in the variable
* and cleans up the stack.
*
*----------------------------------------------------------------------
*/
int
TclCompileLsetCmd(interp, parsePtr, envPtr)
Tcl_Interp* interp; /* Tcl interpreter for error reporting */
Tcl_Parse* parsePtr; /* Points to a parse structure for
* the command */
CompileEnv* envPtr; /* Holds the resulting instructions */
{
int tempDepth; /* Depth used for emitting one part
* of the code burst. */
Tcl_Token* varTokenPtr; /* Pointer to the Tcl_Token representing
* the parse of the variable name */
int localIndex; /* Index of var in local var table */
int simpleVarName; /* Flag == 1 if var name is simple */
int isScalar; /* Flag == 1 if scalar, 0 if array */
int i;
int varFlags = TCL_LEAVE_ERR_MSG;
/* Check argument count */
if (parsePtr->numWords < 3) {
/* Fail at run time, not in compilation */
return TCL_ERROR;
}
/*
* Decide if we can use a frame slot for the var/array name or if we
* need to emit code to compute and push the name at runtime. We use a
* frame slot (entry in the array of local vars) if we are compiling a
* procedure body and if the name is simple text that does not include
* namespace qualifiers.
*/
varTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
PushVarName(interp, varTokenPtr, envPtr, TCL_CREATE_VAR,
&localIndex, &simpleVarName, &isScalar);
if (localIndex < 0) {
localIndex = HPUINT_MAX;
}
/* Push the "index" args and the new element value. */
for (i=2 ; i<parsePtr->numWords ; ++i) {
/* Advance to next arg */
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
/* Push an arg */
CompileWord(envPtr, varTokenPtr, interp);
}
/*
* Duplicate the variable name if it's been pushed.
*/
if (!simpleVarName || ((localIndex & HP_MASK) == HPUINT_MAX)) {
if (!simpleVarName || isScalar) {
tempDepth = parsePtr->numWords - 2;
} else {
tempDepth = parsePtr->numWords - 1;
}
TclEmitInst1(INST_OVER, tempDepth, envPtr);
}
/*
* Duplicate an array index if one's been pushed
*/
if (simpleVarName && !isScalar) {
if ((localIndex & HP_MASK) == HPUINT_MAX) {
tempDepth = parsePtr->numWords - 1;
} else {
tempDepth = parsePtr->numWords - 2;
}
TclEmitInst1(INST_OVER, tempDepth, envPtr);
varFlags |= VM_VAR_ARRAY;
}
/*
* Emit code to load the variable's value, the correct variety of 'lset'
* instruction and put the value back in the variable.
*/
TclEmitInst2(INST_LOAD, varFlags, localIndex, envPtr);
if (parsePtr->numWords == 4) {
TclEmitInst0(INST_LSET_LIST, envPtr);
} else {
TclEmitInst1(INST_LSET_FLAT, (parsePtr->numWords - 1), envPtr);
}
TclEmitInst2(INST_STORE, varFlags, localIndex, envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileRegexpCmd --
*
* Procedure called to compile the "regexp" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "regexp" command
* at runtime.
*
*----------------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
2072 2073 2074 2075 2076 2077 2078 |
/*
* We are only interested in compiling simple regexp cases.
* Currently supported compile cases are:
* regexp ?-nocase? ?--? staticString $var
* regexp ?-nocase? ?--? {^staticString$} $var
*/
if (parsePtr->numWords < 3) {
| | | | | | | 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 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 |
/*
* We are only interested in compiling simple regexp cases.
* Currently supported compile cases are:
* regexp ?-nocase? ?--? staticString $var
* regexp ?-nocase? ?--? {^staticString$} $var
*/
if (parsePtr->numWords < 3) {
return TCL_ERROR;
}
nocase = 0;
varTokenPtr = parsePtr->tokenPtr;
/*
* We only look for -nocase and -- as options. Everything else
* gets pushed to runtime execution. This is different than regexp's
* runtime option handling, but satisfies our stricter needs.
*/
for (i = 1; i < parsePtr->numWords - 2; i++) {
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
/* Not a simple string - punt to runtime. */
return TCL_ERROR;
}
str = (char *) varTokenPtr[1].start;
len = varTokenPtr[1].size;
if ((len == 2) && (str[0] == '-') && (str[1] == '-')) {
i++;
break;
} else if ((len > 1)
&& (strncmp(str, "-nocase", (unsigned) len) == 0)) {
nocase = 1;
} else {
/* Not an option we recognize. */
return TCL_ERROR;
}
}
if ((parsePtr->numWords - i) != 2) {
/* We don't support capturing to variables */
return TCL_ERROR;
}
/*
* Get the regexp string. If it is not a simple string, punt to runtime.
* If it has a '-', it could be an incorrectly formed regexp command.
*/
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
str = (char *) varTokenPtr[1].start;
len = varTokenPtr[1].size;
if ((varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) || (*str == '-')) {
return TCL_ERROR;
}
if (len == 0) {
/*
* The semantics of regexp are always match on re == "".
*/
TclEmitPush(TclRegisterNewLiteral(envPtr, "1", 1), envPtr);
|
| ︙ | ︙ | |||
2176 2177 2178 2179 2180 2181 2182 |
* Don't do anything with REs with other special chars. Also check if
* this is a bad RE (do this at the end because it can be expensive).
* If so, let it complain at runtime.
*/
if ((strpbrk(str + start, "*+?{}()[].\\|^$") != NULL)
|| (Tcl_RegExpCompile(NULL, str) == NULL)) {
ckfree((char *) str);
| | | 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 |
* Don't do anything with REs with other special chars. Also check if
* this is a bad RE (do this at the end because it can be expensive).
* If so, let it complain at runtime.
*/
if ((strpbrk(str + start, "*+?{}()[].\\|^$") != NULL)
|| (Tcl_RegExpCompile(NULL, str) == NULL)) {
ckfree((char *) str);
return TCL_ERROR;
}
if (anchorLeft && anchorRight) {
TclEmitPush(TclRegisterNewLiteral(envPtr, str+start, len-start),
envPtr);
} else {
/*
|
| ︙ | ︙ | |||
2208 2209 2210 2211 2212 2213 2214 |
}
ckfree((char *) str);
/*
* Push the string arg
*/
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
| < < < < | < | < | | | | 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 |
}
ckfree((char *) str);
/*
* Push the string arg
*/
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
CompileWord(envPtr, varTokenPtr, interp);
if (anchorLeft && anchorRight && !nocase) {
TclEmitInst0(INST_STR_EQ, envPtr);
} else {
TclEmitInst1(INST_STR_MATCH, nocase, envPtr);
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileReturnCmd --
*
* Procedure called to compile the "return" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "return" command
* at runtime.
*
*----------------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
2303 2304 2305 2306 2307 2308 2309 |
if (TCL_ERROR == status) {
/*
* Something was bogus in the return options. Clear the
* error message, and report back to the compiler that this
* must be interpreted at runtime.
*/
Tcl_ResetResult(interp);
| | > > > > > < < | < < < < < < > | | | | | < < < | | < | > | > > > | | | | < | < | > > > > > > > > > > > | > > > > > > > > > > > | | | < < | | | < < < < < | | | | < < < < < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < | | 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 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 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 |
if (TCL_ERROR == status) {
/*
* Something was bogus in the return options. Clear the
* error message, and report back to the compiler that this
* must be interpreted at runtime.
*/
Tcl_ResetResult(interp);
return TCL_ERROR;
}
if ((HPINT_MIN > code) || (code > HPINT_MAX)
|| (level > HPUINT_MAX)) {
Tcl_ResetResult(interp);
return TCL_ERROR;
}
/*
* All options are known at compile time, so we're going to bytecompile.
* Emit instructions to push the result on the stack
*/
if (explicitResult) {
CompileWord(envPtr, wordTokenPtr, interp);
} else {
/* No explict result argument, so default result is empty string */
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
}
/*
* Check for optimization: When [return] is in a proc, and there's
* no enclosing [catch], and there are no return options, then the
* INST_DONE instruction is equivalent, and may be more efficient.
*/
if (numOptionWords == 0) {
/* We have default return options... */
if (envPtr->procPtr != NULL) {
/* ... and we're in a proc ... */
if (!envPtr->catchDepth) {
/* ... and there is no enclosing catch. */
Tcl_DecrRefCount(returnOpts);
TclEmitInst0(INST_DONE, envPtr);
return TCL_OK;
}
}
} else if ((numOptionWords == 4) && (level == 0)) {
if (code == TCL_BREAK) {
Tcl_DecrRefCount(returnOpts);
TclEmitInst1(INST_BREAK, envPtr->exceptArrayCurr, envPtr);
return TCL_OK;
} else if (code == TCL_CONTINUE) {
Tcl_DecrRefCount(returnOpts);
TclEmitInst1(INST_CONTINUE, envPtr->exceptArrayCurr, envPtr);
return TCL_OK;
}
}
/*
* Could not use the optimization, so we push the return options
* dictionary, and emit the INST_RETURN instruction with code
* and level as operands.
*/
TclEmitPush(TclAddLiteralObj(envPtr, returnOpts, NULL), envPtr);
TclEmitInst2(INST_RETURN, code, level, envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileSetCmd --
*
* Procedure called to compile the "set" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "set" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileSetCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
return CompileSetCmdInternal(interp, parsePtr, envPtr, 0);
}
int
CompileSetCmdInternal(interp, parsePtr, envPtr, varFlags)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
int varFlags;
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int isAssignment, isScalar, simpleVarName, localIndex, numWords;
numWords = parsePtr->numWords;
if ((numWords != 2) && (numWords != 3)) {
return TCL_ERROR;
}
isAssignment = (numWords == 3);
/*
* Decide if we can use a frame slot for the var/array name or if we
* need to emit code to compute and push the name at runtime. We use a
* frame slot (entry in the array of local vars) if we are compiling a
* procedure body and if the name is simple text that does not include
* namespace qualifiers.
*/
varTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
PushVarName(interp, varTokenPtr, envPtr, TCL_CREATE_VAR,
&localIndex, &simpleVarName, &isScalar);
if (isScalar) {
varFlags |= TCL_LEAVE_ERR_MSG;
} else {
varFlags |= (TCL_LEAVE_ERR_MSG|VM_VAR_ARRAY);
}
if (localIndex < 0) {
localIndex = HPUINT_MAX;
}
if (isAssignment) {
/*
* If we are doing an assignment, push the new value and store it.
*/
valueTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
CompileWord(envPtr, valueTokenPtr, interp);
TclEmitInst2(INST_STORE, varFlags, localIndex, envPtr);
} else {
/*
* Reading the variable's value.
*/
TclEmitInst2(INST_LOAD, varFlags, localIndex, envPtr);
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileStringCmd --
*
* Procedure called to compile the "string" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "string" command
* at runtime.
*
*----------------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
2521 2522 2523 2524 2525 2526 2527 |
STR_REPLACE, STR_TOLOWER, STR_TOUPPER, STR_TOTITLE,
STR_TRIM, STR_TRIMLEFT, STR_TRIMRIGHT,
STR_WORDEND, STR_WORDSTART
};
if (parsePtr->numWords < 2) {
/* Fail at run time, not in compilation */
| | | | 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 |
STR_REPLACE, STR_TOLOWER, STR_TOUPPER, STR_TOTITLE,
STR_TRIM, STR_TRIMLEFT, STR_TRIMRIGHT,
STR_WORDEND, STR_WORDSTART
};
if (parsePtr->numWords < 2) {
/* Fail at run time, not in compilation */
return TCL_ERROR;
}
opTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
opObj = Tcl_NewStringObj(opTokenPtr->start, opTokenPtr->size);
if (Tcl_GetIndexFromObj(interp, opObj, options, "option", 0,
&index) != TCL_OK) {
Tcl_DecrRefCount(opObj);
Tcl_ResetResult(interp);
return TCL_ERROR;
}
Tcl_DecrRefCount(opObj);
varTokenPtr = opTokenPtr + (opTokenPtr->numComponents + 1);
switch ((enum options) index) {
case STR_BYTELENGTH:
|
| ︙ | ︙ | |||
2557 2558 2559 2560 2561 2562 2563 | case STR_TRIMLEFT: case STR_TRIMRIGHT: case STR_WORDEND: case STR_WORDSTART: /* * All other cases: compile out of line. */ | | | < < < < | < < | | < < < < | < < | | | | | | < < | < | | < | < | | | | > > > > > > > < < < < < < < > | > | > | < < < | < | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < < > > > > > > > > > > | < | > > | > > > > > | | | | < > | < > > | > | > > | | < < > > > | | < < | | > > | < > > > > > | < > | | | | 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 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 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 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 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 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 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 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 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 2741 2742 2743 2744 2745 2746 2747 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 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 2856 2857 2858 2859 |
case STR_TRIMLEFT:
case STR_TRIMRIGHT:
case STR_WORDEND:
case STR_WORDSTART:
/*
* All other cases: compile out of line.
*/
return TCL_ERROR;
case STR_COMPARE:
case STR_EQUAL: {
int i;
/*
* If there are any flags to the command, we can't byte compile it
* because the INST_STR_EQ bytecode doesn't support flags.
*/
if (parsePtr->numWords != 4) {
return TCL_ERROR;
}
/*
* Push the two operands onto the stack.
*/
for (i = 0; i < 2; i++) {
CompileWord(envPtr, varTokenPtr, interp);
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
}
TclEmitInst0(((((enum options) index) == STR_COMPARE) ?
INST_STR_CMP : INST_STR_EQ), envPtr);
return TCL_OK;
}
case STR_INDEX: {
int i;
if (parsePtr->numWords != 4) {
/* Fail at run time, not in compilation */
return TCL_ERROR;
}
/*
* Push the two operands onto the stack.
*/
for (i = 0; i < 2; i++) {
CompileWord(envPtr, varTokenPtr, interp);
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
}
TclEmitInst0(INST_STR_INDEX, envPtr);
return TCL_OK;
}
case STR_LENGTH: {
if (parsePtr->numWords != 3) {
/* Fail at run time, not in compilation */
return TCL_ERROR;
}
if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
/*
* Here someone is asking for the length of a static string.
* Just push the actual character (not byte) length.
*/
char buf[TCL_INTEGER_SPACE];
int len = Tcl_NumUtfChars(varTokenPtr[1].start,
varTokenPtr[1].size);
len = sprintf(buf, "%d", len);
TclEmitPush(TclRegisterNewLiteral(envPtr, buf, len), envPtr);
return TCL_OK;
} else {
TclCompileTokens(interp, varTokenPtr+1,
varTokenPtr->numComponents, envPtr);
}
TclEmitInst0(INST_STR_LEN, envPtr);
return TCL_OK;
}
case STR_MATCH: {
int i, length, exactMatch = 0, nocase = 0;
CONST char *str;
if (parsePtr->numWords < 4 || parsePtr->numWords > 5) {
/* Fail at run time, not in compilation */
return TCL_ERROR;
}
if (parsePtr->numWords == 5) {
if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
return TCL_ERROR;
}
str = varTokenPtr[1].start;
length = varTokenPtr[1].size;
if ((length > 1) &&
strncmp(str, "-nocase", (size_t) length) == 0) {
nocase = 1;
} else {
/* Fail at run time, not in compilation */
return TCL_ERROR;
}
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
}
for (i = 0; i < 2; i++) {
if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
str = varTokenPtr[1].start;
length = varTokenPtr[1].size;
if (!nocase && (i == 0)) {
/*
* Trivial matches can be done by 'string equal'.
* If -nocase was specified, we can't do this
* because INST_STR_EQ has no support for nocase.
*/
Tcl_Obj *copy = Tcl_NewStringObj(str, length);
Tcl_IncrRefCount(copy);
exactMatch = TclMatchIsTrivial(Tcl_GetString(copy));
Tcl_DecrRefCount(copy);
}
TclEmitPush(
TclRegisterNewLiteral(envPtr, str, length), envPtr);
} else {
TclCompileTokens(interp, varTokenPtr+1,
varTokenPtr->numComponents, envPtr);
}
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
}
if (exactMatch) {
TclEmitInst0(INST_STR_EQ, envPtr);
} else {
TclEmitInst1(INST_STR_MATCH, nocase, envPtr);
}
return TCL_OK;
}
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclCompileSwitchCmd --
*
* Procedure called to compile the "switch" command.
*
* Results:
* Returns TCL_OK for successful compile, or TCL_ERROR
* to defer evaluation to runtime (either when it is too complex
* to get the semantics right, or when we know for sure that it
* is an error but need the error to happen at the right time).
*
* Side effects:
* Instructions are added to envPtr to execute the "switch" command
* at runtime.
*
* FIXME:
* Stack depths are probably not calculated correctly.
*
*----------------------------------------------------------------------
*/
int
TclCompileSwitchCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr; /* Pointer to tokens in command */
int numWords; /* Number of words in command */
Tcl_Token *valueTokenPtr; /* Token for the value to switch on. */
enum {Switch_Exact, Switch_Glob} 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 foundDefault; /* Flag to indicate whether a "default"
* clause is present. */
int *fallThroughArray; /* Array of forward-jump offsets for
* fall-through. */
int *endOffsetArray; /* Array of forward-jump offsets for jumps to
* the end. */
int currentFallThroughs; /* Counter for fall-throughs in process. */
int endJumpCounter; /* Counter for jumps to the end. */
int lastFalseJump; /* Offset of the last branch on match
* failure. */
int savedStackDepth = envPtr->currStackDepth;
int noCase;
int i, j;
/*
* Only handle the following versions:
* switch -- word {pattern body ...}
* switch -exact -- word {pattern body ...}
* switch -glob -- word {pattern body ...}
* switch -- word simpleWordPattern simpleWordBody ...
* switch -exact -- word simpleWordPattern simpleWordBody ...
* switch -glob -- word simpleWordPattern simpleWordBody ...
*/
tokenPtr = parsePtr->tokenPtr;
numWords = parsePtr->numWords;
/*
* We don't care how the command's word was generated; we're
* compiling it anyway!
*/
tokenPtr += tokenPtr->numComponents + 1;
numWords--;
/*
* Check for options. There must be at least one, --, because
* without that there is no way to statically avoid the problems
* you get from strings-to-match that start with a - (the
* interpreted code falls apart if it encounters them, so we punt
* if we *might* encounter them as that is the easiest way of
* emulating the behaviour).
*/
noCase = 0;
mode = Switch_Exact;
for (; numWords>=3 ; tokenPtr+=2,numWords--) {
register unsigned size = tokenPtr[1].size;
register CONST char *chrs = tokenPtr[1].start;
/*
* We only process literal options, and we assume that -e, -g
* and -n are unique prefixes of -exact, -glob and -nocase
* respectively (true at time of writing).
*/
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || size < 2) {
return TCL_ERROR;
}
if ((size <= 6) && !memcmp(chrs, "-exact", size)) {
mode = Switch_Exact;
continue;
} else if ((size <= 5) && !memcmp(chrs, "-glob", size)) {
mode = Switch_Glob;
continue;
} else if ((size <= 7) && !memcmp(chrs, "-nocase", size)) {
noCase = 1;
continue;
} else if ((size == 2) && !memcmp(chrs, "--", 2)) {
break;
}
/*
* The switch command has many flags we cannot compile at all
* (e.g. all the RE-related ones) which we must have
* encountered. Either that or we have run off the end. The
* action here is the same: punt to interpreted version.
*/
return TCL_ERROR;
}
if (numWords < 3) {
return TCL_ERROR;
}
tokenPtr += 2;
numWords--;
if (noCase && (mode == Switch_Exact)) {
/*
* Can't compile this case!
*/
return TCL_ERROR;
}
/*
* The value to test against is going to always get pushed on the
* stack. But not yet; we need to verify that the rest of the
* command is compilable too.
*/
valueTokenPtr = tokenPtr;
tokenPtr += tokenPtr->numComponents + 1;
numWords--;
/*
* Build an array of tokens for the matcher terms and script
* bodies. Note that in the case of the quoted bodies, this is
* tricky as we cannot use copies of the string from the input
* token for the generated tokens (it causes a crash during
* exception handling). When multiple tokens are available at this
* point, this is pretty easy.
*/
if (numWords == 1) {
Tcl_DString bodyList;
CONST char **argv = NULL;
int isTokenBraced;
CONST char *tokenStartPtr;
/*
* Test that we've got a suitable body list as a simple (i.e.
* braced) word, and that the elements of the body are simple
* words too. This is really rather nasty indeed.
*/
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
return TCL_ERROR;
}
Tcl_DStringInit(&bodyList);
Tcl_DStringAppend(&bodyList, tokenPtr[1].start, tokenPtr[1].size);
if (Tcl_SplitList(NULL, Tcl_DStringValue(&bodyList), &numWords,
&argv) != TCL_OK) {
Tcl_DStringFree(&bodyList);
return TCL_ERROR;
}
Tcl_DStringFree(&bodyList);
if (numWords == 0 || numWords % 2) {
ckfree((char *) argv);
return TCL_ERROR;
}
bodyTokenArray = (Tcl_Token *) ckalloc(sizeof(Tcl_Token) * numWords);
bodyToken = (Tcl_Token **) ckalloc(sizeof(Tcl_Token *) * numWords);
tokenStartPtr = tokenPtr[1].start;
while (isspace(UCHAR(*tokenStartPtr))) {
tokenStartPtr++;
}
if (*tokenStartPtr == '{') {
tokenStartPtr++;
isTokenBraced = 1;
} else {
isTokenBraced = 0;
}
for (i=0 ; i<numWords ; i++) {
bodyTokenArray[i].type = TCL_TOKEN_TEXT;
bodyTokenArray[i].start = tokenStartPtr;
bodyTokenArray[i].size = strlen(argv[i]);
bodyTokenArray[i].numComponents = 0;
bodyToken[i] = bodyTokenArray+i;
tokenStartPtr += bodyTokenArray[i].size;
/*
* Test to see if we have guessed the end of the word
* correctly; if not, we can't feed the real string to the
* sub-compilation engine, and we're then stuck and so
* have to punt out to doing everything at runtime.
*/
if ((isTokenBraced && *(tokenStartPtr++) != '}') ||
(tokenStartPtr < tokenPtr[1].start+tokenPtr[1].size
&& !isspace(UCHAR(*tokenStartPtr)))) {
ckfree((char *) argv);
ckfree((char *) bodyToken);
ckfree((char *) bodyTokenArray);
return TCL_ERROR;
}
while (isspace(UCHAR(*tokenStartPtr))) {
tokenStartPtr++;
if (tokenStartPtr >= tokenPtr[1].start+tokenPtr[1].size) {
break;
}
}
if (*tokenStartPtr == '{') {
tokenStartPtr++;
isTokenBraced = 1;
} else {
isTokenBraced = 0;
}
}
ckfree((char *)argv);
/*
* Check that we've parsed everything we thought we were going
* to parse. If not, something odd is going on and we should
* bail out.
*/
if (tokenStartPtr != tokenPtr[1].start+tokenPtr[1].size) {
ckfree((char *) bodyToken);
ckfree((char *) bodyTokenArray);
return TCL_ERROR;
}
} else if (numWords % 2 || numWords == 0) {
/*
* Odd number of words (>1) available, or no words at all
* available. Both are error cases, so punt and let the
* interpreted-version generate the error message. Note that
* the second case probably should get caught earlier, but
* it's easy to check here again anyway because it'd cause a
* nasty crash otherwise.
*/
return TCL_ERROR;
} else {
bodyToken = (Tcl_Token **) ckalloc(sizeof(Tcl_Token *) * numWords);
bodyTokenArray = NULL;
for (i=0 ; i<numWords ; i++) {
/*
* We only handle the very simplest case. Anything more
* complex is a good reason to go to the interpreted case
* anyway due to traces, etc.
*/
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD ||
tokenPtr->numComponents != 1) {
ckfree((char *) bodyToken);
return TCL_ERROR;
}
bodyToken[i] = tokenPtr+1;
tokenPtr += tokenPtr->numComponents+1;
}
}
/*
* Fall back to interpreted if the last body is a continuation
* (it's illegal, but this makes the error happen at the right
* time).
*/
if (bodyToken[numWords-1]->size == 1 &&
bodyToken[numWords-1]->start[0] == '-') {
ckfree((char *) bodyToken);
if (bodyTokenArray != NULL) {
ckfree((char *) bodyTokenArray);
}
return TCL_ERROR;
}
/*
* Now we commit to generating code; the parsing stage per se is
* done.
*
* First, we push the value we're matching against on the stack.
*/
TclCompileTokens(interp, valueTokenPtr+1, valueTokenPtr->numComponents,
envPtr);
/*
* Generate a test for each arm.
*/
fallThroughArray = (int *) ckalloc(sizeof(int) * numWords);
endOffsetArray = (int *) ckalloc(sizeof(int) * numWords);
lastFalseJump = -1;
currentFallThroughs = -1;
endJumpCounter = -1;
foundDefault = 0;
for (i=0 ; i<numWords ; i+=2) {
TclSetStackDepth((savedStackDepth+1), envPtr);
if (lastFalseJump != -1) {
TclSetJumpTarget(envPtr, lastFalseJump);
lastFalseJump = -1;
}
if (i!=numWords-2 || bodyToken[numWords-2]->size != 7 ||
memcmp(bodyToken[numWords-2]->start, "default", 7)) {
/*
* Generate the test for the arm. This code is slightly
* inefficient, but much simpler than the first version.
*/
TclCompileTokens(interp, bodyToken[i], 1, envPtr);
TclEmitInst1(INST_OVER, 1, envPtr);
switch (mode) {
case Switch_Exact:
TclEmitInst0(INST_STR_EQ, envPtr);
break;
case Switch_Glob:
TclEmitInst1(INST_STR_MATCH, noCase, envPtr);
break;
default:
Tcl_Panic("unknown switch mode: %d",mode);
}
/*
* Process fall-through clauses here...
*/
if (bodyToken[i+1]->size==1 && bodyToken[i+1]->start[0]=='-') {
currentFallThroughs++;
TclEmitForwardJump(envPtr, INST_JUMP_TRUE,
fallThroughArray[currentFallThroughs]);
continue;
}
TclEmitForwardJump(envPtr, INST_JUMP_FALSE, lastFalseJump);
} else {
/*
* Got a default clause; set a flag to inhibit the
* generation of the jump after the body and the cleanup
* of the intermediate value that we are switching
* against.
*
* Note that default clauses (which are always last
* clauses) cannot be fall-through clauses as well, since
* the last clause is never a fall-through clause (which
* we have already verified).
*/
foundDefault = 1;
}
/*
* Generate the body for the arm. This is guaranteed not to
* be a fall-through case, but it might have preceding
* fall-through cases, so we must process those first.
*/
for (j=0 ; j<=currentFallThroughs; j++) {
TclSetJumpTarget(envPtr, fallThroughArray[j]);
}
currentFallThroughs = -1;
TclEmitInst0(INST_POP, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
/*
* Now do the actual compilation.
*/
TclCompileCmdWord(interp, bodyToken[i+1], 1, envPtr);
if (!foundDefault) {
endJumpCounter++;
TclEmitForwardJump(envPtr, INST_JUMP,
endOffsetArray[endJumpCounter]);
}
}
ckfree((char *) bodyToken);
if (bodyTokenArray != NULL) {
ckfree((char *) bodyTokenArray);
}
/*
* Discard the value we are matching against unless we've had a
* default clause (in which case it will already be gone) and make
* the result of the command an empty string.
*/
if (lastFalseJump != -1) {
TclSetJumpTarget(envPtr, lastFalseJump);
}
if (!foundDefault) {
TclEmitInst0(INST_POP, envPtr);
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
}
/*
* Fix the jumps to the end.
*/
for (i=0 ; i<=endJumpCounter ; i++) {
TclSetJumpTarget(envPtr, endOffsetArray[i]);
}
ckfree((char *)fallThroughArray);
ckfree((char *)endOffsetArray);
TclSetStackDepth((savedStackDepth+1), envPtr);
return TCL_OK;
}
#if 0
****
/*
* Only handle the following versions:
* switch -- word {pattern body ...}
* switch -exact -- word {pattern body ...}
* switch -glob -- word {pattern body ...}
* switch -- word simpleWordPattern simpleWordBody ...
* switch -exact -- word simpleWordPattern simpleWordBody ...
* switch -glob -- word simpleWordPattern simpleWordBody ...
*/
tokenPtr = parsePtr->tokenPtr;
numWords = parsePtr->numWords;
/*
* We don't care how the command's word was generated; we're
* compiling it anyway!
*/
tokenPtr += tokenPtr->numComponents + 1;
numWords--;
/*
* Check for options. There must be at least one, --, because
* without that there is no way to statically avoid the problems
* you get from strings-to-match that start with a - (the
* interpreted code falls apart if it encounters them, so we punt
* if we *might* encounter them as that is the easiest way of
* emulating the behaviour).
*/
noCase = 0;
mode = Switch_Exact;
for (; numWords>=3 ; tokenPtr+=2,numWords--) {
register unsigned size = tokenPtr[1].size;
register CONST char *chrs = tokenPtr[1].start;
/*
* We only process literal options, and we assume that -e, -g
* and -n are unique prefixes of -exact, -glob and -nocase
* respectively (true at time of writing).
*/
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || size < 2) {
return TCL_ERROR;
}
if ((size <= 6) && !memcmp(chrs, "-exact", size)) {
mode = Switch_Exact;
continue;
} else if ((size <= 5) && !memcmp(chrs, "-glob", size)) {
mode = Switch_Glob;
continue;
} else if ((size <= 7) && !memcmp(chrs, "-nocase", size)) {
noCase = 1;
continue;
} else if ((size == 2) && !memcmp(chrs, "--", 2)) {
break;
}
/*
* The switch command has many flags we cannot compile at all
* (e.g. all the RE-related ones) which we must have
* encountered. Either that or we have run off the end. The
* action here is the same: punt to interpreted version.
*/
return TCL_ERROR;
}
if (numWords < 3) {
return TCL_ERROR;
}
tokenPtr += 2;
numWords--;
if (noCase && (mode == Switch_Exact)) {
/*
* Can't compile this case!
*/
return TCL_ERROR;
}
/*
* The value to test against is going to always get pushed on the
* stack. But not yet; we need to verify that the rest of the
* command is compilable too.
*/
valueTokenPtr = tokenPtr;
tokenPtr += tokenPtr->numComponents + 1;
numWords--;
/*
* Test that we've got a suitable body list as a simple (i.e.
* braced) word, and that the elements of the body are simple
* words too. This is really rather nasty indeed.
*/
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
return TCL_ERROR;
}
Tcl_DStringInit(&bodyList);
Tcl_DStringAppend(&bodyList, tokenPtr[1].start, tokenPtr[1].size);
if (Tcl_SplitList(NULL, Tcl_DStringValue(&bodyList), &argc,
&argv) != TCL_OK) {
Tcl_DStringFree(&bodyList);
return TCL_ERROR;
}
Tcl_DStringFree(&bodyList);
if (argc == 0 || argc % 2) {
ckfree((char *)argv);
return TCL_ERROR;
}
bodyTokenArray = (Tcl_Token *) ckalloc(sizeof(Tcl_Token) * argc);
tokenStartPtr = tokenPtr[1].start;
while (isspace(UCHAR(*tokenStartPtr))) {
tokenStartPtr++;
}
if (*tokenStartPtr == '{') {
|
| ︙ | ︙ | |||
2867 2868 2869 2870 2871 2872 2873 |
* correctly; if not, we can't feed the real string to the
* sub-compilation engine, and we're then stuck and so have to
* punt out to doing everything at runtime.
*/
if (isTokenBraced && *(tokenStartPtr++) != '}') {
ckfree((char *)argv);
ckfree((char *)bodyTokenArray);
| | | < | | | < | | > | | < < > | > > > > | | | | < < | < | | < < | | < < < > | | > < < | | | | | > > < < > | < | < < > > > > > | < | < < < < | < | < < < < < < < < < < < < | | | < < | | < > | | | 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 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 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 |
* correctly; if not, we can't feed the real string to the
* sub-compilation engine, and we're then stuck and so have to
* punt out to doing everything at runtime.
*/
if (isTokenBraced && *(tokenStartPtr++) != '}') {
ckfree((char *)argv);
ckfree((char *)bodyTokenArray);
return TCL_ERROR;
}
if ((tokenStartPtr < tokenPtr[1].start+tokenPtr[1].size)
&& !isspace(UCHAR(*tokenStartPtr))) {
ckfree((char *)argv);
ckfree((char *)bodyTokenArray);
return TCL_ERROR;
}
while (isspace(UCHAR(*tokenStartPtr))) {
tokenStartPtr++;
if (tokenStartPtr >= tokenPtr[1].start+tokenPtr[1].size) {
break;
}
}
if (*tokenStartPtr == '{') {
tokenStartPtr++;
isTokenBraced = 1;
} else {
isTokenBraced = 0;
}
}
if (tokenStartPtr != tokenPtr[1].start+tokenPtr[1].size) {
ckfree((char *)argv);
ckfree((char *)bodyTokenArray);
return TCL_ERROR;
}
/*
* Complain if the last body is a continuation. Note that this
* check assumes that the list is non-empty!
*/
if (argc>0 && argv[argc-1][0]=='-' && argv[argc-1]=='\0') {
ckfree((char *)argv);
ckfree((char *)bodyTokenArray);
return TCL_ERROR;
}
/*
* Now we commit to generating code; the parsing stage per se is
* done.
*
* First, we push the value we're matching against on the stack.
*/
if (valueTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
TclEmitPush(TclRegisterNewLiteral(envPtr, valueTokenPtr[1].start,
valueTokenPtr[1].size), envPtr);
} else {
TclCompileTokens(interp, valueTokenPtr+1,
valueTokenPtr->numComponents, envPtr);
}
/*
* Generate a test for each arm.
*/
fallThroughArray = (int *) ckalloc(sizeof(int) * argc);
endOffsetArray = (int *) ckalloc(sizeof(int) * argc);
lastFalseJump = -1;
currentFallThroughs = -1;
endJumpCounter = -1;
foundDefault = 0;
for (i=0 ; i<argc ; i+=2) {
/*
* Generate the test for the arm.
*/
TclSetStackDepth((savedStackDepth+1), envPtr);
if (lastFalseJump != -1) {
TclSetJumpTarget(envPtr, lastFalseJump);
lastFalseJump = -1;
}
if (argv[i][0]!='d' || strcmp(argv[i], "default") || i!=argc-2) {
switch (mode) {
case Switch_Exact:
TclEmitInst0(INST_DUP, envPtr);
TclEmitPush(TclRegisterNewLiteral(envPtr, argv[i],
(int) strlen(argv[i])), envPtr);
TclEmitInst0(INST_STR_EQ, envPtr);
break;
case Switch_Glob:
TclEmitPush(TclRegisterNewLiteral(envPtr, argv[i],
(int) strlen(argv[i])), envPtr);
TclEmitInst1(INST_OVER, 1, envPtr);
TclEmitInst1(INST_STR_MATCH, /*nocase*/0, envPtr);
break;
default:
Tcl_Panic("unknown switch mode: %d",mode);
}
/*
* Process fall-through clauses here...
*/
if (argv[i+1][0]=='-' && argv[i+1][1]=='\0') {
currentFallThroughs++;
TclEmitForwardJump(envPtr, INST_JUMP_TRUE,
fallThroughArray[currentFallThroughs]);
continue;
} else {
TclEmitForwardJump(envPtr, INST_JUMP_FALSE, lastFalseJump);
}
} else {
/*
* Got a default clause; set a flag.
*/
foundDefault = 1;
/*
* Note that default clauses (which are always last
* clauses) cannot be fall-through clauses as well,
* because the last clause is never a fall-through clause.
*/
}
/*
* Generate the body for the arm. This is guaranteed not to
* be a fall-through case, but it might have preceding
* fall-through cases, so we must process those first. We also pop the
* the value we're matching against.
*/
for (j=0 ; j<=currentFallThroughs; j++) {
TclSetJumpTarget(envPtr, fallThroughArray[j]);
}
currentFallThroughs = -1;
TclEmitInst0(INST_POP, envPtr);
TclSetStackDepth((savedStackDepth), envPtr);
/*
* Now do the actual compilation.
*/
TclCompileCmdWord(interp, bodyTokenArray+i+1, 1, envPtr);
if (!foundDefault) {
endJumpCounter++;
TclEmitForwardJump(envPtr, INST_JUMP,
endOffsetArray[endJumpCounter]);
}
}
ckfree((char *)argv);
ckfree((char *)bodyTokenArray);
/*
* Discard the value we are matching against unless we've had a
* default clause (in which case it will already be gone) and make
* the result of the command an empty string.
*/
if (lastFalseJump != -1) {
TclSetJumpTarget(envPtr, lastFalseJump);
}
TclSetStackDepth((savedStackDepth+1), envPtr);
if (!foundDefault) {
TclEmitInst0(INST_POP, envPtr);
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
}
/*
* Fix the jumps to the end.
*/
for (i=0 ; i<=endJumpCounter ; i++) {
TclSetJumpTarget(envPtr, endOffsetArray[i]);
}
ckfree((char *)fallThroughArray);
ckfree((char *)endOffsetArray);
return TCL_OK;
}
#endif
/*
*----------------------------------------------------------------------
*
* TclCompileVariableCmd --
*
* Procedure called to reserve the local variables for the
* "variable" command. The command itself is *not* compiled.
*
* Results:
* Always returns TCL_ERROR.
*
* Side effects:
* Indexed local variables are added to the environment.
*
*----------------------------------------------------------------------
*/
int
TclCompileVariableCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int i, numWords;
CONST char *varName, *tail;
if (envPtr->procPtr == NULL) {
return TCL_ERROR;
}
numWords = parsePtr->numWords;
varTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
for (i = 1; i < numWords; i += 2) {
|
| ︙ | ︙ | |||
3116 3117 3118 3119 3120 3121 3122 |
tail++;
}
(void) TclFindCompiledLocal(tail, (tail-varName+1),
/*create*/ 1, /*flags*/ 0, envPtr->procPtr);
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
}
}
| | | | | | | 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 |
tail++;
}
(void) TclFindCompiledLocal(tail, (tail-varName+1),
/*create*/ 1, /*flags*/ 0, envPtr->procPtr);
varTokenPtr = varTokenPtr + (varTokenPtr->numComponents + 1);
}
}
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* TclCompileWhileCmd --
*
* Procedure called to compile the "while" command.
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "while" command
* at runtime.
*
*----------------------------------------------------------------------
*/
int
TclCompileWhileCmd(interp, parsePtr, envPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Parse *parsePtr; /* Points to a parse structure for the
* command created by Tcl_ParseCommand. */
CompileEnv *envPtr; /* Holds resulting instructions. */
{
Tcl_Token *testTokenPtr, *bodyTokenPtr;
int jumpEvalCondOffset = 0; /* lint */
int testCodeOffset, bodyCodeOffset, jumpDist;
int range, code;
int savedStackDepth = envPtr->currStackDepth;
int loopMayEnd = 1; /* This is set to 0 if it is recognized as
* an infinite loop. */
Tcl_Obj *boolObj;
int boolVal;
if (parsePtr->numWords != 3) {
return TCL_ERROR;
}
/*
* If the test expression requires substitutions, don't compile the
* while command inline. E.g., the expression might cause the loop to
* never execute or execute forever, as in "while "$x < 5" {}".
*
* Bail out also if the body expression requires substitutions
* in order to insure correct behaviour [Bug 219166]
*/
testTokenPtr = parsePtr->tokenPtr
+ (parsePtr->tokenPtr->numComponents + 1);
bodyTokenPtr = testTokenPtr + (testTokenPtr->numComponents + 1);
if ((testTokenPtr->type != TCL_TOKEN_SIMPLE_WORD)
|| (bodyTokenPtr->type != TCL_TOKEN_SIMPLE_WORD)) {
return TCL_ERROR;
}
/*
* Find out if the condition is a constant.
*/
boolObj = Tcl_NewStringObj(testTokenPtr[1].start, testTokenPtr[1].size);
|
| ︙ | ︙ | |||
3200 3201 3202 3203 3204 3205 3206 |
* Compile no bytecodes.
*/
goto pushResult;
}
}
| < < < < < < < < < < | > | | > > > > | > > > > > > > > | > | < < < < | | < | | < < < < | < < < > < | < | | < > | 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 |
* Compile no bytecodes.
*/
goto pushResult;
}
}
/*
* Jump to the evaluation of the condition. This code uses the "loop
* rotation" optimisation (which eliminates one branch from the loop).
* "while cond body" produces then:
* goto A
* B: body : bodyCodeOffset
* A: cond -> result : testCodeOffset, continueOffset
* if (result) goto B
*
* The infinite loop "while 1 body" produces:
* B: body : all three offsets here
* goto B
*/
if (loopMayEnd) {
TclEmitForwardJump(envPtr, INST_JUMP, jumpEvalCondOffset);
testCodeOffset = 0; /* avoid compiler warning */
} else {
testCodeOffset = (envPtr->codeNext - envPtr->codeStart);
}
/*
* Compile the loop body.
*/
range = TclBeginExceptRange(envPtr);
bodyCodeOffset = (envPtr->codeNext - envPtr->codeStart);
TclCompileCmdWord(interp, bodyTokenPtr+1,
bodyTokenPtr->numComponents, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
/*
* Avoid compiling a PUSH/POP for loops like 'while 1 {}'
*/
if (((envPtr->codeNext - envPtr->codeStart) == bodyCodeOffset + 1)
&& (TclVMGetInstAtPtr(envPtr->codeNext-1) == INST_PUSH)) {
envPtr->codeNext--;
TclEndExceptRange(range, envPtr);
if (!loopMayEnd) {
goto finish;
}
} else {
TclEndExceptRange(range, envPtr);
TclEmitInst0(INST_POP, envPtr);
}
/*
* Compile the test expression then emit the conditional jump that
* terminates the while. We already know it's a simple word.
*/
if (loopMayEnd) {
testCodeOffset = (envPtr->codeNext - envPtr->codeStart);
TclSetJumpTarget(envPtr, jumpEvalCondOffset);
TclSetStackDepth((savedStackDepth), envPtr);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
TclSetStackDepth((savedStackDepth+1), envPtr);
jumpDist = (envPtr->codeNext - envPtr->codeStart) - bodyCodeOffset;
TclEmitInst1(INST_JUMP_TRUE, -jumpDist, envPtr);
} else {
jumpDist = (envPtr->codeNext - envPtr->codeStart) - bodyCodeOffset;
TclEmitInst1(INST_JUMP, -jumpDist, envPtr);
}
/*
* Set the loop's body, continue and break offsets.
*/
finish:
envPtr->exceptArrayPtr[range].continueOffset = testCodeOffset;
envPtr->exceptArrayPtr[range].breakOffset =
(envPtr->codeNext - envPtr->codeStart);
/*
* The while command's result is an empty string.
*/
pushResult:
TclSetStackDepth((savedStackDepth), envPtr);
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* PushVarName --
*
* Procedure used in the compiling where pushing a variable name
* is necessary (append, lappend, set).
*
* Results:
* Returns TCL_OK for a successful compile.
* Returns TCL_ERROR to defer evaluation to runtime.
*
* Side effects:
* Instructions are added to envPtr to execute the "set" command
* at runtime.
*
*----------------------------------------------------------------------
*/
static int
PushVarName(interp, varTokenPtr, envPtr, flags, localIndexPtr,
simpleVarNamePtr, isScalarPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Token *varTokenPtr; /* Points to a variable token. */
CompileEnv *envPtr; /* Holds resulting instructions. */
int flags; /* takes TCL_CREATE_VAR */
int *localIndexPtr; /* must not be NULL */
int *simpleVarNamePtr; /* must not be NULL */
int *isScalarPtr; /* must not be NULL */
{
register CONST char *p;
CONST char *name, *elName;
register int i, n;
int nameChars, elNameChars, simpleVarName, localIndex;
Tcl_Token *elemTokenPtr = NULL;
int elemTokenCount = 0;
int allocedTokens = 0;
int removedParen = 0;
int stackDepth = envPtr->currStackDepth;
/*
* Decide if we can use a frame slot for the var/array name or if we
* need to emit code to compute and push the name at runtime. We use a
* frame slot (entry in the array of local vars) if we are compiling a
* procedure body and if the name is simple text that does not include
* namespace qualifiers.
|
| ︙ | ︙ | |||
3488 3489 3490 3491 3492 3493 3494 |
* proc frame. If retrieving the var's value and it doesn't already
* exist, push its name and look it up at runtime.
*/
if ((envPtr->procPtr != NULL) && !hasNsQualifiers) {
localIndex = TclFindCompiledLocal(name, nameChars,
/*create*/ (flags & TCL_CREATE_VAR),
| | | > > > > | 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 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 |
* proc frame. If retrieving the var's value and it doesn't already
* exist, push its name and look it up at runtime.
*/
if ((envPtr->procPtr != NULL) && !hasNsQualifiers) {
localIndex = TclFindCompiledLocal(name, nameChars,
/*create*/ (flags & TCL_CREATE_VAR),
/*flags*/ ((elName==NULL)? 0 : VAR_ARRAY),
envPtr->procPtr);
if (localIndex >= HPUINT_MAX) {
/* we'll push the name */
localIndex = -1;
}
}
if (localIndex < 0) {
TclEmitPush(TclRegisterNewLiteral(envPtr, name, nameChars), envPtr);
stackDepth++;
}
/*
* Compile the element script, if any.
*/
if (elName != NULL) {
if (elNameChars) {
TclCompileTokens(interp, elemTokenPtr, elemTokenCount, envPtr);
} else {
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
}
stackDepth++;
}
} else {
/*
* The var name isn't simple: compile and push it.
*/
TclCompileTokens(interp, varTokenPtr+1,
varTokenPtr->numComponents, envPtr);
stackDepth++;
}
if (removedParen) {
++varTokenPtr[removedParen].size;
}
if (allocedTokens) {
ckfree((char *) elemTokenPtr);
}
*localIndexPtr = localIndex;
*simpleVarNamePtr = simpleVarName;
*isScalarPtr = (elName == NULL);
TclSetStackDepth(stackDepth, envPtr);
return TCL_OK;
}
|
Changes to generic/tclCompExpr.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclCompExpr.c -- * * This file contains the code to compile Tcl expressions. * * Copyright (c) 1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclCompExpr.c -- * * This file contains the code to compile Tcl expressions. * * Copyright (c) 1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclCompExpr.c,v 1.25.4.4 2005/06/13 01:45:45 msofer Exp $ */ #include "tclInt.h" #include "tclCompile.h" /* * The stuff below is a bit of a hack so that this file can be used in |
| ︙ | ︙ | |||
272 273 274 275 276 277 278 | /* * Attempt to convert the primary's object to an int or double. * This is done in order to support Tcl's policy of interpreting * operands if at all possible as first integers, else * floating-point numbers. */ | | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
/*
* Attempt to convert the primary's object to an int or double.
* This is done in order to support Tcl's policy of interpreting
* operands if at all possible as first integers, else
* floating-point numbers.
*/
TclEmitInst0(INST_TRY_CVT_TO_NUMERIC, envPtr);
}
Tcl_FreeParse(&parse);
done:
return code;
}
|
| ︙ | ︙ | |||
455 456 457 458 459 460 461 |
if (opDescPtr->numOperands == 2) {
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
}
| | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
if (opDescPtr->numOperands == 2) {
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
}
TclEmitInst0(opDescPtr->instruction, envPtr);
infoPtr->hasOperators = 1;
break;
}
/*
* The operator requires special treatment, and is either
* "+" or "-", or one of "&&", "||" or "?".
|
| ︙ | ︙ | |||
482 483 484 485 486 487 488 |
/*
* Check whether the "+" or "-" is unary.
*/
afterSubexprPtr = exprTokenPtr
+ exprTokenPtr->numComponents+1;
if (tokenPtr == afterSubexprPtr) {
| | | | 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 |
/*
* Check whether the "+" or "-" is unary.
*/
afterSubexprPtr = exprTokenPtr
+ exprTokenPtr->numComponents+1;
if (tokenPtr == afterSubexprPtr) {
TclEmitInst0(((opIndex==OP_PLUS)?
INST_UPLUS : INST_UMINUS),
envPtr);
break;
}
/*
* The "+" or "-" is binary.
*/
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
TclEmitInst0(((opIndex==OP_PLUS)? INST_ADD : INST_SUB),
envPtr);
break;
case OP_LAND:
case OP_LOR:
code = CompileLandOrLorExpr(exprTokenPtr, opIndex,
infoPtr, envPtr, &endPtr);
|
| ︙ | ︙ | |||
582 583 584 585 586 587 588 |
ExprInfo *infoPtr; /* Describes the compilation state for the
* expression being compiled. */
CompileEnv *envPtr; /* Holds resulting instructions. */
Tcl_Token **endPtrPtr; /* If successful, a pointer to the token
* just after the last token in the
* subexpression is stored here. */
{
| | | | | | | | | < < < | < | < < | | | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
ExprInfo *infoPtr; /* Describes the compilation state for the
* expression being compiled. */
CompileEnv *envPtr; /* Holds resulting instructions. */
Tcl_Token **endPtrPtr; /* If successful, a pointer to the token
* just after the last token in the
* subexpression is stored here. */
{
int shortCircuitOffset; /* Used to fix up the short circuit jump
* after the first subexpression. */
int shortCircuitOffset2;/* Used to fix up the second jump to the
* short-circuit target. */
int endOffset; /* Used to fix up jump to the end. */
Tcl_Token *tokenPtr;
int code;
int savedStackDepth = envPtr->currStackDepth;
/*
* Emit code for the first operand.
*/
tokenPtr = exprTokenPtr+2;
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
/*
* Emit the short-circuit jump.
*/
TclEmitForwardJump(envPtr,
((opIndex==OP_LAND)? INST_JUMP_FALSE : INST_JUMP_TRUE),
shortCircuitOffset);
/*
* Emit code for the second operand.
*/
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
/*
* The result is the boolean value of the second operand. We
* code this in a somewhat contorted manner to be able to reuse
* the shortCircuit value and save one INST_JUMP.
*/
TclEmitForwardJump(envPtr,
((opIndex==OP_LAND)? INST_JUMP_FALSE : INST_JUMP_TRUE),
shortCircuitOffset2);
if (opIndex == OP_LAND) {
TclEmitPush(TclRegisterNewLiteral(envPtr, "1", 1), envPtr);
} else {
TclEmitPush(TclRegisterNewLiteral(envPtr, "0", 1), envPtr);
}
TclEmitForwardJump(envPtr, INST_JUMP, endOffset);
/*
* Fixup the short-circuit jumps and push the shortCircuit value.
* Note that shortCircuitFixup2 is always a short jump.
*/
TclSetJumpTarget(envPtr, shortCircuitOffset2);
TclSetJumpTarget(envPtr, shortCircuitOffset);
if (opIndex == OP_LAND) {
TclEmitPush(TclRegisterNewLiteral(envPtr, "0", 1), envPtr);
} else {
TclEmitPush(TclRegisterNewLiteral(envPtr, "1", 1), envPtr);
}
TclSetJumpTarget(envPtr, endOffset);
*endPtrPtr = tokenPtr;
done:
TclSetStackDepth((savedStackDepth+1), envPtr);
return code;
}
/*
*----------------------------------------------------------------------
*
* CompileCondExpr --
|
| ︙ | ︙ | |||
697 698 699 700 701 702 703 |
ExprInfo *infoPtr; /* Describes the compilation state for the
* expression being compiled. */
CompileEnv *envPtr; /* Holds resulting instructions. */
Tcl_Token **endPtrPtr; /* If successful, a pointer to the token
* just after the last token in the
* subexpression is stored here. */
{
| | | | | | | > > > > > | | < | < < < < < < < < < < < < < < < | | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 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 |
ExprInfo *infoPtr; /* Describes the compilation state for the
* expression being compiled. */
CompileEnv *envPtr; /* Holds resulting instructions. */
Tcl_Token **endPtrPtr; /* If successful, a pointer to the token
* just after the last token in the
* subexpression is stored here. */
{
int jumpAroundThenOffset, jumpAroundElseOffset;
/* Used to update or replace one-byte jumps
* around the then and else expressions when
* their target PCs are determined. */
Tcl_Token *tokenPtr;
int elseCodeOffset, code;
int savedStackDepth = envPtr->currStackDepth;
/*
* Emit code for the test.
*/
tokenPtr = exprTokenPtr+2;
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
/*
* Emit the jump to the "else" expression if the test was false.
*/
TclEmitForwardJump(envPtr, INST_JUMP_FALSE, jumpAroundThenOffset);
/*
* Compile the "then" expression. Note that if a subexpression is only
* a primary, we need to try to convert it to numeric. We do this to
* support Tcl's policy of interpreting operands if at all possible as
* first integers, else floating-point numbers.
*/
infoPtr->hasOperators = 0;
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
if (!infoPtr->hasOperators) {
TclEmitInst0(INST_TRY_CVT_TO_NUMERIC, envPtr);
}
/*
* Emit an unconditional jump around the "else" condExpr.
*/
TclEmitForwardJump(envPtr, INST_JUMP,jumpAroundElseOffset);
/*
* Fix up the first jump to the "else" expression if the test was false.
*/
TclSetJumpTarget(envPtr, jumpAroundThenOffset);
/*
* Compile the "else" expression.
*/
TclSetStackDepth((savedStackDepth), envPtr);
elseCodeOffset = (envPtr->codeNext - envPtr->codeStart);
infoPtr->hasOperators = 0;
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
if (!infoPtr->hasOperators) {
TclEmitInst0(INST_TRY_CVT_TO_NUMERIC, envPtr);
}
/*
* Fix up the second jump around the "else" expression.
*/
TclSetJumpTarget(envPtr, jumpAroundElseOffset);
*endPtrPtr = tokenPtr;
done:
TclSetStackDepth((savedStackDepth+1), envPtr);
return code;
}
/*
*----------------------------------------------------------------------
*
* CompileMathFuncCall --
|
| ︙ | ︙ | |||
824 825 826 827 828 829 830 |
ExprInfo *infoPtr; /* Describes the compilation state for the
* expression being compiled. */
CompileEnv *envPtr; /* Holds resulting instructions. */
Tcl_Token **endPtrPtr; /* If successful, a pointer to the token
* just after the last token in the
* subexpression is stored here. */
{
| | | < < > | | | > > > | < < > | < | < < < | < < < | < | < > > < < | < | < < < | | < > | | | < < < < < | < < < < < < < < < < | < < < < < < < < | < < | < < < < < < < < | | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 |
ExprInfo *infoPtr; /* Describes the compilation state for the
* expression being compiled. */
CompileEnv *envPtr; /* Holds resulting instructions. */
Tcl_Token **endPtrPtr; /* If successful, a pointer to the token
* just after the last token in the
* subexpression is stored here. */
{
Tcl_DString cmdName;
int objIndex;
Tcl_Token *tokenPtr, *afterSubexprPtr;
int argCount;
int code = TCL_OK;
/*
* Prepend "tcl::mathfunc::" to the function name, to produce the
* name of a command that evaluates the function. Push that
* command name on the stack, in a literal registered to the
* namespace so that resolution can be cached.
*/
Tcl_DStringInit( &cmdName );
Tcl_DStringAppend( &cmdName, "tcl::mathfunc::", -1 );
Tcl_DStringAppend( &cmdName, funcName, -1 );
objIndex = TclRegisterNewNSLiteral( envPtr,
Tcl_DStringValue( &cmdName ),
Tcl_DStringLength( &cmdName ) );
TclEmitPush( objIndex, envPtr );
Tcl_DStringFree( &cmdName );
/*
* Compile any arguments for the function.
*/
argCount = 1;
tokenPtr = exprTokenPtr+2;
afterSubexprPtr = exprTokenPtr + (exprTokenPtr->numComponents + 1);
while (tokenPtr != afterSubexprPtr) {
++argCount;
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
return code;
}
tokenPtr += (tokenPtr->numComponents + 1);
}
/* Invoke the function */
TclEmitInst1( INST_INVOKE_STK, argCount, envPtr );
*endPtrPtr = afterSubexprPtr;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* LogSyntaxError --
*
|
| ︙ | ︙ |
Changes to generic/tclCompile.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
/*
* tclCompile.c --
*
* This file contains procedures that compile Tcl commands or parts
* of commands (like quoted strings or nested sub-commands) into a
* sequence of instructions ("bytecodes").
*
* Copyright (c) 1996-1998 Sun Microsystems, Inc.
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
| > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
/*
* tclCompile.c --
*
* This file contains procedures that compile Tcl commands or parts
* of commands (like quoted strings or nested sub-commands) into a
* sequence of instructions ("bytecodes").
*
* Copyright (c) 1996-1998 Sun Microsystems, Inc.
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
* Copyright (c) 2005 by Miguel Sofer. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclCompile.c,v 1.81.2.26 2005/10/10 17:59:38 msofer Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
/*
* Table of all AuxData types.
|
| ︙ | ︙ | |||
47 48 49 50 51 52 53 | * first operand. Similarly, "stktop" and "stknext" refer to the topmost * and next to topmost stack elements. * * Note that the load, store, and incr instructions do not distinguish local * from global variables; the bytecode interpreter at runtime uses the * existence of a procedure call frame to distinguish these. */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > | > > > > > > > > > > > > > > > > | | < < < < | < > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 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 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 |
* first operand. Similarly, "stktop" and "stknext" refer to the topmost
* and next to topmost stack elements.
*
* Note that the load, store, and incr instructions do not distinguish local
* from global variables; the bytecode interpreter at runtime uses the
* existence of a procedure call frame to distinguish these.
*/
/*
* NOTE: the stack effects of expandStkTop and invokeExpanded
* are wrong - but it cannot be done right at compile time, the stack
* effect is only known at run time. The value for invokeExpanded
* is estimated better at compile time.
* See the comments further down in this file, where INST_INVOKE_EXPANDED
* is emitted.
*/
InstructionDesc tclInstructionTable[] = {
/* Name stack Itype Otype #Opnds Operand types */
/* Opcodes for stack management */
{"push", +1, V, A, 1, {OPERAND_UINT}},
/* Push object at ByteCode objArray[op4] */
{"pop", -1, V, V, 0, {OPERAND_NONE}},
/* Pop the topmost stack object */
{"dup", +1, A, A, 0, {OPERAND_NONE}},
/* Duplicate the topmost stack object and push the result */
{"over", +1, A, A, 1, {OPERAND_UINT}},
/* Duplicate the arg-th element from top of stack (TOS=0) */
/* Opcodes for command building and invocation*/
{"concat", INT_MIN, A, A, 1, {OPERAND_UINT}},
/* Concatenate the top op1 items and push result */
{"invoke", INT_MIN, A, A, 1, {OPERAND_UINT}},
/* Invoke command named objv[0]; <objc,objv> = <op4,top op4> */
{"evalStk", 0, A, A, 0, {OPERAND_NONE}},
/* Evaluate command in stktop using Tcl_EvalObj. */
{"exprStk", 0, A, N, 0, {OPERAND_NONE}},
/* Execute expression in stktop using Tcl_ExprStringObj. */
{"expandStart", 0, V, V, 0, {OPERAND_NONE}},
/* Start of command with {expand}ed arguments */
{"expandStkTop", 0, A, A, 1, {OPERAND_INT}},
/* Expand the list at stacktop: push its elements on the stack */
{"invokeExpanded", 0, A, A, 0, {OPERAND_NONE}},
/* Invoke the command marked by the last 'expandStart' */
{"startCmd", 0, V, V, 1, {OPERAND_OFFSET}},
/* Start of bytecoded command: op is the length of the cmd's code */
/* Opcodes for variable access. */
{"load", +1, A, A, 2, {OPERAND_INT, OPERAND_UINT}},
/* Load variable according to the operands*/
{"loadScalar", +1, A, A, 2, {OPERAND_INT, OPERAND_UINT}},
/* Load local scalar variable according to the operands*/
{"store", 0, A, A, 2, {OPERAND_INT, OPERAND_UINT}},
/* Store at variable according to the operands */
{"storeScalar", 0, A, A, 2, {OPERAND_INT, OPERAND_UINT}},
/* Store at local scalar variable according to the operands */
{"incr", 1, I, I, 2, {OPERAND_INT, OPERAND_UINT}},
/* Incr variable according to the operands */
/* Opcodes for flow control and conditional branching (comparisons jump if
* true) */
{"done", -1, A, V, 0, {OPERAND_NONE}},
/* Finish ByteCode execution and return stktop (top stack item) */
{"return", -1, A, V, 2, {OPERAND_INT, OPERAND_UINT}},
/* Compiled [return], code, level are operands; options and result
* are on the stack. */
{"break", 0, V, V, 1, {OPERAND_INT}},
/* Abort closest enclosing loop; if none, return TCL_BREAK code. */
{"continue", 0, V, V, 1, {OPERAND_INT}},
/* Skip to next iteration of closest enclosing loop; if none,
* return TCL_CONTINUE code. */
{"foreach_start", 0, V, V, 1, {OPERAND_INT}},
/* Initialize execution of a foreach loop. Operand is aux data index
* of the ForeachInfo structure for the foreach command. */
{"foreach_step", +1, V, A, 1, {OPERAND_INT}},
/* "Step" or begin next iteration of foreach loop. Push 0 if to
* terminate loop, else push 1. */
{"beginCatch", 0, V, V, 1, {OPERAND_OFFSET}},
/* Record start of catch with the operand's exception index.
* Push the current stack depth onto a special catch stack. */
{"endCatch", 0, V, I, 1, {OPERAND_INT}},
/* End of last catch. Pop the bytecode interpreter's catch stack. */
{"jump", 0, V, V, 1, {OPERAND_OFFSET}},
/* Jump relative to (pc + op4) */
{"jumpTrue", -1, B, V, 1, {OPERAND_OFFSET}},
/* Jump relative to (pc + op4) if stktop expr object is true */
{"jumpFalse", -1, B, V, 1, {OPERAND_OFFSET}},
/* Jump relative to (pc + op4) if stktop expr object is false */
{"eq", -1, N, B, 1, {OPERAND_OFFSET}},
/* Equal: push (stknext == stktop) */
{"neq", -1, N, B, 1, {OPERAND_OFFSET}},
/* Not equal: push (stknext != stktop) */
{"lt", -1, N, B, 1, {OPERAND_OFFSET}},
/* Less: push (stknext < stktop) */
{"ge", -1, N, B, 1, {OPERAND_OFFSET}},
/* Logical or: push (stknext || stktop) */
{"gt", -1, N, B, 1, {OPERAND_OFFSET}},
/* Greater: push (stknext || stktop) */
{"le", -1, N, B, 1, {OPERAND_OFFSET}},
/* Logical or: push (stknext || stktop) */
{"streq", -1, A, B, 1, {OPERAND_OFFSET}},
/* Str Equal: push (stknext eq stktop) */
{"strneq", -1, A, B, 1, {OPERAND_OFFSET}},
/* Str !Equal: push (stknext neq stktop) */
{"listIn", -1, A, B, 1, {OPERAND_OFFSET}},
/* List containment: push [lsearch stktop stknext]>=0) */
{"listNotIn", -1, A, B, 1, {OPERAND_OFFSET}},
/* List negated containment: push [lsearch stktop stknext]<0) */
/* Opcodes for the remaining operators */
{"not", 0, B, B, 0, {OPERAND_NONE}},
/* Logical not: push !stktop */
{"yes", 0, B, B, 0, {OPERAND_NONE}},
/* Logical not-not: push !!stktop */
{"bitor", -1, I, I, 0, {OPERAND_NONE}},
/* Bitwise or: push (stknext | stktop) */
{"bitxor", -1, I, I, 0, {OPERAND_NONE}},
/* Bitwise xor push (stknext ^ stktop) */
{"bitand", -1, I, I, 0, {OPERAND_NONE}},
/* Bitwise and: push (stknext & stktop) */
{"lshift", -1, I, I, 0, {OPERAND_NONE}},
/* Left shift: push (stknext << stktop) */
{"rshift", -1, I, I, 0, {OPERAND_NONE}},
/* Right shift: push (stknext >> stktop) */
{"add", -1, N, N, 0, {OPERAND_NONE}},
/* Add: push (stknext + stktop) */
{"sub", -1, N, N, 0, {OPERAND_NONE}},
/* Sub: push (stkext - stktop) */
{"mult", -1, N, N, 0, {OPERAND_NONE}},
/* Multiply: push (stknext * stktop) */
{"div", -1, N, N, 0, {OPERAND_NONE}},
/* Divide: push (stknext / stktop) */
{"mod", -1, I, I, 0, {OPERAND_NONE}},
/* Mod: push (stknext % stktop) */
{"uplus", 0, N, N, 0, {OPERAND_NONE}},
/* Unary plus: push +stktop */
{"uminus", 0, N, N, 0, {OPERAND_NONE}},
/* Unary minus: push -stktop */
{"bitnot", 0, I, I, 0, {OPERAND_NONE}},
/* Bitwise not: push ~stktop */
{"expon", -1, N, N, 0, {OPERAND_NONE}},
/* Binary exponentiation operator: push (stknext ** stktop) */
{"callBuiltinFunc", 1, N, N, 1, {OPERAND_UINT}},
/* Call builtin math function with index op1; any args are on stk */
{"callFunc", INT_MIN, N, N, 1, {OPERAND_UINT}},
/* Call non-builtin func objv[0]; <objc,objv>=<op1,top op1> */
{"tryCvtToNumeric", 0, N, N, 0, {OPERAND_NONE}},
/* Try converting stktop to first int then double if possible. */
{"strcmp", -1, A, I, 0, {OPERAND_NONE}},
/* Str Compare: push (stknext cmp stktop) */
{"strlen", 0, A, I, 0, {OPERAND_NONE}},
/* Str Length: push (strlen stktop) */
{"strindex", -1, A, A, 0, {OPERAND_NONE}},
/* Str Index: push (strindex stknext stktop) */
{"strmatch", -1, A, B, 1, {OPERAND_INT}},
/* Str Match: push (strmatch stknext stktop) opnd == nocase */
{"list", INT_MIN, A, A, 1, {OPERAND_UINT}},
/* List: push (stk1 stk2 ... stktop) */
{"listIndex", -1, A, A, 0, {OPERAND_NONE}},
/* List Index: push (listindex stknext stktop) */
{"listLength", 0, A, I, 0, {OPERAND_NONE}},
/* List Len: push (listlength stktop) */
{"lindexMulti", INT_MIN, A, A, 1, {OPERAND_UINT}},
/* Lindex with generalized args, operand is number of stacked objs
* used: (operand-1) entries from stktop are the indices; then list
* to process. */
{"lsetList", -2, A, A, 0, {OPERAND_NONE}},
/* Four-arg version of 'lset'. stktop is old value; next is
* new element value, next is the index list; pushes new value */
{"lsetFlat", INT_MIN, A, A, 1, {OPERAND_UINT}},
/* Three- or >=5-arg version of 'lset', operand is number of
* stacked objs: stktop is old value, next is new element value, next
* come (operand-2) indices; pushes the new value.
*/
{"listIndexImm", 0, A, A, 1, {OPERAND_IDX}},
/* List Index: push (lindex stktop op4) */
{"listRangeImm", 0, A, A, 2, {OPERAND_IDX, OPERAND_IDX}},
/* List Range: push (lrange stktop op4 op4) */
{0}
};
/*
* Prototypes for procedures defined later in this file:
*/
static void DupByteCodeInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr));
static unsigned char * EncodeCmdLocMap _ANSI_ARGS_((
CompileEnv *envPtr, ByteCode *codePtr,
unsigned char *startPtr));
static void EnterCmdExtentData _ANSI_ARGS_((
CompileEnv *envPtr, int cmdNumber,
int numSrcBytes, int numCodeWords));
static void EnterCmdStartData _ANSI_ARGS_((
CompileEnv *envPtr, int cmdNumber,
int srcOffset, int codeOffset));
static void FreeByteCodeInternalRep _ANSI_ARGS_((
Tcl_Obj *objPtr));
static int GetCmdLocEncodingSize _ANSI_ARGS_((
CompileEnv *envPtr));
#ifdef TCL_COMPILE_STATS
static void RecordByteCodeStats _ANSI_ARGS_((
ByteCode *codePtr));
#endif /* TCL_COMPILE_STATS */
static int SetByteCodeFromAny _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
/*
* The structure below defines the bytecode Tcl object type by
* means of procedures that can be invoked by generic object code.
*/
Tcl_ObjType tclByteCodeType = {
|
| ︙ | ︙ | |||
402 403 404 405 406 407 408 |
TclInitCompileEnv(interp, &compEnv, stringPtr, length);
TclCompileScript(interp, stringPtr, length, &compEnv);
/*
* Successful compilation. Add a "done" instruction at the end.
*/
| | > | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
TclInitCompileEnv(interp, &compEnv, stringPtr, length);
TclCompileScript(interp, stringPtr, length, &compEnv);
/*
* Successful compilation. Add a "done" instruction at the end.
*/
TclEmitInst0(INST_DONE, &compEnv);
/*
* Invoke the compilation hook procedure if one exists.
*/
if (hookProc) {
result = (*hookProc)(interp, &compEnv, clientData);
}
|
| ︙ | ︙ | |||
427 428 429 430 431 432 433 |
TclInitByteCodeObj(objPtr, &compEnv);
#ifdef TCL_COMPILE_DEBUG
if (tclTraceCompile >= 2) {
TclPrintByteCodeObj(interp, objPtr);
}
#endif /* TCL_COMPILE_DEBUG */
| | > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
TclInitByteCodeObj(objPtr, &compEnv);
#ifdef TCL_COMPILE_DEBUG
if (tclTraceCompile >= 2) {
TclPrintByteCodeObj(interp, objPtr);
}
#endif /* TCL_COMPILE_DEBUG */
#if VM_ENABLE_OPTIMISER
/*
* Invoke the bytecode optimiser.
*
* NOTES:
* - should this be invoked before, after or instead of the optional hook?
* - for now this is enabled at compile time; may be better to control
* it at the script level - either with a global variable or a new
* command.
*/
TclOptimiseByteCode(interp, objPtr);
#ifdef TCL_COMPILE_DEBUG
/*
* Print the optimised bytecodes too
*/
if (tclTraceCompile >= 2) {
TclPrintByteCodeObj(interp, objPtr);
fprintf(stdout, " --- Optimised Bytecode ---\n");
}
#endif /* TCL_COMPILE_DEBUG */
#endif
if (result != TCL_OK) {
/*
* Handle any error from the hookProc
*/
entryPtr = compEnv.literalArrayPtr;
for (i = 0; i < compEnv.literalArrayNext; i++) {
|
| ︙ | ︙ | |||
602 603 604 605 606 607 608 | statsPtr = &((Interp *) interp)->stats; statsPtr->numByteCodesFreed++; statsPtr->currentSrcBytes -= (double) codePtr->numSrcBytes; statsPtr->currentByteCodeBytes -= (double) codePtr->structureSize; | | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | statsPtr = &((Interp *) interp)->stats; statsPtr->numByteCodesFreed++; statsPtr->currentSrcBytes -= (double) codePtr->numSrcBytes; statsPtr->currentByteCodeBytes -= (double) codePtr->structureSize; statsPtr->currentInstBytes -= (double) (codePtr->numCodeWords*sizeof(TclVMWord)); statsPtr->currentLitBytes -= (double) (codePtr->numLitObjects * sizeof(Tcl_Obj *)); statsPtr->currentExceptBytes -= (double) (codePtr->numExceptRanges * sizeof(ExceptionRange)); statsPtr->currentAuxBytes -= (double) (codePtr->numAuxDataItems * sizeof(AuxData)); statsPtr->currentCmdMapBytes -= (double) codePtr->numCmdLocBytes; |
| ︙ | ︙ | |||
720 721 722 723 724 725 726 |
Interp *iPtr = (Interp *) interp;
envPtr->iPtr = iPtr;
envPtr->source = stringPtr;
envPtr->numSrcBytes = numBytes;
envPtr->procPtr = iPtr->compiledProcPtr;
envPtr->numCommands = 0;
| | | | > > | 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 |
Interp *iPtr = (Interp *) interp;
envPtr->iPtr = iPtr;
envPtr->source = stringPtr;
envPtr->numSrcBytes = numBytes;
envPtr->procPtr = iPtr->compiledProcPtr;
envPtr->numCommands = 0;
envPtr->catchDepth = 0;
envPtr->maxCatchDepth = 0;
envPtr->maxStackDepth = 0;
envPtr->currStackDepth = 0;
TclInitLiteralTable(&(envPtr->localLitTable));
envPtr->codeStart = envPtr->staticCodeSpace;
envPtr->codeNext = envPtr->codeStart;
envPtr->codeEnd = (envPtr->codeStart
+ COMPILEENV_INIT_CODE_WORDS);
envPtr->mallocedCodeArray = 0;
envPtr->literalArrayPtr = envPtr->staticLiteralSpace;
envPtr->literalArrayNext = 0;
envPtr->literalArrayEnd = COMPILEENV_INIT_NUM_OBJECTS;
envPtr->mallocedLiteralArray = 0;
envPtr->exceptArrayPtr = envPtr->staticExceptArraySpace;
envPtr->exceptArrayNext = 0;
envPtr->exceptArrayCurr = -1;
envPtr->exceptArrayEnd = COMPILEENV_INIT_EXCEPT_RANGES;
envPtr->mallocedExceptArray = 0;
envPtr->cmdMapPtr = envPtr->staticCmdMapSpace;
envPtr->cmdMapEnd = COMPILEENV_INIT_CMD_MAP_SIZE;
envPtr->mallocedCmdMap = 0;
|
| ︙ | ︙ | |||
911 912 913 914 915 916 917 |
Tcl_Parse parse;
int lastTopLevelCmdIndex = -1;
/* Index of most recent toplevel command in
* the command location table. Initialized
* to avoid compiler warning. */
int startCodeOffset = -1; /* Offset of first byte of current command's
* code. Init. to avoid compiler warning. */
| | > | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 |
Tcl_Parse parse;
int lastTopLevelCmdIndex = -1;
/* Index of most recent toplevel command in
* the command location table. Initialized
* to avoid compiler warning. */
int startCodeOffset = -1; /* Offset of first byte of current command's
* code. Init. to avoid compiler warning. */
TclVMWord *entryCodeNext = envPtr->codeNext;
CONST char *p, *next;
Namespace *cmdNsPtr;
Command *cmdPtr;
Tcl_Token *tokenPtr;
int bytesLeft, isFirstCmd, gotParse, wordIdx, currCmdIndex;
int commandLength, objIndex, code;
Tcl_DString ds;
int savedStackDepth = envPtr->currStackDepth;
Tcl_DStringInit(&ds);
if (numBytes < 0) {
numBytes = strlen(script);
}
Tcl_ResetResult(interp);
|
| ︙ | ︙ | |||
996 997 998 999 1000 1001 1002 |
/*
* If not the first command, pop the previous command's result
* and, if we're compiling a top level command, update the last
* command's code size to account for the pop instruction.
*/
if (!isFirstCmd) {
| | | > | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 |
/*
* If not the first command, pop the previous command's result
* and, if we're compiling a top level command, update the last
* command's code size to account for the pop instruction.
*/
if (!isFirstCmd) {
TclEmitInst0(INST_POP, envPtr);
envPtr->cmdMapPtr[lastTopLevelCmdIndex].numCodeWords =
(envPtr->codeNext - envPtr->codeStart)
- startCodeOffset;
}
TclSetStackDepth(savedStackDepth, envPtr);
/*
* Determine the actual length of the command.
*/
commandLength = parse.commandSize;
if (parse.term == parse.commandStart + commandLength - 1) {
|
| ︙ | ︙ | |||
1041 1042 1043 1044 1045 1046 1047 |
*/
for (wordIdx = 0, tokenPtr = parse.tokenPtr;
wordIdx < parse.numWords;
wordIdx++, tokenPtr += (tokenPtr->numComponents + 1)) {
if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
expand = 1;
| | | 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 |
*/
for (wordIdx = 0, tokenPtr = parse.tokenPtr;
wordIdx < parse.numWords;
wordIdx++, tokenPtr += (tokenPtr->numComponents + 1)) {
if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
expand = 1;
TclEmitInst0(INST_EXPAND_START, envPtr);
break;
}
}
envPtr->numCommands++;
currCmdIndex = (envPtr->numCommands - 1);
lastTopLevelCmdIndex = currCmdIndex;
|
| ︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 |
* in the compile env, as the check is done before
* calling TclExecuteByteCode(). Remark that we
* are compiling the first cmd in the environment
* exactly when (savedCodeNext == 0)
*/
if (savedCodeNext != 0) {
| | | | | | | | | > < < | 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 |
* in the compile env, as the check is done before
* calling TclExecuteByteCode(). Remark that we
* are compiling the first cmd in the environment
* exactly when (savedCodeNext == 0)
*/
if (savedCodeNext != 0) {
TclEmitInst1(INST_START_CMD, 0, envPtr);
}
code = (*(cmdPtr->compileProc))(interp, &parse,
envPtr);
if (code == TCL_OK) {
if (savedCodeNext != 0) {
/*
* Fix the bytecode length.
*/
TclVMWord *fixPtr = envPtr->codeStart
+ savedCodeNext ;
ptrdiff_t fixLen = envPtr->codeNext
- envPtr->codeStart
- savedCodeNext;
/*NOTE: depends on (VM_VAR_OMIT_PUSH == 1) */
TclVMStoreOpndAtPtr((fixLen << 1), fixPtr);
}
goto finishCommand;
} else {
/*
* Restore numCommands and codeNext to their
* correct values, removing any commands
* compiled before the failure to produce
* bytecode got reported.
* [Bugs 705406 and 735055]
*/
envPtr->numCommands = savedNumCmds;
envPtr->codeNext = envPtr->codeStart
+ savedCodeNext;
}
}
/*
* No compile procedure so push the word. If the
* command was found, push a CmdName object to
* reduce runtime lookups. Avoid sharing this literal
|
| ︙ | ︙ | |||
1176 1177 1178 1179 1180 1181 1182 |
* The word is not a simple string of characters.
*/
TclCompileTokens(interp, tokenPtr+1,
tokenPtr->numComponents, envPtr);
}
if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
| | | 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 |
* The word is not a simple string of characters.
*/
TclCompileTokens(interp, tokenPtr+1,
tokenPtr->numComponents, envPtr);
}
if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
TclEmitInst1(INST_EXPAND_STKTOP,
envPtr->currStackDepth, envPtr);
}
}
/*
* Emit an invoke instruction for the command. We skip this
* if a compile procedure was found for the command.
|
| ︙ | ︙ | |||
1203 1204 1205 1206 1207 1208 1209 | * and the result is pushed: the stack top changes by * (1-wordIdx). * Note that the estimates are not correct while the * command is being prepared and run, INST_EXPAND_STKTOP * is not stack-neutral in general. */ | | < | < < < | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 |
* and the result is pushed: the stack top changes by
* (1-wordIdx).
* Note that the estimates are not correct while the
* command is being prepared and run, INST_EXPAND_STKTOP
* is not stack-neutral in general.
*/
TclEmitInst0(INST_INVOKE_EXPANDED, envPtr);
TclAdjustStackDepth((1-wordIdx), envPtr);
} else if (wordIdx > 0) {
TclEmitInst1(INST_INVOKE_STK, wordIdx, envPtr);
}
/*
* Update the compilation environment structure and record the
* offsets of the source and code for the command.
*/
|
| ︙ | ︙ | |||
1249 1250 1251 1252 1253 1254 1255 |
* have special code in TclReleaseLiteral to handle this particular
* self-reference, but now opt for avoiding its creation altogether.
*/
if (envPtr->codeNext == entryCodeNext) {
TclEmitPush(TclAddLiteralObj(envPtr, Tcl_NewObj(), NULL), envPtr);
}
| | > | 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 |
* have special code in TclReleaseLiteral to handle this particular
* self-reference, but now opt for avoiding its creation altogether.
*/
if (envPtr->codeNext == entryCodeNext) {
TclEmitPush(TclAddLiteralObj(envPtr, Tcl_NewObj(), NULL), envPtr);
}
TclSetStackDepth((savedStackDepth+1), envPtr);
envPtr->numSrcBytes = (p - script);
Tcl_DStringFree(&ds);
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1290 1291 1292 1293 1294 1295 1296 |
{
Tcl_DString textBuffer; /* Holds concatenated chars from adjacent
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
char buffer[TCL_UTF_MAX];
CONST char *name, *p;
int numObjsToConcat, nameBytes, localVarName, localVar;
int length, i;
| | > > | | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 |
{
Tcl_DString textBuffer; /* Holds concatenated chars from adjacent
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
char buffer[TCL_UTF_MAX];
CONST char *name, *p;
int numObjsToConcat, nameBytes, localVarName, localVar;
int length, i;
TclVMWord *entryCodeNext = envPtr->codeNext;
int varFlags;
int stackDepth = envPtr->currStackDepth;
Tcl_DStringInit(&textBuffer);
numObjsToConcat = 0;
for ( ; count > 0; count--, tokenPtr++) {
switch (tokenPtr->type) {
case TCL_TOKEN_TEXT:
Tcl_DStringAppend(&textBuffer, tokenPtr->start,
tokenPtr->size);
|
| ︙ | ︙ | |||
1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 |
if (localVarName != -1) {
localVar = TclFindCompiledLocal(name, nameBytes,
localVarName, /*flags*/ 0, envPtr->procPtr);
}
if (localVar < 0) {
TclEmitPush(TclRegisterNewLiteral(envPtr, name, nameBytes),
envPtr);
}
/*
* Emit instructions to load the variable.
*/
| > | < < < < | < < < | < < < < < | > | < < > | | > | | 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 |
if (localVarName != -1) {
localVar = TclFindCompiledLocal(name, nameBytes,
localVarName, /*flags*/ 0, envPtr->procPtr);
}
if (localVar < 0) {
TclEmitPush(TclRegisterNewLiteral(envPtr, name, nameBytes),
envPtr);
localVar = HPUINT_MAX;
}
/*
* Emit instructions to load the variable.
*/
if (tokenPtr->numComponents != 1) {
int stackDepth = envPtr->currStackDepth;
TclCompileTokens(interp, tokenPtr+2,
tokenPtr->numComponents-1, envPtr);
TclSetStackDepth((stackDepth+1), envPtr);
varFlags = (TCL_LEAVE_ERR_MSG|VM_VAR_ARRAY);
} else {
varFlags = TCL_LEAVE_ERR_MSG;
}
TclEmitInst2(INST_LOAD, varFlags, localVar, envPtr);
numObjsToConcat++;
count -= tokenPtr->numComponents;
tokenPtr += tokenPtr->numComponents;
break;
default:
Tcl_Panic("Unexpected token type in TclCompileTokens");
}
}
/*
* Push any accumulated characters appearing at the end.
|
| ︙ | ︙ | |||
1440 1441 1442 1443 1444 1445 1446 |
numObjsToConcat++;
}
/*
* If necessary, concatenate the parts of the word.
*/
| < < < < | > | 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 |
numObjsToConcat++;
}
/*
* If necessary, concatenate the parts of the word.
*/
if (numObjsToConcat > 1) {
TclEmitInst1(INST_CONCAT, numObjsToConcat, envPtr);
}
/*
* If the tokens yielded no instructions, push an empty string.
*/
if (envPtr->codeNext == entryCodeNext) {
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0),
envPtr);
}
Tcl_DStringFree(&textBuffer);
TclSetStackDepth((stackDepth+1), envPtr);
}
/*
*----------------------------------------------------------------------
*
* TclCompileCmdWord --
*
|
| ︙ | ︙ | |||
1504 1505 1506 1507 1508 1509 1510 | /* * Multiple tokens or the single token involves substitutions. * Emit instructions to invoke the eval command procedure at * runtime on the result of evaluating the tokens. */ TclCompileTokens(interp, tokenPtr, count, envPtr); | | | 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 |
/*
* Multiple tokens or the single token involves substitutions.
* Emit instructions to invoke the eval command procedure at
* runtime on the result of evaluating the tokens.
*/
TclCompileTokens(interp, tokenPtr, count, envPtr);
TclEmitInst0(INST_EVAL_STK, envPtr);
}
}
/*
*----------------------------------------------------------------------
*
* TclCompileExprWords --
|
| ︙ | ︙ | |||
1576 1577 1578 1579 1580 1581 1582 |
if (i < (numWords - 1)) {
TclEmitPush(TclRegisterNewLiteral(envPtr, " ", 1),
envPtr);
}
wordPtr += (wordPtr->numComponents + 1);
}
concatItems = 2*numWords - 1;
| < < < < | | | 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 |
if (i < (numWords - 1)) {
TclEmitPush(TclRegisterNewLiteral(envPtr, " ", 1),
envPtr);
}
wordPtr += (wordPtr->numComponents + 1);
}
concatItems = 2*numWords - 1;
if (concatItems > 1) {
TclEmitInst1(INST_CONCAT, concatItems, envPtr);
}
TclEmitInst0(INST_EXPR_STK, envPtr);
}
/*
*----------------------------------------------------------------------
*
* TclInitByteCodeObj --
*
|
| ︙ | ︙ | |||
1620 1621 1622 1623 1624 1625 1626 |
Tcl_Obj *objPtr; /* Points object that should be
* initialized, and whose string rep
* contains the source code. */
register CompileEnv *envPtr; /* Points to the CompileEnv structure from
* which to create a ByteCode structure. */
{
register ByteCode *codePtr;
| | | > | | 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 |
Tcl_Obj *objPtr; /* Points object that should be
* initialized, and whose string rep
* contains the source code. */
register CompileEnv *envPtr; /* Points to the CompileEnv structure from
* which to create a ByteCode structure. */
{
register ByteCode *codePtr;
size_t codeWords, codeBytes, objArrayBytes, exceptArrayBytes, cmdLocBytes;
size_t auxDataArrayBytes, structureSize;
register unsigned char *p;
#ifdef TCL_COMPILE_DEBUG
unsigned char *nextPtr;
#endif
int numLitObjects = envPtr->literalArrayNext;
Namespace *namespacePtr;
int i;
Interp *iPtr;
iPtr = envPtr->iPtr;
codeWords = (envPtr->codeNext - envPtr->codeStart);
codeBytes = codeWords * sizeof(TclVMWord);
objArrayBytes = (envPtr->literalArrayNext * sizeof(Tcl_Obj *));
exceptArrayBytes = (envPtr->exceptArrayNext * sizeof(ExceptionRange));
auxDataArrayBytes = (envPtr->auxDataArrayNext * sizeof(AuxData));
cmdLocBytes = GetCmdLocEncodingSize(envPtr);
/*
* Compute the total number of bytes needed for this bytecode.
*/
structureSize = TCL_ALIGN(sizeof(ByteCode)); /* align codeBytes */
structureSize += TCL_ALIGN(codeBytes); /* align object array */
structureSize += TCL_ALIGN(objArrayBytes); /* align exc range arr */
structureSize += TCL_ALIGN(exceptArrayBytes); /* align AuxData array */
structureSize += auxDataArrayBytes;
structureSize += cmdLocBytes;
if (envPtr->iPtr->varFramePtr != NULL) {
|
| ︙ | ︙ | |||
1673 1674 1675 1676 1677 1678 1679 |
codePtr->flags = 0;
}
codePtr->source = envPtr->source;
codePtr->procPtr = envPtr->procPtr;
codePtr->numCommands = envPtr->numCommands;
codePtr->numSrcBytes = envPtr->numSrcBytes;
| | | | | | 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 |
codePtr->flags = 0;
}
codePtr->source = envPtr->source;
codePtr->procPtr = envPtr->procPtr;
codePtr->numCommands = envPtr->numCommands;
codePtr->numSrcBytes = envPtr->numSrcBytes;
codePtr->numCodeWords = codeWords;
codePtr->numLitObjects = numLitObjects;
codePtr->numExceptRanges = envPtr->exceptArrayNext;
codePtr->numAuxDataItems = envPtr->auxDataArrayNext;
codePtr->numCmdLocBytes = cmdLocBytes;
codePtr->maxCatchDepth = envPtr->maxCatchDepth;
codePtr->maxStackDepth = envPtr->maxStackDepth;
p += TCL_ALIGN(sizeof(ByteCode)); /* align codeBytes */
codePtr->codeStart = (TclVMWord *) p;
memcpy((VOID *) p, (VOID *) envPtr->codeStart, (size_t) codeBytes);
p += TCL_ALIGN(codeBytes); /* align object array */
codePtr->objArrayPtr = (Tcl_Obj **) p;
for (i = 0; i < numLitObjects; i++) {
codePtr->objArrayPtr[i] = envPtr->literalArrayPtr[i].objPtr;
}
|
| ︙ | ︙ | |||
1778 1779 1780 1781 1782 1783 1784 |
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. */
int nameBytes; /* Number of bytes in the name. */
int create; /* If 1, allocate a local frame entry for
* the variable if it is new. */
int flags; /* Flag bits for the compiled local if
| | | | 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 |
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. */
int nameBytes; /* Number of bytes in the name. */
int create; /* If 1, allocate a local frame entry for
* the variable if it is new. */
int flags; /* Flag bits for the compiled local if
* created. Only VAR_ARRAY, and VAR_LINK make
* sense. */
register Proc *procPtr; /* Points to structure describing procedure
* containing the variable reference. */
{
register CompiledLocal *localPtr;
int localVar = -1;
register int i;
|
| ︙ | ︙ | |||
1825 1826 1827 1828 1829 1830 1831 |
} else {
procPtr->lastLocalPtr->nextPtr = localPtr;
procPtr->lastLocalPtr = localPtr;
}
localPtr->nextPtr = NULL;
localPtr->nameLength = nameBytes;
localPtr->frameIndex = localVar;
| | | 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 |
} else {
procPtr->lastLocalPtr->nextPtr = localPtr;
procPtr->lastLocalPtr = localPtr;
}
localPtr->nextPtr = NULL;
localPtr->nameLength = nameBytes;
localPtr->frameIndex = localVar;
localPtr->flags = (flags | VAR_SHORT | VAR_DIRECT_WRITABLE);
if (name == NULL) {
localPtr->flags |= VAR_TEMPORARY;
}
localPtr->defValuePtr = NULL;
localPtr->resolveInfo = NULL;
if (name != NULL) {
|
| ︙ | ︙ | |||
1876 1877 1878 1879 1880 1881 1882 |
/*
* envPtr->codeNext is equal to envPtr->codeEnd. The currently defined
* code bytes are stored between envPtr->codeStart and
* (envPtr->codeNext - 1) [inclusive].
*/
| | | | | | | | 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 |
/*
* envPtr->codeNext is equal to envPtr->codeEnd. The currently defined
* code bytes are stored between envPtr->codeStart and
* (envPtr->codeNext - 1) [inclusive].
*/
size_t currWords = (envPtr->codeNext - envPtr->codeStart);
size_t newWords = 2*(envPtr->codeEnd - envPtr->codeStart);
TclVMWord *newPtr = (TclVMWord *) ckalloc(((unsigned) newWords) * sizeof(TclVMWord));
/*
* Copy from old code array to new, free old code array if needed, and
* mark new code array as malloced.
*/
memcpy((VOID *) newPtr, (VOID *) envPtr->codeStart, currWords * sizeof(TclVMWord));
if (envPtr->mallocedCodeArray) {
ckfree((char *) envPtr->codeStart);
}
envPtr->codeStart = newPtr;
envPtr->codeNext = (newPtr + currWords);
envPtr->codeEnd = (newPtr + newWords);
envPtr->mallocedCodeArray = 1;
}
/*
*----------------------------------------------------------------------
*
* EnterCmdStartData --
|
| ︙ | ︙ | |||
1968 1969 1970 1971 1972 1973 1974 |
}
}
cmdLocPtr = &(envPtr->cmdMapPtr[cmdIndex]);
cmdLocPtr->codeOffset = codeOffset;
cmdLocPtr->srcOffset = srcOffset;
cmdLocPtr->numSrcBytes = -1;
| | | 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 |
}
}
cmdLocPtr = &(envPtr->cmdMapPtr[cmdIndex]);
cmdLocPtr->codeOffset = codeOffset;
cmdLocPtr->srcOffset = srcOffset;
cmdLocPtr->numSrcBytes = -1;
cmdLocPtr->numCodeWords = -1;
}
/*
*----------------------------------------------------------------------
*
* EnterCmdExtentData --
*
|
| ︙ | ︙ | |||
1993 1994 1995 1996 1997 1998 1999 | * source and bytecode information for the command must already * have been registered. * *---------------------------------------------------------------------- */ static void | | | | | > > > > > < | < | 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 2000 2001 |
* source and bytecode information for the command must already
* have been registered.
*
*----------------------------------------------------------------------
*/
static void
EnterCmdExtentData(envPtr, cmdIndex, numSrcBytes, numCodeWords)
CompileEnv *envPtr; /* Points to the compilation environment
* structure in which to enter command
* location information. */
int cmdIndex; /* Index of the command whose source and
* code length data is being set. */
int numSrcBytes; /* Number of command source chars. */
int numCodeWords; /* Offset of last word of command code. */
{
CmdLocation *cmdLocPtr;
if ((cmdIndex < 0) || (cmdIndex >= envPtr->numCommands)) {
Tcl_Panic("EnterCmdExtentData: bad command index %d\n", cmdIndex);
}
if (cmdIndex > envPtr->cmdMapEnd) {
Tcl_Panic("EnterCmdExtentData: missing start data for command %d\n",
cmdIndex);
}
cmdLocPtr = &(envPtr->cmdMapPtr[cmdIndex]);
cmdLocPtr->numSrcBytes = numSrcBytes;
cmdLocPtr->numCodeWords = numCodeWords;
}
/*
*----------------------------------------------------------------------
*
* TclBeginExceptRange --
*
* Procedure that allocates and initializes a new ExceptionRange
* structure of the specified kind in a CompileEnv.
*
* Results:
* Returns the index for the newly created ExceptionRange.
*
* Side effects:
* If there is not enough room in the CompileEnv's ExceptionRange
* array, the array in expanded: a new array of double the size is
* allocated, if envPtr->mallocedExceptArray is non-zero the old
* array is freed, and ExceptionRange entries are copied from the old
* array to the new one.
* The codeOffset field of the ExceptionRange is initialized to
* the current position. The value of envPtr->exceptArrayCurr is saved
* in the numCodeWords field, otherwise unused until the loop
* range is closed.
*
*
*----------------------------------------------------------------------
*/
int TclBeginExceptRange(envPtr)
register CompileEnv *envPtr;/* Points to CompileEnv for which to
* create a new ExceptionRange structure. */
{
register ExceptionRange *rangePtr;
int index = envPtr->exceptArrayNext;
if (index >= envPtr->exceptArrayEnd) {
|
| ︙ | ︙ | |||
2069 2070 2071 2072 2073 2074 2075 | /* * Copy from old ExceptionRange array to new, free old * ExceptionRange array if needed, and mark the new ExceptionRange * array as malloced. */ memcpy((VOID *) newPtr, (VOID *) envPtr->exceptArrayPtr, | | < < | | > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/*
* Copy from old ExceptionRange array to new, free old
* ExceptionRange array if needed, and mark the new ExceptionRange
* array as malloced.
*/
memcpy((VOID *) newPtr, (VOID *) envPtr->exceptArrayPtr,
currBytes);
if (envPtr->mallocedExceptArray) {
ckfree((char *) envPtr->exceptArrayPtr);
}
envPtr->exceptArrayPtr = (ExceptionRange *) newPtr;
envPtr->exceptArrayEnd = newElems;
envPtr->mallocedExceptArray = 1;
}
envPtr->exceptArrayNext++;
rangePtr = &(envPtr->exceptArrayPtr[index]);
rangePtr->codeOffset = (envPtr->codeNext - envPtr->codeStart);
rangePtr->numCodeWords = envPtr->exceptArrayCurr;
envPtr->exceptArrayCurr = index;
rangePtr->breakOffset = -1;
rangePtr->continueOffset = -1;
return index;
}
/*
*----------------------------------------------------------------------
*
* TclEndExceptRange --
*
*
* Procedure that closes an existing ExceptionRange.
*
* Results:
* None.
*
* Side effects:
* The numCodeWords field of the ExceptionRange is initialized to
* reflect the current position, the compilation environment's
* catchDepth is updated. envPtr->lastOpenRange is restored to
* its previous value.
*
*----------------------------------------------------------------------
*/
void TclEndExceptRange(index, envPtr)
int index; /* The index of the exception range. */
CompileEnv *envPtr;/* CompileEnv for this exceptionRange.*/
{
register ExceptionRange *rangePtr = &(envPtr->exceptArrayPtr[index]);
envPtr->exceptArrayCurr = rangePtr->numCodeWords;
rangePtr->numCodeWords =
(envPtr->codeNext - envPtr->codeStart) - rangePtr->codeOffset;
}
/*
*----------------------------------------------------------------------
*
* TclCreateAuxData --
*
* Procedure that allocates and initializes a new AuxData structure in
|
| ︙ | ︙ | |||
2221 2222 2223 2224 2225 2226 2227 |
{
/*
* The currently allocated jump fixup entries are stored from fixup[0]
* up to fixup[fixupArrayPtr->fixupNext] (*not* inclusive). We assume
* fixupArrayPtr->fixupNext is equal to fixupArrayPtr->fixupEnd.
*/
| | | | | | 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 |
{
/*
* The currently allocated jump fixup entries are stored from fixup[0]
* up to fixup[fixupArrayPtr->fixupNext] (*not* inclusive). We assume
* fixupArrayPtr->fixupNext is equal to fixupArrayPtr->fixupEnd.
*/
size_t currBytes = fixupArrayPtr->next * sizeof(int);
int newElems = 2*(fixupArrayPtr->end + 1);
size_t newBytes = newElems * sizeof(int);
int *newPtr = (int *) ckalloc((unsigned) newBytes);
/*
* Copy from the old array to new, free the old array if needed,
* and mark the new array as malloced.
*/
memcpy((VOID *) newPtr, (VOID *) fixupArrayPtr->fixup, currBytes);
if (fixupArrayPtr->mallocedArray) {
ckfree((char *) fixupArrayPtr->fixup);
}
fixupArrayPtr->fixup = (int *) newPtr;
fixupArrayPtr->end = newElems;
fixupArrayPtr->mallocedArray = 1;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
2266 2267 2268 2269 2270 2271 2272 |
/* Points to the JumpFixupArray structure
* to free. */
{
if (fixupArrayPtr->mallocedArray) {
ckfree((char *) fixupArrayPtr->fixup);
}
}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 |
/* Points to the JumpFixupArray structure
* to free. */
{
if (fixupArrayPtr->mallocedArray) {
ckfree((char *) fixupArrayPtr->fixup);
}
}
/*
*----------------------------------------------------------------------
*
* TclGetInstructionTable --
*
* Returns a pointer to the table describing Tcl bytecode instructions.
|
| ︙ | ︙ | |||
2676 2677 2678 2679 2680 2681 2682 |
} else if (codeDelta <= 127) {
codeDeltaNext++;
} else {
codeDeltaNext += 5; /* 1 byte for 0xFF, 4 for positive delta */
}
prevCodeOffset = mapPtr[i].codeOffset;
| | | 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 |
} else if (codeDelta <= 127) {
codeDeltaNext++;
} else {
codeDeltaNext += 5; /* 1 byte for 0xFF, 4 for positive delta */
}
prevCodeOffset = mapPtr[i].codeOffset;
codeLen = mapPtr[i].numCodeWords;
if (codeLen < 0) {
Tcl_Panic("GetCmdLocEncodingSize: bad code length");
} else if (codeLen <= 127) {
codeLengthNext++;
} else {
codeLengthNext += 5; /* 1 byte for 0xFF, 4 for length */
}
|
| ︙ | ︙ | |||
2772 2773 2774 2775 2776 2777 2778 |
/*
* Encode the code length for each command.
*/
codePtr->codeLengthStart = p;
for (i = 0; i < numCmds; i++) {
| | | 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 |
/*
* Encode the code length for each command.
*/
codePtr->codeLengthStart = p;
for (i = 0; i < numCmds; i++) {
codeLen = mapPtr[i].numCodeWords;
if (codeLen < 0) {
Tcl_Panic("EncodeCmdLocMap: bad code length");
} else if (codeLen <= 127) {
TclStoreInt1AtPtr(codeLen, p);
p++;
} else {
TclStoreInt1AtPtr(0xFF, p);
|
| ︙ | ︙ | |||
2853 2854 2855 2856 2857 2858 2859 |
void
TclPrintByteCodeObj(interp, objPtr)
Tcl_Interp *interp; /* Used only for Tcl_GetStringFromObj. */
Tcl_Obj *objPtr; /* The bytecode object to disassemble. */
{
ByteCode* codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr;
| | | | | | | | > | | 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 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 |
void
TclPrintByteCodeObj(interp, objPtr)
Tcl_Interp *interp; /* Used only for Tcl_GetStringFromObj. */
Tcl_Obj *objPtr; /* The bytecode object to disassemble. */
{
ByteCode* codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr;
TclVMWord *codeStart, *codeLimit, *pc;
unsigned char *codeDeltaNext, *codeLengthNext;
unsigned char *srcDeltaNext, *srcLengthNext;
int codeOffset, codeLen, srcOffset, srcLen, numCmds, delta, i;
Interp *iPtr = (Interp *) *codePtr->interpHandle;
if (codePtr->refCount <= 0) {
return; /* already freed */
}
codeStart = codePtr->codeStart;
codeLimit = (codeStart + codePtr->numCodeWords);
numCmds = codePtr->numCommands;
/*
* Print header lines describing the ByteCode.
*/
fprintf(stdout, "\nByteCode 0x%x, refCt %u, epoch %u, interp 0x%x (epoch %u)\n",
(unsigned int) codePtr, codePtr->refCount,
codePtr->compileEpoch, (unsigned int) iPtr,
iPtr->compileEpoch);
fprintf(stdout, " Source ");
TclPrintSource(stdout, codePtr->source,
TclMin(codePtr->numSrcBytes, 55));
fprintf(stdout, "\n Cmds %d, src %d, inst %d, litObjs %u, aux %d, stkDepth %u, code/src %.2f\n",
numCmds, codePtr->numSrcBytes, codePtr->numCodeWords,
codePtr->numLitObjects, codePtr->numAuxDataItems,
codePtr->maxStackDepth,
#ifdef TCL_COMPILE_STATS
(codePtr->numSrcBytes?
((float)codePtr->structureSize)/((float)codePtr->numSrcBytes) : 0.0)
#else
0.0
#endif
);
#ifdef TCL_COMPILE_STATS
fprintf(stdout,
" Code %d = header %d+inst %d+litObj %d+exc %d+aux %d+cmdMap %d\n",
codePtr->structureSize,
(sizeof(ByteCode) - (sizeof(size_t) + sizeof(Tcl_Time))),
codePtr->numCodeWords * sizeof(TclVMWord),
(codePtr->numLitObjects * sizeof(Tcl_Obj *)),
(codePtr->numExceptRanges * sizeof(ExceptionRange)),
(codePtr->numAuxDataItems * sizeof(AuxData)),
codePtr->numCmdLocBytes);
#endif /* TCL_COMPILE_STATS */
/*
|
| ︙ | ︙ | |||
2916 2917 2918 2919 2920 2921 2922 |
fprintf(stdout,
" Proc 0x%x, refCt %d, args %d, compiled locals %d\n",
(unsigned int) procPtr, procPtr->refCount, procPtr->numArgs,
numCompiledLocals);
if (numCompiledLocals > 0) {
CompiledLocal *localPtr = procPtr->firstLocalPtr;
for (i = 0; i < numCompiledLocals; i++) {
| | < | | > | < | < < < | | < < | | < < < < < < < < | 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 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 |
fprintf(stdout,
" Proc 0x%x, refCt %d, args %d, compiled locals %d\n",
(unsigned int) procPtr, procPtr->refCount, procPtr->numArgs,
numCompiledLocals);
if (numCompiledLocals > 0) {
CompiledLocal *localPtr = procPtr->firstLocalPtr;
for (i = 0; i < numCompiledLocals; i++) {
fprintf(stdout, " slot %d%s%s%s%s", i,
((localPtr->flags & VAR_ARRAY)? ", array" :
((localPtr->flags & VAR_LINK)? ", link" :
", scalar")),
((localPtr->flags & VAR_ARGUMENT)? ", arg" : ""),
((localPtr->flags & VAR_TEMPORARY)? ", temp" : ""),
((localPtr->flags & VAR_RESOLVED)? ", resolved" : ""));
if (TclIsVarTemporary(localPtr)) {
fprintf(stdout, "\n");
} else {
fprintf(stdout, ", \"%s\"\n", localPtr->name);
}
localPtr = localPtr->nextPtr;
}
}
}
/*
* Print the ExceptionRange array.
*/
if (codePtr->numExceptRanges > 0) {
fprintf(stdout, " Exception ranges %d:\n", codePtr->numExceptRanges);
for (i = 0; i < codePtr->numExceptRanges; i++) {
ExceptionRange *rangePtr = &(codePtr->exceptArrayPtr[i]);
fprintf(stdout, " %d: pc %d-%d, ",
i, rangePtr->codeOffset,
(rangePtr->codeOffset + rangePtr->numCodeWords - 1));
fprintf(stdout, "continue %d, break %d\n",
rangePtr->continueOffset, rangePtr->breakOffset);
}
}
/*
* If there were no commands (e.g., an expression or an empty string
* was compiled), just print all instructions and return.
*/
|
| ︙ | ︙ | |||
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 |
fprintf(stdout, " ");
pc += TclPrintInstruction(codePtr, pc);
}
}
}
#endif /* TCL_COMPILE_DEBUG */
/*
*----------------------------------------------------------------------
*
* TclPrintInstruction --
*
* This procedure prints ("disassembles") one instruction from a
* bytecode object to stdout.
*
* Results:
* Returns the length in bytes of the current instruiction.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclPrintInstruction(codePtr, pc)
ByteCode* codePtr; /* Bytecode containing the instruction. */
| > | | | | | > | | > > | | < < < < < | | | | > > | | < < | | > | < | < | | < < < < < | | | > > > > > > | < > > > > | | > | | > > | < > > > | | | > | > | | < | > | | | | | < | | < | < < > > > > > > > > > > | | | < | | | > > | 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 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 |
fprintf(stdout, " ");
pc += TclPrintInstruction(codePtr, pc);
}
}
}
#endif /* TCL_COMPILE_DEBUG */
#ifdef TCL_COMPILE_DEBUG
/*
*----------------------------------------------------------------------
*
* TclPrintInstruction --
*
* This procedure prints ("disassembles") one instruction from a
* bytecode object to stdout.
*
* Results:
* Returns the length in bytes of the current instruiction.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclPrintInstruction(codePtr, pc)
ByteCode* codePtr; /* Bytecode containing the instruction. */
TclVMWord *pc; /* Points to first byte of instruction. */
{
Proc *procPtr = codePtr->procPtr;
unsigned int opCode;
register InstructionDesc *instDesc;
TclVMWord *codeStart = codePtr->codeStart;
ptrdiff_t pcOffset = (pc - codeStart);
TclPSizedInt opnds[2], opnd;
int i, j;
TclVMGetInstAndOpAtPtr(pc, opCode, opnd);
instDesc = &tclInstructionTable[opCode];
fprintf(stdout, "(%u) %s ", pcOffset, instDesc->name);
if (instDesc->numOperands == 2) {
HP_EXTRACT(opnd, opnds[0], opnds[1]);
} else {
opnds[0] = opnd;
}
for (i = 0; i < instDesc->numOperands; i++) {
opnd = opnds[i];
switch (instDesc->opTypes[i]) {
case OPERAND_OFFSET:
if (opCode == INST_START_CMD) {
opnd = opnd >> 1;
}
fprintf(stdout, "%d # pc %u", (int) opnd,
(unsigned)(pcOffset + opnd));
break;
case OPERAND_INT:
if ((opCode == INST_STORE) || (opCode == INST_LOAD)
|| (opCode == INST_STORE_SCALAR)
|| (opCode == INST_LOAD_SCALAR)) {
fprintf(stdout, "0x%lx |", (long) opnd);
if (opnd & TCL_LIST_ELEMENT) {
fprintf(stdout, "lappend");
} else if (opnd & TCL_APPEND_VALUE) {
fprintf(stdout, "append");
} else {
fprintf(stdout, "set");
}
if (opnd & VM_VAR_ARRAY) {
fprintf(stdout, "|array");
}
if (opnd & VM_VAR_OMIT_PUSH) {
fprintf(stdout, "|drop");
} else {
fprintf(stdout, "|push");
}
fprintf(stdout, "| ");
} else if (opCode == INST_INCR) {
if ((opnd >> 2) != (HPINT_MIN >> 2)) {
fprintf(stdout, "%d ", (opnd>>2));
} else {
fprintf(stdout, "|stackIncr");
}
if (opnd & VM_VAR_ARRAY) {
fprintf(stdout, "|array");
}
if (opnd & VM_VAR_OMIT_PUSH) {
fprintf(stdout, "|drop");
} else {
fprintf(stdout, "|push");
}
fprintf(stdout, "| ");
} else {
fprintf(stdout, "%d ", (int) opnd);
}
break;
case OPERAND_UINT:
if (opCode == INST_PUSH) {
fprintf(stdout, "%u # ", (unsigned) opnd);
TclPrintObject(stdout, codePtr->objArrayPtr[opnd], 40);
} else if ((opCode >= INST_LOAD) && (opCode <= INST_INCR)) {
int localCt;
CompiledLocal *localPtr;
if ((unsigned int) opnd == (unsigned int) HPUINT_MAX) {
fprintf(stdout, "#stack var ");
break;
}
if (!procPtr) {
Tcl_Panic("TclPrintInstruction: local var index %u outside of a proc.\n",
(unsigned int) opnd);
}
localCt = procPtr->numCompiledLocals;
localPtr = procPtr->firstLocalPtr;
if (opnd >= localCt) {
Tcl_Panic("TclPrintInstruction: bad local var index %u (%u locals)\n",
(unsigned int) opnd, localCt);
}
for (j = 0; j < opnd; j++) {
localPtr = localPtr->nextPtr;
}
if (TclIsVarTemporary(localPtr)) {
fprintf(stdout, "%u # temp var %u",
(unsigned int) opnd, (unsigned int) opnd);
} else {
fprintf(stdout, "%u # var ", (unsigned int) opnd);
TclPrintSource(stdout, localPtr->name, 40);
}
} else {
fprintf(stdout, "%u ", (unsigned int) opnd);
}
break;
case OPERAND_IDX:
if (opnd >= -1) {
fprintf(stdout, "%d ", (int) opnd);
} else if (opnd == -2) {
fprintf(stdout, "end ");
} else {
fprintf(stdout, "end-%d ", (int) (-2-opnd));
}
break;
case OPERAND_NONE:
default:
break;
}
}
fprintf(stdout, "\n");
return 1; /* Every instruction takes 1 word */
}
#endif /* TCL_COMPILE_DEBUG */
#ifdef TCL_COMPILE_DEBUG
/*
*----------------------------------------------------------------------
*
* TclPrintObject --
*
* This procedure prints up to a specified number of characters from
* the argument Tcl object's string representation to a specified file.
|
| ︙ | ︙ | |||
3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 |
{
char *bytes;
int length;
bytes = Tcl_GetStringFromObj(objPtr, &length);
TclPrintSource(outFile, bytes, TclMin(length, maxChars));
}
/*
*----------------------------------------------------------------------
*
* TclPrintSource --
*
* This procedure prints up to a specified number of characters from
* the argument string to a specified file. It tries to produce legible
| > > | 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 |
{
char *bytes;
int length;
bytes = Tcl_GetStringFromObj(objPtr, &length);
TclPrintSource(outFile, bytes, TclMin(length, maxChars));
}
#endif /* TCL_COMPILE_DEBUG */
#ifdef TCL_COMPILE_DEBUG
/*
*----------------------------------------------------------------------
*
* TclPrintSource --
*
* This procedure prints up to a specified number of characters from
* the argument string to a specified file. It tries to produce legible
|
| ︙ | ︙ | |||
3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 |
default:
fprintf(outFile, "%c", *p);
continue;
}
}
fprintf(outFile, "\"");
}
#ifdef TCL_COMPILE_STATS
/*
*----------------------------------------------------------------------
*
* RecordByteCodeStats --
*
| > | 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 |
default:
fprintf(outFile, "%c", *p);
continue;
}
}
fprintf(outFile, "\"");
}
#endif /* TCL_COMPILE_DEBUG */
#ifdef TCL_COMPILE_STATS
/*
*----------------------------------------------------------------------
*
* RecordByteCodeStats --
*
|
| ︙ | ︙ | |||
3366 3367 3368 3369 3370 3371 3372 |
statsPtr->totalByteCodeBytes += (double) codePtr->structureSize;
statsPtr->currentSrcBytes += (double) codePtr->numSrcBytes;
statsPtr->currentByteCodeBytes += (double) codePtr->structureSize;
statsPtr->srcCount[TclLog2(codePtr->numSrcBytes)]++;
statsPtr->byteCodeCount[TclLog2((int)(codePtr->structureSize))]++;
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 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 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 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 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 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 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 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 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 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 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 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 3849 3850 3851 3852 3853 3854 3855 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 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 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 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 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 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 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 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 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 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 |
statsPtr->totalByteCodeBytes += (double) codePtr->structureSize;
statsPtr->currentSrcBytes += (double) codePtr->numSrcBytes;
statsPtr->currentByteCodeBytes += (double) codePtr->structureSize;
statsPtr->srcCount[TclLog2(codePtr->numSrcBytes)]++;
statsPtr->byteCodeCount[TclLog2((int)(codePtr->structureSize))]++;
statsPtr->currentInstBytes +=
(double) codePtr->numCodeWords*sizeof(TclVMWord);
statsPtr->currentLitBytes +=
(double) (codePtr->numLitObjects * sizeof(Tcl_Obj *));
statsPtr->currentExceptBytes +=
(double) (codePtr->numExceptRanges * sizeof(ExceptionRange));
statsPtr->currentAuxBytes +=
(double) (codePtr->numAuxDataItems * sizeof(AuxData));
statsPtr->currentCmdMapBytes += (double) codePtr->numCmdLocBytes;
}
#endif /* TCL_COMPILE_STATS */
#if VM_ENABLE_OPTIMISER
/****************************************************************************
* This section devoted to the bytecode optimiser. It does not conform fully
* to Tcl's engineering standards while it is evolving.
*
* NOTICE: this code is very suboptimal, the optimiser itself can use some
* optimisation. Actually, it probably needs a redesign using better data
* structures to represent the call graph. As it is, the optimiser performs
* way too many passes over the bytecode.
*
* IMPLEMENTATION NOTES AND OPTIONS
*
* * It is an open question if it is better to optimise the ByteCode (as here)
* or rather the CompileEnv. Pro/con of doing it on the bytecode as opposed
* to the compileEnv:
* + can do it also on precompiled code
* + can call it right before execution by TEBC (if the bytecode flag is
* not set) - ie, rebrand it as part of the engine and not the
* compiler. May be interesting to have different engines share a
* compiler.
* + can replace relative with absolute jumps, as the definitive in-mem
* address of the targets is known
* + can replace instruction numbers with jump-target pointers (eg using
* gcc's 'labels as values')
* - resizing the structure is more expensive: need to realloc, instead
* of just creating it at the right size.
* The main difference (apart from almost trivial interface changes) is in
* how the command location data is stored - and hence adapted.
*
* * Note that INST_START_CMD is a pain - it blocks inter-command
* optimisations. One alternative would be to add a 'command-start' flag
* to the instructions to replace it. Such flags can be fitted for all
* models (as long as the instruction count is <128, or else by shrinking
* somewhat the max opnd size). What is the cost of checking/clearing the
* flag bit at every instruction? See also patch at [Bug 926164]
*
* ////
****************************************************************************/
/*
*----------------------------------------------------------------------
*
* TclOptimiseByteCode --
*
* Rewrites the bytecode performing various optimisations that cannot be
* done easily by the individual command compilers.
*
* Results:
* Optimised ByteCode struct..
*
* Side effects:
* None
*
*----------------------------------------------------------------------
*/
static ByteCode * OptimiseByteCodeTmp _ANSI_ARGS_((ByteCode *codePtr));
void
TclOptimiseByteCode (interp, objPtr)
Tcl_Interp*interp;
Tcl_Obj *objPtr;
{
ByteCode *codePtr; /* The bytecode sequence to interpret. */
if (objPtr->typePtr != &tclByteCodeType) {
return;
}
codePtr = OptimiseByteCodeTmp((ByteCode *)
objPtr->internalRep.otherValuePtr);
/*
* Should we realloc the Bytecode struct if it shrunk noticeably? Or copy
* to a newly malloced one?
* Test later on - note that it needs reaccomodating the internal pointers
* too, as for the time being we just leave the empty space in the struct
* and do not move everything forward. Note that the interface is already
* prepared for this.
*/
codePtr->flags &= TCL_BYTECODE_OPTIMISED;
objPtr->internalRep.otherValuePtr = (VOID *) codePtr;
return;
}
static ByteCode *OptCleanupByteCode _ANSI_ARGS_((ByteCode *codePtr, int *auxCount));
static void OptInitCounts _ANSI_ARGS_((ByteCode *codePtr, int *auxCount));
static int OptFollowJumps _ANSI_ARGS_((ByteCode *codePtr, int pos,
int *auxCount, int *singlePtr));
static void OptReduceCount _ANSI_ARGS_((ByteCode *codePtr, int pos, int *auxCount));
static ByteCode *
OptimiseByteCodeTmp(codePtr)
ByteCode *codePtr;
#if 0
{
return codePtr;
}
#else
{
int *auxCount; /* Aux array: holds the count predecessors for each
* instruction - 0 means single predecessor, negative
* values indicate unreachable code. */
int i, pos, targetPos, target2Pos, modified;
TclVMWord *pc, *targetPc;
TclVMWord *codeStart = codePtr->codeStart;
TclPSizedInt opnd, aux;
int opCode, targetOpCode, single;
int zero = -1, one = -1;
/* Hold the index of the constants 0 and 1 in the literal
* table; these will be set on first usage. */
TclPSizedInt noPushFlags;
InstIOType in, out;
noPushFlags = HP_STASH(VM_VAR_OMIT_PUSH, 0);
if (!codePtr->numCodeWords) {
return codePtr;
}
/*
* Alloc the auxCount array and init to 0; we allocate one more than
* necessary to simplify the algorithm.
*/
auxCount = (int *) ckalloc((codePtr->numCodeWords+1) * sizeof(int));
memset((char *) auxCount, '\0',
codePtr->numCodeWords * sizeof(int));
/*
* Perform a first pass to initialise the auxCount array, rewriting loop
* exceptions to jumps where possible.
*/
OptInitCounts(codePtr, auxCount);
/*
* Main loop - apply reduction rules. We keep passing through the code
* until there are no more changes - speak about a suboptimal optimiser :)
*
* Note: this algorithm *will* miss some "obvious" optimisations, at
* points in the code where different code paths merge.
*
*/
modified = 1;
while (modified) {
modified = 0;
pc = codeStart;
for (pos = 0; pos < codePtr->numCodeWords; pos++) {
pc = codePtr->codeStart+pos;
if (auxCount[pos] < 0) {
TclStoreNoopAtPtr(pc);
continue;
}
if (TclInstIsNoop(*pc)) {
continue;
}
TclVMGetInstAndOpAtPtr(pc, opCode, opnd);
out = tclInstructionTable[opCode].input;
#if 0
if ((opCode != INST_JUMP)
&& (auxCount[pos] == 0) /* not a branch target */
&& ((TclVMGetInstAtPtr(pc+1) != INST_JUMP)
|| (auxCount(pos+1)>0))
&& TclInstIsNoop(*(pc-1))) {
/*
* No wiggle room, but can create some by moving this
* instruction back by one: do it, can't hurt.
*
* More involved gymnastics (including copying to a malloced
* buffer, maybe even losing monotonicity) are possible.
*/
/*
* MISSING: ////
* Attention range targets should NOT be moved like this - we
* are protecting only break targets.
*/
}
#endif
restartThisPc:
targetPos = OptFollowJumps(codePtr, pos, auxCount, &single);
targetPc = codeStart+targetPos;
targetOpCode = TclVMGetInstAtPtr(targetPc);
if (!TclInstIsBoolComp(opCode) || (opnd == 0)) {
if (((out == B) && ((targetOpCode == INST_TRY_CVT_TO_NUMERIC)
|| (targetOpCode == INST_LYES)))
|| (((out == I) || (out == N))
&& (targetOpCode == INST_TRY_CVT_TO_NUMERIC))) {
if (single) {
TclStoreNoopAtPtr(targetPc);
modified = 1;
goto restartThisPc;
} else if ((targetPos != (pos+1)) && (auxCount[pos+1] == 0)) {
/* Followed by an unshared jump: jump past the useless
* conversion. */
aux = TclVMGetOpndAtPtr(pc+1);
TclVMStoreOpndAtPtr((targetPos-pos), (pc+1));
auxCount[targetPos+1]++;
OptReduceCount(codePtr, (pos+aux+1), auxCount);
modified = 1;
goto restartThisPc;
}
}
}
if (TclInstIsBoolComp(opCode)) {
if (opnd == 0) {
/* For now: pushing the result; is it used in a
* conditional branch? Then branch ... but first process
* any intervening negations */
while (1) {
targetPos = OptFollowJumps(codePtr,
pos, auxCount, &single);
targetPc = codeStart+targetPos;
targetOpCode = TclVMGetInstAtPtr(targetPc);
if ((targetOpCode != INST_LYES)
&& (targetOpCode != INST_TRY_CVT_TO_NUMERIC)
&& (targetOpCode != INST_LNOT)) {
break;
}
if (single) {
if (targetOpCode == INST_LNOT) {
TclNegateInstAtPtr(pc);
}
TclStoreNoopAtPtr(codeStart+targetPos);
modified = 1;
} else if ((TclVMGetInstAtPtr(pc+1) == INST_JUMP)
&& (auxCount[pos+1] == 0)) {
/*
* maybe you can jump around the target, if you
* are immediately followed by an unshared
* uncond. jump or noop ...
*/
if (targetOpCode == INST_LNOT) {
TclNegateInstAtPtr(pc);
}
aux = TclVMGetOpndAtPtr(pc+1);
TclVMStoreOpndAtPtr((targetPos-pos), (pc+1));
auxCount[targetPos+1]++;
OptReduceCount(codePtr, (pos+1+aux), auxCount);
modified = 1;
} else {
break;
}
}
if (!TclInstIsJump(targetOpCode)) {
continue;
}
/*
* If we get here, there are only noops and jumps between
* the comp and the conditional jump, in a single path: we
* can replace the jump with a noop and jump directly from
* the comp.
*/
if (single) {
if (targetOpCode == INST_JUMP_FALSE) {
TclNegateInstAtPtr(pc);
}
aux = (targetPos+(TclVMGetOpndAtPtr(targetPc))-pos);
TclVMStoreOpndAtPtr(aux, pc);
TclStoreNoopAtPtr(targetPc);
modified = 1;
} else if ((TclVMGetInstAtPtr(pc+1) == INST_JUMP)
&& (auxCount[pos+1] == 0)) {
/* make a second branch jump past the conditional
* jump, to the 'fail' target */
if (targetOpCode == INST_JUMP_FALSE) {
TclNegateInstAtPtr(pc);
}
aux = (targetPos+(TclVMGetOpndAtPtr(targetPc))-pos);
TclVMStoreOpndAtPtr(aux, pc); /* jump-if-true */
auxCount[pos+aux]++;
aux = TclVMGetOpndAtPtr(pc+1);
TclVMStoreOpndAtPtr((targetPos-pos), (pc+1));
auxCount[targetPos+1]++;
OptReduceCount(codePtr, (pos+1+aux), auxCount);
modified = 1;
} else {
continue;
}
}
/* Already a jump: can extend it? */
TclVMGetInstAndOpAtPtr(pc, opCode, opnd);
if(auxCount[pos+opnd] < 0) {
Tcl_Panic("Jump into unreachable code!");
}
if (TclVMGetInstAtPtr(pc+opnd) == INST_JUMP) {
targetPos = OptFollowJumps(codePtr,
pos+opnd, auxCount, &single);
auxCount[targetPos]++;
TclVMStoreOpndAtPtr((targetPos-pos), pc);
OptReduceCount(codePtr, (pos+opnd), auxCount);
modified = 1;
continue;
}
}
switch (opCode) {
case INST_TRY_CVT_TO_NUMERIC:
case INST_LYES:
/* If next takes nums or ints or bools, noop: the conversion
* will be handled by the next instruction. */
in = tclInstructionTable[targetOpCode].input;
if ((in == B) || (in == I) || (in == N)) {
TclStoreNoopAtPtr(pc);
modified = 1;
}
continue;
case INST_LNOT:
/* If next is a conditional jump,and this is the only
* predecessor, change the jump and make this a noop. Make
* sequential LNOTs cancel. Note that the case of following
* LYES or TRY_CONVERT have already been handled. */
if (single) {
switch (targetOpCode) {
case INST_JUMP_TRUE:
case INST_JUMP_FALSE:
case INST_LNOT:
TclStoreNoopAtPtr(pc);
TclNegateInstAtPtr(targetPc);
modified = 1;
break;
}
}
continue;
case INST_PUSH:
if (targetOpCode == INST_POP) {
if (single) {
TclStoreNoopAtPtr(pc);
TclStoreNoopAtPtr(targetPc);
/* NO NEED TO RESTART */
} else {
targetPos = OptFollowJumps(codePtr, targetPos, auxCount, &single);
TclVMStoreWordAtPtr(INST_JUMP, (targetPos-pos), pc);
auxCount[targetPos]++;
OptReduceCount(codePtr, (pos+1), auxCount);
modified = 1;
}
} else if ((targetOpCode == INST_JUMP_TRUE)
|| (targetOpCode == INST_JUMP_FALSE)) {
/* Check if we are pushing a constant 0/1 (as compiled by &&
* and ||), in which case we replace the PUSH with an
* unconditional jump (do not forget to fix the auxCounts). */
/* //// MISSING, to do */
}
continue;
case INST_START_CMD:
{
int omitPush = (opnd & VM_VAR_OMIT_PUSH);
int extended = 1;
opnd = (opnd>>1);
while (extended) {
extended = 0;
targetOpCode = TclVMGetInstAtPtr(pc+opnd);
/*
* /// This code causes a "following jumps into
* unreachable code" error - can't find how or why its
* interaction with the other INST_START_CMD opt leads
* to this.
*/
if (targetOpCode == INST_JUMP) {
int old = opnd;
targetPos = OptFollowJumps(codePtr, (pos+opnd), auxCount, &single);
opnd = (targetPos-pos);
TclVMStoreOpndAtPtr((opnd<<1)|omitPush, pc);
auxCount[targetPos]++;
OptReduceCount(codePtr, (pos+old), auxCount);
modified = 1;
extended = 1;
targetOpCode = TclVMGetInstAtPtr(codeStart+targetPos);
}
if ((targetOpCode == INST_POP) && !omitPush) {
/*
* Omit pushing the command's result if it is not
* needed. Include the (ommitted) POP in within the
* command's instructions.
*/
aux = ((opnd+1)<<1) | VM_VAR_OMIT_PUSH;
auxCount[pos+opnd+1]++;
TclVMStoreOpndAtPtr(aux, pc);
OptReduceCount(codePtr, (pos+opnd), auxCount);
omitPush = 1;
opnd++;
modified = 1;
extended = 1;
omitPush = 1;
}
}
continue;
}
case INST_STORE:
case INST_STORE_SCALAR:
case INST_INCR:
if ((targetOpCode == INST_POP) && !(opnd & noPushFlags)) {
if (single) {
/* Avoid pushing the result. */
opnd |= noPushFlags;
TclVMStoreOpndAtPtr(opnd, pc);
TclStoreNoopAtPtr(targetPc);
/* NO NEED TO RESTART */
} else if (targetPos != (pos+1)
&& (auxCount[pos+1] == 0)) {
/* there is a jump at (pos+1): modify it to jump PAST
* the POP, and drop the result. Save the old jump
* target in aux */
opnd |= noPushFlags;
TclVMStoreOpndAtPtr(opnd, pc);
targetPos = OptFollowJumps(codePtr, targetPos, auxCount, &single);
pos++; pc++;
TclVMGetInstAndOpAtPtr(pc, opCode, aux);
if (opCode != INST_JUMP) {
Tcl_Panic("Error in OptFollowJumps");
}
TclVMStoreOpndAtPtr((targetPos-pos), pc);
auxCount[targetPos]++;
OptReduceCount(codePtr, (pos+aux), auxCount);
modified = 1;
}
}
continue;
case INST_JUMP_TRUE:
case INST_JUMP_FALSE:
/* Find the branched target */
target2Pos = targetPos;
if (TclVMGetInstAtPtr(pc+opnd) == INST_JUMP) {
/* includes noops */
targetPos = OptFollowJumps(codePtr, (pos+opnd), auxCount, &single);
} else {
targetPos = pos + opnd;
}
/*
* Missing:
* (INST_JUMP_TRUE 2) (INST_JUMP OPND) ==>
* (NOOP) (INST_JUMP_FALSE OPND)
* (Simpler after cleaning up, actually)
* ////
*/
goto modifyJumps;
case INST_JUMP:
if ((targetOpCode == INST_DONE)
|| (targetOpCode == INST_BREAK)
|| (targetOpCode == INST_CONTINUE)) {
TclVMStoreWordAtPtr(targetOpCode,
(TclVMGetOpndAtPtr(targetPc)), pc);
OptReduceCount(codePtr, (pos+opnd), auxCount);
/* NO NEED TO RESTART */
continue;
}
if (auxCount[pos+1] >= 0) {
if (TclVMGetInstAtPtr(pc+1) == INST_JUMP) {
target2Pos = OptFollowJumps(codePtr, (pos+1), auxCount, &single);
} else {
target2Pos = pos+1;
}
} else {
/* Use an impossible jump width - insure that it is never
* equal to the jump target */
target2Pos = -(pos+1);
}
modifyJumps:
if(auxCount[targetPos] < 0) {
Tcl_Panic("Jump into unreachable code!");
}
if (targetPos == target2Pos) {
if ((opCode == INST_JUMP) && (opnd != 1)) {
/* useless jump, noop has the same target */
TclStoreNoopAtPtr(pc);
auxCount[pos+1]++;
OptReduceCount(codePtr, (pos+opnd), auxCount);
modified = 1;
} else if ((opCode == INST_JUMP_TRUE)
|| (opCode == INST_JUMP_FALSE)) {
/* useless jump, both branches go to the same spot:
* popping the result has the same effect */
TclVMStoreWordAtPtr(INST_POP, 0, pc);
OptReduceCount(codePtr, (pos+opnd), auxCount);
modified = 1;
}
continue;
} else if (targetPos == pos) {
/* Got an infinite empty loop! Set it to a continue at the
* next instruction - but what if it was unreachable?
* Also: what if it was a conditional jump?
* //// */
TclVMStoreOpndAtPtr(1, pc);
auxCount[pos+1]++;
OptReduceCount(codePtr, (pos+opnd), auxCount);
modified = 1;
} else if (targetPos != (pos + opnd)) {
/* Can follow a jump; do it */
TclVMStoreOpndAtPtr((targetPos-pos), pc);
auxCount[targetPos]++;
OptReduceCount(codePtr, (pos+opnd), auxCount);
/* NO NEED TO RESTART */
}
continue;
}
}
/*
* If some range became unreachable, remove the extra reference to the
* break and continue targets.
*/
for (i = 0; i < codePtr->numExceptRanges; i++) {
pos = codePtr->exceptArrayPtr[i].codeOffset;
if (auxCount[pos] < 0) {
pos = codePtr->exceptArrayPtr[i].breakOffset;
if (pos!= -1) {
OptReduceCount(codePtr, pos, auxCount);
modified = 1;
}
pos = codePtr->exceptArrayPtr[i].continueOffset;
if (pos!= -1) {
OptReduceCount(codePtr, pos, auxCount);
modified = 1;
}
}
}
}
/*
* Finally remove all unreachable code and noops.
*/
codePtr = OptCleanupByteCode(codePtr, auxCount);
codePtr->flags |= TCL_BYTECODE_OPTIMISED;
ckfree((char *) auxCount);
return codePtr;
}
#endif
/*
*----------------------------------------------------------------------
*
* OptFollowJumps --
*
* Computes the position of the next effective instruction after 'pos',
* following unconditional jumps (including noops). Also indicates in
* *singlePtr if no other execution path merges into this code segment.
*
* Results:
* Position of next effective instruction.
*
* Side effects:
* None
*/
static int
OptFollowJumps(codePtr, pos, auxCount, singlePtr)
ByteCode *codePtr;
int pos; /* Position after which to follow jumps */
int *auxCount;
int *singlePtr; /* Indicator of simple path (no merges) */
{
int inst;
TclVMWord *codeStart = codePtr->codeStart;
int lastPos = codePtr->numCodeWords;
int initPos = pos;
TclPSizedInt opnd;
TclVMGetInstAndOpAtPtr((codeStart+pos), inst, opnd);
switch (inst) {
case INST_JUMP:
pos += opnd;
break;
case INST_DONE:
case INST_BREAK:
case INST_CONTINUE:
case INST_FOREACH_START:
case INST_FOREACH_STEP:
case INST_BEGIN_CATCH:
case INST_START_CMD:
*singlePtr = 1;
return pos;
default:
pos++;
}
*singlePtr = (auxCount[pos] == 0);
while ((pos < lastPos) && (pos != initPos)) {
if (auxCount[pos] > 0) {
*singlePtr = 0;
} else if (auxCount[pos] < 0) {
break;
}
TclVMGetInstAndOpAtPtr((codeStart+pos), inst, opnd);
if (inst == INST_JUMP /* includes noops! */) {
pos += opnd;
continue;
}
break;
}
if (auxCount[pos] < 0) {
Tcl_Panic("Following jumps into unreachable code.");
}
return pos;
}
/*
*----------------------------------------------------------------------
*
* OptReduceCount --
*
* Reduces the predecessor count at pos. Checks if the position has
* become unreachable, in which case it replaces the word with a noop and
* follows the execution path(s) from it, reducing the predecessor counts.
*
* Results:
* None
*
* Side effects:
* Reduces predecessor counts, replaces instructions with noops.
*/
static void
OptReduceCount(codePtr, pos, auxCount)
ByteCode *codePtr;
int pos;
int *auxCount;
{
TclVMWord *codeStart = codePtr->codeStart, *pc;
int lastPos = codePtr->numCodeWords;
int opCode, i;
TclPSizedInt opnd;
/*
* Problem - break targets when loop is gone?
*/
if (auxCount[pos] < 0) {
#ifdef TCL_COMPILE_DEBUG
TclPrintInstruction(codePtr, codeStart+pos);
#endif
Tcl_Panic("Reducing auxCount of unreachable code.");
}
while ((pos < lastPos) && (auxCount[pos] >= 0)) {
if (--auxCount[pos]>= 0) break;
pc = (codeStart+pos);
if (!TclInstIsNoop(*pc)) {
TclVMGetInstAndOpAtPtr(pc, opCode, opnd);
TclStoreNoopAtPtr(pc);
if (TclInstIsJump(opCode)
|| (TclInstIsBoolComp(opCode) && (opnd != 0))) {
OptReduceCount(codePtr, pos+opnd, auxCount);
if (opCode == INST_JUMP) {
break;
}
} else if (opCode == INST_BEGIN_CATCH) {
/* Remove everything up to the END_CATCH */
for (i = 1; i <= opnd; i++) {
TclStoreNoopAtPtr(pc+i);
auxCount[pos+i] = -1;
}
pos += opnd;
break;
} else if (opCode == INST_FOREACH_START) {
/* Remove everything up to FOREACH_STEP */
{
ForeachInfo *infoPtr = (ForeachInfo *)
codePtr->auxDataArrayPtr[opnd].clientData;
opnd = - pos +
codePtr->exceptArrayPtr[infoPtr->rangeIndex].continueOffset;
}
for (i = 1; i <= opnd; i++) {
TclStoreNoopAtPtr(pc+i);
auxCount[pos+i] = -1;
}
break;
} else if ((opCode == INST_DONE)
|| (opCode == INST_BREAK )
|| (opCode == INST_CONTINUE)) {
break;
}
}
pos++;
}
}
/*
*----------------------------------------------------------------------
*
* OptInitCounts --
*
* Initialise the auxCount array to contain the number of predecessors of
* each word in the bytecode stream (0-based counting). Exception range
* targets (break, continue, start and end words for 'foreach' and
* 'catch' ranges) are protected by overcounting.
*
* Results:
* None.
*
* Side effects:
* Loop exceptions (break, continue) are replaced with jumps wherever
* possible.
* Remarks:
* A good part (if not all) of this job could have been done at compile
* time, saving (at least) one pass here.
*/
static void
OptInitCounts(codePtr, auxCount)
ByteCode *codePtr;
int *auxCount;
{
int i, pos;
TclVMWord *pc;
TclVMWord *codeStart = codePtr->codeStart;
TclPSizedInt opnd;
int inst;
/*
* Insure that words that may *seem* unreachable but are not are
* processed correctly. These are the break and continue targets for loop
* ranges, INST_END_CATCH (as long as the corresponding INST_BEGIN_CATCH
* is reachable), INST_FOREACH_STEP (as long as INST_FOREACH_START is
* reachable).
*
* First handle loop exception ranges.
*/
for (i = 0; i < codePtr->numExceptRanges; i++) {
pos = codePtr->exceptArrayPtr[i].breakOffset;
if (pos >= 0) {
auxCount[pos]++;
}
pos = codePtr->exceptArrayPtr[i].continueOffset;
if (pos >= 0) {
auxCount[pos]++;
}
}
/*
* Do a first pass to correct the predecessor count stored in auxCount.
* In this pass we also insure reachability od INST_END_CATCH and
* INST_FOREACH_STEP, rewrite loop exceptions to jumps wherever
* possible, and use the direct load/store instructions for local
* scalars.
*/
pc = codeStart;
for (pos = 0; pos < codePtr->numCodeWords; pos++, pc++) {
TclVMGetInstAndOpAtPtr(pc, inst, opnd);
switch (inst) {
case INST_JUMP:
auxCount[pos+1]--;
case INST_JUMP_TRUE:
case INST_JUMP_FALSE:
auxCount[pos+opnd]++;
break;
case INST_START_CMD:
auxCount[pos+(opnd>>1)]++;
break;
case INST_BREAK:
auxCount[pos+1]--;
if (opnd >= 0) {
opnd = codePtr->exceptArrayPtr[opnd].breakOffset;
auxCount[opnd]++;
TclVMStoreWordAtPtr(INST_JUMP, (opnd-pos), pc);
}
break;
case INST_CONTINUE:
auxCount[pos+1]--;
if ((opnd >= 0)
&& (codePtr->exceptArrayPtr[opnd].continueOffset != -1)) {
opnd = codePtr->exceptArrayPtr[opnd].continueOffset;
auxCount[opnd]++;
TclVMStoreWordAtPtr(INST_JUMP, (opnd-pos), pc);
}
break;
case INST_DONE:
auxCount[pos+1]--;
break;
case INST_BEGIN_CATCH:
/* Can reach a seemingly unreachable END_CATCH. */
auxCount[pos+opnd]++;
break;
case INST_FOREACH_START:
/* Jumps to FOREACH_STEP, which jumps right back here. Insure
* that the FOREACH_STEP is reachable, as well as the
* instruction immediately following this one. */
{
ForeachInfo *infoPtr = (ForeachInfo *)
codePtr->auxDataArrayPtr[opnd].clientData;
int stepPos =
codePtr->exceptArrayPtr[infoPtr->rangeIndex].continueOffset;
auxCount[stepPos]++;
}
break;
case INST_LOAD:
case INST_STORE:
{
TclPSizedInt index, flags;
HP_EXTRACT(opnd, flags, index);
if ((index < (TclPSizedInt) HPUINT_MAX)
&& ((flags & ~VM_VAR_OMIT_PUSH) == TCL_LEAVE_ERR_MSG)) {
/*
* A local scalar, plain load/store instructions: use
* the faster direct instructions.
*/
TclVMStoreInstAtPtr((inst+1), pc);
}
}
break;
#if !(defined(TCL_COMPILE_DEBUG)||defined(VM_USE_PACKED))
case INST_PUSH:
/* //// Move to TEBC: ptr opnd, and instructions
* /// UNHOLY CAST: fix by making the opnd a union
*/
{
Tcl_Obj *objPtr = codePtr->objArrayPtr[opnd];
TclVMStoreOpndAtPtr((TclPSizedInt) objPtr, pc);
}
break;
#endif
}
}
}
/*
*----------------------------------------------------------------------
*
* OptCleanupByteCode --
*
* Removes all NOOPs (ie 1-jumps): eliminates the instructions, updates
* jump targets and exception ranges, fixes the codeDelta and codeLength
* data.
* The code assumes
*
* Results:
* Shortened ByteCode stream, without noops.
*
* Side effects:
* Workspace array auxCount[] is overwritten.
*/
static ByteCode *
OptCleanupByteCode(codePtr, auxCount)
ByteCode *codePtr;
int *auxCount; /* array containing the predecessorcount for each
* word - negative means 'unreachable'. Will be
* rewritten. */
{
TclVMWord *pc;
TclPSizedInt opnd;
int i, j, noops, opCode;
unsigned char *pr, *pw, *qr, *qw;
int oldstart;
int restart;
int lastOp;
pc = codePtr->codeStart;
for (i = 0; i < codePtr->numCodeWords; pc++, i++) {
if (auxCount[i]<0) {
/* unreachable code */
TclStoreNoopAtPtr(pc);
}
}
/*
* Compute the shifts after the NOOPs and unreachable codes
* are removed. This loop can not be done simultaneously with the
* updating of the code: all new positions have to be computed
* before updating jump targets.
*
* Store the number of noops previous to pos in auxCount[pos]; this
* indicates how many positions that code will be shifted back.
*
* Note: it is conceivable that an intruction becomes inaccessible later
* when updating the exception ranges - ie, one that only kept alive by
* the refCount corresponding to the range, and where the target moved. We
* will just leave that noop in the code, the only harm it does is that it
* takes some place.
*/
restartTarget:
restart = 0;
noops = 0;
pc = codePtr->codeStart;
lastOp = 0;
for (i = 0; i < codePtr->numCodeWords; pc++, i++) {
auxCount[i] = -noops;
if (TclInstIsNoop(*pc)) {
noops++;
} else {
lastOp = i;
}
}
if (!noops) {
return codePtr;
}
/*
* Update all exception ranges. We assume that all jumps have already been
* followed before us being called.
*/
for (i = 0; i < codePtr->numExceptRanges; i++) {
ExceptionRange *rangePtr = &codePtr->exceptArrayPtr[i];
rangePtr->numCodeWords += - auxCount[rangePtr->codeOffset] +
auxCount[rangePtr->codeOffset + rangePtr->numCodeWords];
rangePtr->codeOffset += auxCount[rangePtr->codeOffset];
if (rangePtr->breakOffset >= 0) {
rangePtr->breakOffset += auxCount[rangePtr->breakOffset];
}
if (rangePtr->continueOffset >= 0) {
rangePtr->continueOffset += auxCount[rangePtr->continueOffset];
}
}
/*
* Move up all code, update jump targets. Note that an in-place update is
* possible as the code is guaranteed not to become longer.
*/
pc = codePtr->codeStart;
for (i = 0; i <= lastOp; pc++, i++) {
TclVMGetInstAndOpAtPtr(pc, opCode, opnd);
if (TclInstIsNoop(*pc)) {
continue;
} else if (TclInstIsJump(opCode)
|| (opCode == INST_BEGIN_CATCH)) {
if (opnd != 1) {
opnd += (auxCount[(i+opnd)] - auxCount[i]);
if (opCode == INST_JUMP){
if (opnd == 1) {
/* WHAT IF NEW NOOPS APPEAR HERE? Jumping around
* unreachable code ... redo from scratch?*/
restart = 1;
} else if (opnd == 0) {
/* an infinite empty loop! make it a noop. Note that
* this is WRONG ... //// */
TclStoreNoopAtPtr(pc);
restart = 1;
}
}
}
} else if (TclInstIsBoolComp(opCode) && (opnd != 0)) {
opnd += (auxCount[(i+opnd)] - auxCount[i]);
} else if (opCode == INST_START_CMD) {
/* NOTE: depends on VAR_OMIT_PUSH == 1 */
if ((opnd>>1) != 1) {
opnd += ((auxCount[(i+(opnd>>1))] - auxCount[i]) << 1);
}
}
TclVMStoreWordAtPtr(opCode, opnd, (pc + auxCount[i]));
}
/*
* Regen codeDelta/codeLen
*/
pr = pw = codePtr->codeDeltaStart;
qr = qw = codePtr->codeLengthStart;
oldstart = 0;
for (j = 0; j < codePtr->numCommands; j++) {
unsigned int delta, len, newstart;
delta = TclGetUInt1AtPtr(pr++);
if (delta == (unsigned int) 0xFF) {
delta = TclGetInt4AtPtr(pr);
pr += 4;
}
newstart = oldstart + delta;
delta += auxCount[newstart] - auxCount[oldstart];
if (delta <= 127) {
TclStoreInt1AtPtr(delta, pw++);
} else {
TclStoreInt1AtPtr(0xFF, pw++);
TclStoreInt4AtPtr(delta, pw);
pw += 4;
}
len = TclGetUInt1AtPtr(qr++);
if (len == (unsigned int) 0xFF) {
len = TclGetInt4AtPtr(qr);
qr += 4;
}
len += auxCount[newstart + len-1] - auxCount[newstart];
if (len <= 127) {
TclStoreInt1AtPtr(len, qw++);
} else {
TclStoreInt1AtPtr(0xFF, qw++);
TclStoreInt4AtPtr(len, qw);
qw += 4;
}
oldstart = newstart;
}
lastOp += auxCount[lastOp];
codePtr->numCodeWords = lastOp + 1;
if (restart) {
goto restartTarget;
}
/*
* Should we move all unused space to the back, and realloc? If the
* optimisation-shrinkage is important, could be interesting.
*/
return codePtr;
}
#endif /* VM_ENABLE_OPTIMISER */
|
Changes to generic/tclCompile.h.
1 2 3 4 5 6 7 8 9 10 | /* * tclCompile.h -- * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclCompile.h -- * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2005 by Miguel Sofer. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclCompile.h,v 1.53.2.24 2005/06/13 01:45:46 msofer Exp $ */ #ifndef _TCLCOMPILATION #define _TCLCOMPILATION 1 #include "tclInt.h" |
| ︙ | ︙ | |||
54 55 56 57 58 59 60 | *------------------------------------------------------------------------ * Data structures related to compilation. *------------------------------------------------------------------------ */ /* * The structure used to implement Tcl "exceptions" (exceptional returns): | | < | | | > | | | | | < < < < < < < < < < < < < | < < | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
*------------------------------------------------------------------------
* Data structures related to compilation.
*------------------------------------------------------------------------
*/
/*
* The structure used to implement Tcl "exceptions" (exceptional returns):
* those generated in loops by the break and continue commands. This
* ExceptionRange structure describes a range of code (a loop body), the kind
* of exceptions (break or continue) that might occur, and the PC offsets to
* jump to if a matching exception does occur. Exception ranges can nest, and
* the code *assumes* that the latest-created active exception is the
* innermost. In this manner, by scanning the exceptions from last-to-first,
* the first match corresponds to the innermost active exception range. In
* practical terms, this means that the compiler *must* define outer ranges
* before inner ranges, which happens to be the natural thing to do.
* These structures are also generated for the "next" subcommands of for loops
* since a break there terminates the for command. This means a for command
* actually generates two LoopInfo structures.
*/
typedef struct ExceptionRange {
int codeOffset; /* Offset of the first instruction byte of
* the code range. */
int numCodeWords; /* Number of words in the code range. */
int breakOffset; /* If LOOP_EXCEPTION_RANGE, the target PC
* offset for a break command in the range. */
int continueOffset; /* If LOOP_EXCEPTION_RANGE and not -1, the
* target PC offset for a continue command in
* the code range. Otherwise, ignore this range
* when processing a continue command. */
} ExceptionRange;
/*
* Structure used to map between instruction pc and source locations. It
* defines for each compiled Tcl command its code's starting offset and
* its source's starting offset and length. Note that the code offset
* increases monotonically: that is, the table is sorted in code offset
* order. The source offset is not monotonic.
*/
typedef struct CmdLocation {
int codeOffset; /* Offset of first word of command code. */
int numCodeWords; /* Number of words for command's code. */
int srcOffset; /* Offset of first char of the command. */
int numSrcBytes; /* Number of command source chars. */
} CmdLocation;
/*
* CompileProcs need the ability to record information during compilation
* that can be used by bytecode instructions during execution. The AuxData
|
| ︙ | ︙ | |||
162 163 164 165 166 167 168 169 170 171 172 173 174 |
typedef struct AuxData {
AuxDataType *type; /* pointer to the AuxData type associated with
* this ClientData. */
ClientData clientData; /* The compilation data itself. */
} AuxData;
/*
* Structure defining the compilation environment. After compilation, fields
* describing bytecode instructions are copied out into the more compact
* ByteCode structure defined below.
*/
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 |
typedef struct AuxData {
AuxDataType *type; /* pointer to the AuxData type associated with
* this ClientData. */
ClientData clientData; /* The compilation data itself. */
} AuxData;
/*
* Macros and ifdefs that define the width of instructions and operands. The
* objective is:
* - an instruction has the width of a pointer - in preparation for it
* really being a pointer to a jump target
* - an instruction's operands are pointer-sized, and can be one of: a
* pointer, a pointer-sized integer, or (one signed and one unsigned)
* integers of half-pointer size.
*
* Valuable properties of this design include:
* - the instruction stream is always aligned
* - it permits a simpler and faster code optimiser
* - it permits faster branching, storing absolute pointers as operands for
* jump instructions
* - it permits a faster TEBC (instructions as jump targets, at least using
* pointers-as-values in gcc/icc. May need some asm magic on other
* platforms).
*
* The downside is that the instruction stream is much larger. The increase in
* memory traffic may or may not override the advantages, we'll measure that.
*
* Note that the instruction stream is not portable; not accross platforms,
* not to a different process on the same platform (when using absolute
* pointers). If this design is adopted, a portable compact code will be
* designed. In principle it can be generated by the same compiler, with a
* different second stage to replace the optimiser.
*
* There is another option to store each (instruction+operands) in 32 bits; it
* is implemented below, and chosen by setting
* COMPILE_DEBUG_FLAGS="-DVM_USE_PACKED"
*/
#ifndef VM_USE_PACKED
#if defined(__WIN32_)
#define TclPSizedInt int
#define TclHalfPSizedInt short
#elif defined(__WIN64__)
#define TclPSizedInt Tcl_WideInt
#define TclHalfPSizedInt int
#else /* start of NOT WIN */
#if ((SIZEOF_LONG_ <= SIZEOF_VOID_P_) && (SIZEOF_LONG_ != SIZEOF_INT_))
#define TclPSizedInt long
#elif (SIZEOF_INT_ <= SIZEOF_VOID_P_)
#define TclPSizedInt int
#elif (SIZEOF_SHORT_ <= SIZEOF_VOID_P_)
#define TclPSizedInt short
#else
Should not happen
(this text here to make the compiler barf)
#endif /* Define TclPSizedInt */
#if ((2*SIZEOF_LONG_ <= SIZEOF_VOID_P_) && (SIZEOF_LONG_ != SIZEOF_INT_))
#define TclHalfPSizedInt long
#elif (2*SIZEOF_INT_ <= SIZEOF_VOID_P_)
#define TclHalfPSizedInt int
#elif (2*SIZEOF_SHORT_ <= SIZEOF_VOID_P_)
#define TclHalfPSizedInt short
#else
#define NO_HALFP_SIZED_INT
#endif /* Define TclHaldPSizedInt */
#endif /* Not WIN */
typedef struct TclVMWord {
TclPSizedInt inst;
TclPSizedInt opnd;
} TclVMWord;
/*
* Macros to stash/extract one signed and one unsigned half-length ints
* into/from a pointer-sized int.
*/
#define PINT_MAX (~(((TclPSizedInt)1)<<(8*sizeof(TclPSizedInt)-1)))
#define PINT_MIN (-PINT_MAX -1)
#define HP_SHIFT (4*sizeof(TclPSizedInt))
#define HP_MASK (PINT_MAX>>(HP_SHIFT-1))
#define HPUINT_MAX HP_MASK
#define HPINT_MAX (HP_MASK>>1)
#define HPINT_MIN (-HPINT_MAX-1)
#define HP_STASH(n, u) \
(((TclPSizedInt) (n) << HP_SHIFT) | ((TclPSizedInt) (u) & HP_MASK))
#define HP_EXTRACT(full, n, u)\
(n) = ((full) >> HP_SHIFT);\
(u) = ((full) & HP_MASK)
#define TclVMGetInstAtPtr(p) (*(p)).inst
#define TclVMGetOpndAtPtr(p) (*(p)).opnd
#define TclVMStoreInstAtPtr(instruction, p) \
(*(p)).inst = (TclPSizedInt) (instruction)
#define TclVMStoreOpndAtPtr(operand, pc) \
(*(pc)).opnd = (TclPSizedInt) (operand)
#define TclVMGetInstAndOpAtPtr(p, instruction, operand) \
(instruction) = TclVMGetInstAtPtr(p);\
(operand) = TclVMGetOpndAtPtr(p)
#define TclVMStoreWordAtPtr(instruction, operand, p)\
(*(p)).inst = (TclPSizedInt) (instruction);\
(*(p)).opnd = (TclPSizedInt) (operand)
#else /* USE_WORDCODES */
/*
* Pack every (instruction+operands) in 32 bits; the possible combinations are
* - uint8 instruction, int24 operand
* - uint8 instruction, uint8 operand, int16 operand
*/
#if (SIZEOF_INT_ == 4)
#define TclPSizedInt int
#elif (SIZEOF_LONG_ == 4)
#define TclPSizedInt long
#elif (SIZEOF_SHORT_ == 4)
#define TclPSizedInt short
#else
FIXME
#endif
#define TclVMWord TclPSizedInt
/*
* Remark that the names correspond to the interpretation for wcodes, and are
* grossly misleading here:
* - PINT_MAX is the max integer that can be stored as a single operand
* - HPINT_MAX is the max to be stored as signed part in a 2-opnd
* instruction
* - HPUINT_MAX is the max to be stored as unsigned part in a 2-opnd
* instruction
*
* - P_SHIFT, P_MASK describe how to put a 24 bit operand in the word
* - HP_SHIFT and HP_MASK describe how to put two operands in the 24 bits
*/
#define PINT_MAX 0x7FFFFF
#define PINT_MIN (-PINT_MAX -1)
#define P_SHIFT 8
#define P_MASK 0xFF
/* Divide the 24 bits in 12 signed + 12 unsigned*/
#define HP_SHIFT 12
#define HP_MASK 0xFFF
#define HPUINT_MAX 0xFFF
#define HPINT_MAX 0x7FF
#define HPINT_MIN (-HPINT_MAX-1)
#define P_STASH(n, u) \
((((TclPSizedInt) (n)) << P_SHIFT) | (u))
#define HP_STASH(n, u) \
(((TclPSizedInt) (n) << HP_SHIFT) | ((TclPSizedInt) (u) & HP_MASK))
#define HP_EXTRACT(full, n, u)\
(n) = (((TclPSizedInt)(full)) >> HP_SHIFT);\
(u) = (((TclPSizedInt)(full)) & HP_MASK)
#define TclVMGetInstAtPtr(p) \
(*((TclPSizedInt *)(p)) & P_MASK)
#define TclVMGetOpndAtPtr(p) \
(*((TclPSizedInt *)(p)) >> P_SHIFT)
#define TclVMStoreInstAtPtr(instruction, p) \
*(p) = ((*((TclPSizedInt *)(p)) & ~P_MASK)\
| (instruction))
#define TclVMStoreOpndAtPtr(operand, p) \
*(p) = ((*((TclPSizedInt *)(p)) & P_MASK) \
| (((TclPSizedInt) operand) << P_SHIFT))
#define TclVMGetInstAndOpAtPtr(p, instruction, operand) \
(instruction) = TclVMGetInstAtPtr(p);\
(operand) = TclVMGetOpndAtPtr(p)
#define TclVMStoreWordAtPtr(instruction, operand, p) \
*((TclPSizedInt *)(p)) = P_STASH((operand), (instruction))
#endif /* USE_WORDCODES */
/*
* Structure defining the entries in the runtime catch stack.
*/
typedef struct catchItem {
int stackTop;
TclVMWord *pc;
} catchItem;
#define CATCH_ITEM_SIZE 2
/*
* Structure defining the compilation environment. After compilation, fields
* describing bytecode instructions are copied out into the more compact
* ByteCode structure defined below.
*/
#define COMPILEENV_INIT_CODE_WORDS 250
#define COMPILEENV_INIT_NUM_OBJECTS 60
#define COMPILEENV_INIT_EXCEPT_RANGES 5
#define COMPILEENV_INIT_CMD_MAP_SIZE 40
#define COMPILEENV_INIT_AUX_DATA_SIZE 5
typedef struct CompileEnv {
Interp *iPtr; /* Interpreter containing the code being
|
| ︙ | ︙ | |||
191 192 193 194 195 196 197 |
int numSrcBytes; /* Number of bytes in source. */
Proc *procPtr; /* If a procedure is being compiled, a
* pointer to its Proc structure; otherwise
* NULL. Used to compile local variables.
* Set from information provided by
* ObjInterpProc in tclProc.c. */
int numCommands; /* Number of commands compiled. */
| | | | | | | | > > > > | 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 |
int numSrcBytes; /* Number of bytes in source. */
Proc *procPtr; /* If a procedure is being compiled, a
* pointer to its Proc structure; otherwise
* NULL. Used to compile local variables.
* Set from information provided by
* ObjInterpProc in tclProc.c. */
int numCommands; /* Number of commands compiled. */
int catchDepth; /* Current catch range nesting level;
* 0 if not in any range currently. */
int maxCatchDepth; /* Max nesting level of catch ranges;
* 0 if no ranges have been compiled. */
int maxStackDepth; /* Maximum number of stack elements needed
* to execute the code. Set by compilation
* procedures before returning. */
int currStackDepth; /* Current stack depth. */
LiteralTable localLitTable; /* Contains LiteralEntry's describing
* all Tcl objects referenced by this
* compiled code. Indexed by the string
* representations of the literals. Used to
* avoid creating duplicate objects. */
TclVMWord *codeStart; /* Points to the first byte of the code. */
TclVMWord *codeNext; /* Points to next code array byte to use. */
TclVMWord *codeEnd; /* Points just after the last allocated
* code array byte. */
int mallocedCodeArray; /* Set 1 if code array was expanded
* and codeStart points into the heap.*/
LiteralEntry *literalArrayPtr;
/* Points to start of LiteralEntry array. */
int literalArrayNext; /* Index of next free object array entry. */
int literalArrayEnd; /* Index just after last obj array entry. */
int mallocedLiteralArray; /* 1 if object array was expanded and
* objArray points into the heap, else 0. */
ExceptionRange *exceptArrayPtr;
/* Points to start of the ExceptionRange
* array. */
int exceptArrayCurr; /* Innermost currently active ExceptionRange
* array index; -1 if no range is active, -2
* if the innermost range corresponds to a
* catch and not a loop.*/
int exceptArrayNext; /* Next free ExceptionRange array index.
* exceptArrayNext is the number of ranges
* and (exceptArrayNext-1) is the index of
* the current range's array entry. */
int exceptArrayEnd; /* Index after the last ExceptionRange
* array entry. */
int mallocedExceptArray; /* 1 if ExceptionRange array was expanded
|
| ︙ | ︙ | |||
243 244 245 246 247 248 249 |
int auxDataArrayNext; /* Next free compile aux data array index.
* auxDataArrayNext is the number of aux
* data items and (auxDataArrayNext-1) is
* index of current aux data array entry. */
int auxDataArrayEnd; /* Index after last aux data array entry. */
int mallocedAuxDataArray; /* 1 if aux data array was expanded and
* auxDataArrayPtr points in heap else 0. */
| | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
int auxDataArrayNext; /* Next free compile aux data array index.
* auxDataArrayNext is the number of aux
* data items and (auxDataArrayNext-1) is
* index of current aux data array entry. */
int auxDataArrayEnd; /* Index after last aux data array entry. */
int mallocedAuxDataArray; /* 1 if aux data array was expanded and
* auxDataArrayPtr points in heap else 0. */
TclVMWord staticCodeSpace[COMPILEENV_INIT_CODE_WORDS];
/* Initial storage for code. */
LiteralEntry staticLiteralSpace[COMPILEENV_INIT_NUM_OBJECTS];
/* Initial storage of LiteralEntry array. */
ExceptionRange staticExceptArraySpace[COMPILEENV_INIT_EXCEPT_RANGES];
/* Initial ExceptionRange array storage. */
CmdLocation staticCmdMapSpace[COMPILEENV_INIT_CMD_MAP_SIZE];
/* Initial storage for cmd location map. */
|
| ︙ | ︙ | |||
267 268 269 270 271 272 273 | * the CmdLocation map, and the compilation AuxData array. */ /* * A PRECOMPILED bytecode struct is one that was generated from a compiled * image rather than implicitly compiled from source */ | | | > > > > > > > | 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 |
* the CmdLocation map, and the compilation AuxData array.
*/
/*
* A PRECOMPILED bytecode struct is one that was generated from a compiled
* image rather than implicitly compiled from source
*/
#define TCL_BYTECODE_PRECOMPILED 0x01
/*
* When a bytecode is compiled, interp or namespace resolvers have not been
* applied yet: this is indicated by the TCL_BYTECODE_RESOLVE_VARS flag.
*/
#define TCL_BYTECODE_RESOLVE_VARS 0x02
/*
* Flags indicating f the bytecode has been optimised
*/
#define TCL_BYTECODE_OPTIMISED 0x04
#define TCL_BYTECODE_ENGINE_OPTS 0x08
typedef struct ByteCode {
TclHandle interpHandle; /* Handle for interpreter containing the
* compiled code. Commands and their compile
* procs are specific to an interpreter so the
* code emitted will depend on the
* interpreter. */
|
| ︙ | ︙ | |||
317 318 319 320 321 322 323 |
* and must not be freed by it. */
size_t structureSize; /* Number of bytes in the ByteCode structure
* itself. Does not include heap space for
* literal Tcl objects or storage referenced
* by AuxData entries. */
int numCommands; /* Number of commands compiled. */
int numSrcBytes; /* Number of source bytes compiled. */
| | | | | | 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 |
* and must not be freed by it. */
size_t structureSize; /* Number of bytes in the ByteCode structure
* itself. Does not include heap space for
* literal Tcl objects or storage referenced
* by AuxData entries. */
int numCommands; /* Number of commands compiled. */
int numSrcBytes; /* Number of source bytes compiled. */
int numCodeWords; /* Number of code words. */
int numLitObjects; /* Number of objects in literal array. */
int numExceptRanges; /* Number of ExceptionRange array elems. */
int numAuxDataItems; /* Number of AuxData items. */
int numCmdLocBytes; /* Number of bytes needed for encoded
* command location information. */
int maxCatchDepth; /* Maximum nesting level of catch ranges;
* 0 if no ranges were compiled. */
int maxStackDepth; /* Maximum number of stack elements needed
* to execute the code. */
TclVMWord *codeStart; /* Points to the first byte of the code.
* This is just after the final ByteCode
* member cmdMapPtr. */
Tcl_Obj **objArrayPtr; /* Points to the start of the literal
* object array. This is just after the
* last code byte. */
ExceptionRange *exceptArrayPtr;
/* Points to the start of the ExceptionRange
|
| ︙ | ︙ | |||
380 381 382 383 384 385 386 387 388 389 390 |
* delta sequence. */
#ifdef TCL_COMPILE_STATS
Tcl_Time createTime; /* Absolute time when the ByteCode was
* created. */
#endif /* TCL_COMPILE_STATS */
} ByteCode;
/*
* Opcodes for the Tcl bytecode instructions. These must correspond to
* the entries in the table of instruction descriptions,
* tclInstructionTable, in tclCompile.c. Also, the order and number of
| > > > > > > > > > > > > > > > > > > | > > > > > > | | < < | | | < < < < | < < < < < < | < < < < < < < < < | < < < | < < < < | < < | | | | < < | | | | | | | > > > > > | > > > > > | | | | < < | | | | | | < | | < < < < < | < | | > < < | < < < | | | | | < < | | < < | < < < < | < | < | | < | | | | > | | < | | < | | | | | < | | | < | | | > > | | | | < < < < > | | | | | | | | | < | > | > > > > | < | < | | > > > > > > > > > > > > > > < | > > > | > > > < < < < < < < > > | | | | < < < < < < < < < < < < < < < < < < < < < < | < > > | < < < < < < < < < < < < < < < | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 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 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 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 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
* delta sequence. */
#ifdef TCL_COMPILE_STATS
Tcl_Time createTime; /* Absolute time when the ByteCode was
* created. */
#endif /* TCL_COMPILE_STATS */
} ByteCode;
/*
* Flag values for the variable-access opcodes
*
* These should not collide with any of TCL_APPEND_VALUE, TCL_LIST_ELEMENT,
* TCL_TRACE_READS, TCL_LEAVE_ERR_MSG:
#define TCL_APPEND_VALUE 4
#define TCL_LIST_ELEMENT 8
#define TCL_TRACE_READS 0x10
#define TCL_LEAVE_ERR_MSG 0x200
*
* NOTE: the code for INST_INCR depends on these two being 1 and 2.
*/
#define VM_VAR_OMIT_PUSH 0x01
#define VM_VAR_ARRAY 0x02
#define VM_STORE_FLAGS_FILTER \
(TCL_APPEND_VALUE|TCL_LIST_ELEMENT|TCL_TRACE_READS|TCL_LEAVE_ERR_MSG)
/*
* Opcodes for the Tcl bytecode instructions. These must correspond to
* the entries in the table of instruction descriptions,
* tclInstructionTable, in tclCompile.c. Also, the order and number of
* the expression opcodes (e.g., INST_BITOR) must match the entries in
* the array operatorStrings in tclExecute.c.
*
* NOTE: the numbering is carefully designed to simplify the code of the
* optimiser, by letting the numbering provide information on the opcode's
* properties. A more robust implementation could incorporate that info in the
* tclInstructionTable. The important property is that ops that are logical
* opposites (eg '<' and '>=') have numbers (2n) and (2n+1).
*/
/* Opcodes for stack management */
#define INST_PUSH 0
#define INST_POP 1
#define INST_DUP 2
#define INST_OVER 3
/* Opcodes for command building and invocation*/
#define INST_CONCAT 4
#define INST_INVOKE_STK 5
#define INST_EVAL_STK 6
#define INST_EXPR_STK 7
#define INST_EXPAND_START 8
#define INST_EXPAND_STKTOP 9
#define INST_INVOKE_EXPANDED 10
#define INST_START_CMD 11
/* Opcodes for variable access. */
#define INST_LOAD 12
#define INST_LOAD_SCALAR 13
#define INST_STORE 14
#define INST_STORE_SCALAR 15
#define INST_INCR 16
/*
* Opcodes for flow control
*
* These opcodes are either control sequences, jumps, or perform comparisons
* and jump-if-true. As the latter, as well as the conditional jumps, can be
* negated, it is important to number them so that opposites are (2n) and
* (2n+1) - so that the optimiser can negate them by flipping one bit (^1).
*
* It is also important that the comparisons immediately precede the other
* math operators, as the [expr] compiler relies on that property.
*/
#define INST_DONE 17
#define INST_RETURN 18
#define INST_BREAK 19
#define INST_CONTINUE 20
#define INST_FOREACH_START 21
#define INST_FOREACH_STEP 22
#define INST_BEGIN_CATCH 23
#define INST_END_CATCH 24
#define INST_JUMP 25
#define INST_JUMP_TRUE 26
#define INST_JUMP_FALSE 27
#define TclInstIsJump(op) ((op<=27) && (op>=25))
#define FIRST_OPERATOR_INST 28
#define INST_EQ 28
#define INST_NEQ 29
#define INST_LT 30
#define INST_GE 31
#define INST_GT 32
#define INST_LE 33
#define INST_STR_EQ 34
#define INST_STR_NEQ 35
#define INST_LIST_IN 36
#define INST_LIST_NOT_IN 37
#define TclInstIsBoolComp(op) ((op<=37) && (op>=28))
/* Opcodes for the remaining operators */
#define INST_LNOT 38 /* Keep these at (2n)(2n+1) */
#define INST_LYES 39
#define INST_BITOR 40
#define INST_BITXOR 41
#define INST_BITAND 42
#define INST_LSHIFT 43
#define INST_RSHIFT 44
#define INST_ADD 45
#define INST_SUB 46
#define INST_MULT 47
#define INST_DIV 48
#define INST_MOD 49
#define INST_UPLUS 50
#define INST_UMINUS 51
#define INST_BITNOT 52
#define INST_EXPON 53
#define INST_CALL_BUILTIN_FUNC 54
#define INST_CALL_FUNC 55
#define INST_TRY_CVT_TO_NUMERIC 56
#define INST_STR_CMP 57
#define INST_STR_LEN 58
#define INST_STR_INDEX 59
#define INST_STR_MATCH 60
#define INST_LIST 61
#define INST_LIST_INDEX 62
#define INST_LIST_LENGTH 63
#define INST_LIST_INDEX_MULTI 64
#define INST_LSET_LIST 65
#define INST_LSET_FLAT 66
#define INST_LIST_INDEX_IMM 67
#define INST_LIST_RANGE_IMM 68
/* The last opcode */
#define LAST_INST_OPCODE 68
/*
* Table describing the Tcl bytecode instructions: their name (for
* displaying code), their stack effect, the number and type of operands.
* These operand types include signed and unsigned integers (the length is
* determined by the quantity of operands: TclPSizedInt if it is one operand,
* half that if there are two). The unsigned integers are used for indexes or
* for, e.g., the count of objects to push in a "push" instruction.
* Note that every instruction+operands is emitted taking 2*sizeof(void *)
* bytes, even if it has no operands, in order to simplify the optimizer's
* algorithm. The optimizer may later choose to eliminate those redundant
* words (assuming the executor is prepared for that).
*/
#define MAX_INSTRUCTION_OPERANDS 2
typedef enum InstOperandType {
OPERAND_NONE,
OPERAND_INT, /* Signed integer. */
OPERAND_UINT, /* Unsigned integer. */
OPERAND_IDX, /* Signed index (actually an integer, but
* displayed differently.) */
OPERAND_OFFSET, /* Offset from current pc. */
} InstOperandType;
/*
* Types assumed for the Tcl_Obj that the instructions may consume and leave
* on the stack. Input for the optimiser.
*/
typedef enum InstIOType {
B, /* Boolean (0/1) */
I, /* Integer */
N, /* Number */
A, /* Any type. */
V /* None (void) */
} InstIOType;
typedef struct InstructionDesc {
char *name; /* Name of instruction. */
int stackEffect; /* The worst-case balance stack effect of the
* instruction, used for stack requirements
* computations. The value INT_MIN signals
* that the instruction's worst case effect
* is (1-opnd1).*/
InstIOType input; /* Type assumed for the elements taken off the
* stack; if several types, state the weakest */
InstIOType result; /* Guaranteed type of the result pushed onto
* the stack. */
int numOperands; /* Number of operands. */
InstOperandType opTypes[MAX_INSTRUCTION_OPERANDS];
/* The type of each operand. */
#if 0
int instProps; /* OR-ed values of the flags below. */
#endif
} InstructionDesc;
/*
* Flags describing the stack interaction of an instruction, used by the
* optimiser to remove unnecessary type conversions or negations.
*/
#define IDESC_PUSH 0x01 /* Pushes a result obj */
#define IDESC_OUT_NUM 0x02 /* Result obj is numeric */
#define IDESC_OUT_INT 0x04 /* Result obj is integer */
#define IDESC_OUT_BOOL 0x08 /* Result obj is 0/1; these instructions can
* be negated; they are arranged in pairs so
* that flipping the last bit (^1) negates. */
#define IDESC_IN_NUM 0x10 /* Converts input args to numeric or boolean
* types. */
MODULE_SCOPE InstructionDesc tclInstructionTable[];
/*
* Compilation of some Tcl constructs such as if commands and the logical or
* (||) and logical and (&&) operators in expressions requires the
* generation of forward jumps. Since the PC target of these jumps isn't
* known when the jumps are emitted, we provide a pair of functions that
* emit the jump, and then fixup the target. The function to emit the
* forward jump needs to know what kind of jump it is.
*/
#define JUMPFIXUP_INIT_ENTRIES 10
typedef struct JumpFixupArray {
int *fixup; /* Points to start of jump fixup array. */
int next; /* Index of next free array entry. */
int end; /* Index of last usable entry in array. */
int mallocedArray; /* 1 if array was expanded and fixups points
* into the heap, else 0. */
int staticFixupSpace[JUMPFIXUP_INIT_ENTRIES];
/* Initial storage for jump fixup array. */
} JumpFixupArray;
/*
* The structure describing one variable list of a foreach command. Note
* that only foreach commands inside procedure bodies are compiled inline so
* a ForeachVarList structure always describes local variables. Furthermore,
|
| ︙ | ︙ | |||
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 |
* lists of the foreach command. */
int firstValueTemp; /* Index of the first temp var in a proc
* frame used to point to a value list. */
int loopCtTemp; /* Index of temp var in a proc frame
* holding the loop's iteration count. Used
* to determine next value list element to
* assign each loop var. */
ForeachVarList *varLists[1];/* An array of pointers to ForeachVarList
* structures describing each var list. The
* actual size of this field will be large
* enough to numVars indexes. THIS MUST BE
* THE LAST FIELD IN THE STRUCTURE! */
} ForeachInfo;
MODULE_SCOPE AuxDataType tclForeachInfoType;
/*
*----------------------------------------------------------------
* Procedures exported by tclBasic.c to be used within the engine.
*----------------------------------------------------------------
*/
MODULE_SCOPE int TclEvalObjvInternal _ANSI_ARGS_((Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[],
CONST char *command, int length, int flags));
| > > > > < < | 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 |
* lists of the foreach command. */
int firstValueTemp; /* Index of the first temp var in a proc
* frame used to point to a value list. */
int loopCtTemp; /* Index of temp var in a proc frame
* holding the loop's iteration count. Used
* to determine next value list element to
* assign each loop var. */
int rangeIndex; /* Index of the bytecode's exception range
* that stores this loop's data */
TclVMWord *restartPc; /* Filled at run time, caches the range's
* target pc for 'code'. */
ForeachVarList *varLists[1];/* An array of pointers to ForeachVarList
* structures describing each var list. The
* actual size of this field will be large
* enough to numVars indexes. THIS MUST BE
* THE LAST FIELD IN THE STRUCTURE! */
} ForeachInfo;
MODULE_SCOPE AuxDataType tclForeachInfoType;
/*
*----------------------------------------------------------------
* Procedures exported by tclBasic.c to be used within the engine.
*----------------------------------------------------------------
*/
MODULE_SCOPE int TclEvalObjvInternal _ANSI_ARGS_((Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[],
CONST char *command, int length, int flags));
/*
*----------------------------------------------------------------
* Procedures exported by the engine to be used by tclBasic.c
*----------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
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 | /* *---------------------------------------------------------------- * Procedures shared among Tcl bytecode compilation and execution * modules but not used outside: *---------------------------------------------------------------- */ MODULE_SCOPE void TclCleanupByteCode _ANSI_ARGS_((ByteCode *codePtr)); MODULE_SCOPE void TclCompileCmdWord _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, CompileEnv *envPtr)); MODULE_SCOPE int TclCompileExpr _ANSI_ARGS_((Tcl_Interp *interp, CONST char *script, int numBytes, CompileEnv *envPtr)); MODULE_SCOPE void TclCompileExprWords _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Token *tokenPtr, int numWords, CompileEnv *envPtr)); MODULE_SCOPE void TclCompileScript _ANSI_ARGS_((Tcl_Interp *interp, CONST char *script, int numBytes, CompileEnv *envPtr)); MODULE_SCOPE void TclCompileTokens _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, CompileEnv *envPtr)); MODULE_SCOPE int TclCreateAuxData _ANSI_ARGS_((ClientData clientData, AuxDataType *typePtr, CompileEnv *envPtr)); | > < < < < > > | | < < < | | | > > | 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 |
/*
*----------------------------------------------------------------
* Procedures shared among Tcl bytecode compilation and execution
* modules but not used outside:
*----------------------------------------------------------------
*/
EXTERN int TclBeginExceptRange _ANSI_ARGS_((CompileEnv *envPtr));
MODULE_SCOPE void TclCleanupByteCode _ANSI_ARGS_((ByteCode *codePtr));
MODULE_SCOPE void TclCompileCmdWord _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Token *tokenPtr, int count,
CompileEnv *envPtr));
MODULE_SCOPE int TclCompileExpr _ANSI_ARGS_((Tcl_Interp *interp,
CONST char *script, int numBytes,
CompileEnv *envPtr));
MODULE_SCOPE void TclCompileExprWords _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Token *tokenPtr, int numWords,
CompileEnv *envPtr));
MODULE_SCOPE void TclCompileScript _ANSI_ARGS_((Tcl_Interp *interp,
CONST char *script, int numBytes,
CompileEnv *envPtr));
MODULE_SCOPE void TclCompileTokens _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Token *tokenPtr, int count,
CompileEnv *envPtr));
MODULE_SCOPE int TclCreateAuxData _ANSI_ARGS_((ClientData clientData,
AuxDataType *typePtr, CompileEnv *envPtr));
MODULE_SCOPE ExecEnv * TclCreateExecEnv _ANSI_ARGS_((Tcl_Interp *interp));
MODULE_SCOPE void TclDeleteExecEnv _ANSI_ARGS_((ExecEnv *eePtr));
MODULE_SCOPE void TclDeleteLiteralTable _ANSI_ARGS_((
Tcl_Interp *interp, LiteralTable *tablePtr));
MODULE_SCOPE ExceptionRange * TclGetExceptionRangeForPc _ANSI_ARGS_((
unsigned char *pc, int catchOnly,
ByteCode* codePtr));
EXTERN void TclEndExceptRange _ANSI_ARGS_((
int index, CompileEnv *envPtr));
EXTERN void TclExpandJumpFixupArray _ANSI_ARGS_((
JumpFixupArray *fixupArrayPtr));
MODULE_SCOPE void TclFinalizeAuxDataTypeTable _ANSI_ARGS_((void));
MODULE_SCOPE int TclFindCompiledLocal _ANSI_ARGS_((CONST char *name,
int nameChars, int create, int flags,
Proc *procPtr));
MODULE_SCOPE LiteralEntry * TclLookupLiteralEntry _ANSI_ARGS_((
Tcl_Interp *interp, Tcl_Obj *objPtr));
MODULE_SCOPE void TclFreeCompileEnv _ANSI_ARGS_((CompileEnv *envPtr));
EXTERN void TclFreeJumpFixupArray _ANSI_ARGS_((
JumpFixupArray *fixupArrayPtr));
MODULE_SCOPE void TclInitAuxDataTypeTable _ANSI_ARGS_((void));
MODULE_SCOPE void TclInitByteCodeObj _ANSI_ARGS_((Tcl_Obj *objPtr,
CompileEnv *envPtr));
MODULE_SCOPE void TclInitCompilation _ANSI_ARGS_((void));
MODULE_SCOPE void TclInitCompileEnv _ANSI_ARGS_((Tcl_Interp *interp,
CompileEnv *envPtr, char *string,
int numBytes));
EXTERN void TclInitJumpFixupArray _ANSI_ARGS_((
JumpFixupArray *fixupArrayPtr));
MODULE_SCOPE void TclInitLiteralTable _ANSI_ARGS_((
LiteralTable *tablePtr));
#ifdef TCL_COMPILE_STATS
MODULE_SCOPE char * TclLiteralStats _ANSI_ARGS_((
LiteralTable *tablePtr));
MODULE_SCOPE int TclLog2 _ANSI_ARGS_((int value));
#endif
#ifdef TCL_COMPILE_DEBUG
MODULE_SCOPE void TclPrintByteCodeObj _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
#endif
MODULE_SCOPE int TclPrintInstruction _ANSI_ARGS_((ByteCode* codePtr,
TclVMWord *pc));
MODULE_SCOPE void TclPrintObject _ANSI_ARGS_((FILE *outFile,
Tcl_Obj *objPtr, int maxChars));
MODULE_SCOPE void TclPrintSource _ANSI_ARGS_((FILE *outFile,
CONST char *string, int maxChars));
MODULE_SCOPE void TclOptimiseByteCode _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
MODULE_SCOPE void TclRegisterAuxDataType _ANSI_ARGS_((AuxDataType *typePtr));
MODULE_SCOPE int TclRegisterLiteral _ANSI_ARGS_((CompileEnv *envPtr,
char *bytes, int length, int flags));
MODULE_SCOPE void TclReleaseLiteral _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
MODULE_SCOPE void TclSetCmdNameObj _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr, Command *cmdPtr));
|
| ︙ | ︙ | |||
860 861 862 863 864 865 866 867 868 869 870 871 872 873 | /* *---------------------------------------------------------------- * Macros and flag values used by Tcl bytecode compilation and execution * modules inside the Tcl core but not used outside. *---------------------------------------------------------------- */ #define LITERAL_ON_HEAP 0x01 #define LITERAL_NS_SCOPE 0x02 /* * Form of TclRegisterLiteral with onHeap == 0. * In that case, it is safe to cast away CONSTness, and it * is cleanest to do that here, all in one place. | > > | 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | /* *---------------------------------------------------------------- * Macros and flag values used by Tcl bytecode compilation and execution * modules inside the Tcl core but not used outside. *---------------------------------------------------------------- */ #define VM_ENABLE_OPTIMISER 1 #define LITERAL_ON_HEAP 0x01 #define LITERAL_NS_SCOPE 0x02 /* * Form of TclRegisterLiteral with onHeap == 0. * In that case, it is safe to cast away CONSTness, and it * is cleanest to do that here, all in one place. |
| ︙ | ︙ | |||
885 886 887 888 889 890 891 |
#define TclRegisterNewNSLiteral(envPtr, bytes, length) \
TclRegisterLiteral(envPtr, (char *)(bytes), length, \
/*flags*/ LITERAL_NS_SCOPE)
/*
| | > > > > > > | | | < < < > | > > > > > | | | | > > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | > | > > > | | | | | | | | | < | > | | < > > | > | | > | | | > > | < > > > > > > > > > > | > > | | < | > > > > | | < > > > > > | > < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 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 |
#define TclRegisterNewNSLiteral(envPtr, bytes, length) \
TclRegisterLiteral(envPtr, (char *)(bytes), length, \
/*flags*/ LITERAL_NS_SCOPE)
/*
* Macros used to manually adjust the stack requirements; used
* in cases where the stack effect cannot be computed from
* the opcode and its operands, but is still known at
* compile time.
*/
#define TclAdjustStackDepth(delta, envPtr) \
if ((delta) < 0) {\
if((envPtr)->maxStackDepth < (envPtr)->currStackDepth) {\
(envPtr)->maxStackDepth = (envPtr)->currStackDepth;\
}\
}\
(envPtr)->currStackDepth += (delta)
#define TclSetStackDepth(depth, envPtr) \
if((envPtr)->maxStackDepth < (envPtr)->currStackDepth) {\
(envPtr)->maxStackDepth = (envPtr)->currStackDepth;\
}\
(envPtr)->currStackDepth = (depth)
/*
* Macro used to update the stack requirements.
* It is called by the macros TclEmitOpCode, TclEmitInst1 and
* TclEmitInst.
* Remark that the very last instruction of a bytecode always
* reduces the stack level: INST_DONE or INST_POP, so that the
* maxStackdepth is always updated.
*/
#define TclUpdateStackReqs(op, i, envPtr) \
{\
int delta = tclInstructionTable[(op)].stackEffect;\
if (delta) {\
if (delta == INT_MIN) {\
delta = 1 - (i);\
}\
TclAdjustStackDepth(delta, envPtr);\
}\
}
/*
* Macros for the optimiser (temp)
* What is a noop? 'INST_JUMP 1' - precise def depends on the engine model.
*/
#ifdef VM_USE_PACKED
#define TclInstIsNoop(op) \
((op) == ((((TclPSizedInt) 1 << P_SHIFT) | INST_JUMP) ))
#define TclNegateInstAtPtr(p) *(p)^=1
#else
#define TclNegateInstAtPtr(p) (*(p)).inst^=1
#define TclInstIsNoop(op) \
(((op).inst == INST_JUMP) && ((op).opnd == 1))
#endif
#define TclStoreNoopAtPtr(p) \
TclVMStoreInstAtPtr(INST_JUMP, (p));\
TclVMStoreOpndAtPtr(1, (p))
/*
* Macros to emit an instruction with integer operands.
*/
#ifdef VM_USE_PACKED
/* This test maybe should be distributed, so that it isn't performed for every
* INST? */
#define TclEmitInst1(op, n, envPtr) \
if (TclInstIsJump(op) && \
(abs((TclPSizedInt)(n)) > HPINT_MAX)) \
Tcl_Panic("Oversize jump.");\
if (((envPtr)->codeNext + 1) > (envPtr)->codeEnd) { \
TclExpandCodeArray(envPtr); \
} \
TclVMStoreWordAtPtr((op), (n), (envPtr)->codeNext);\
(envPtr)->codeNext++;\
TclUpdateStackReqs((op), (n), envPtr)
#else
#define TclEmitInst1(op, n, envPtr) \
if (((envPtr)->codeNext + 1) > (envPtr)->codeEnd) { \
TclExpandCodeArray(envPtr); \
} \
TclVMStoreWordAtPtr((op), (n), (envPtr)->codeNext);\
(envPtr)->codeNext++;\
TclUpdateStackReqs((op), (n), envPtr)
#endif
#define TclEmitInst2(op, n, u, envPtr)\
{\
TclPSizedInt z = HP_STASH((n), (u));\
TclEmitInst1((op), z, envPtr);\
}
#define TclEmitInst0(op, envPtr) \
TclEmitInst1((op), 0, envPtr)
/*
* Macro to push a Tcl object onto the Tcl evaluation stack. It emits the
* object's array index into the CompileEnv's code array.
*/
#define TclEmitPush(objIndex, envPtr) \
TclEmitInst1(INST_PUSH, (objIndex), (envPtr))
/*
* Compilation of some Tcl constructs such as if commands and the logical or
* (||) and logical and (&&) operators in expressions requires the
* generation of forward jumps. Since the PC target of these jumps isn't
* known when the jumps are emitted, we record the offset of each jump with
* the macro TclEmitForwardJump. When we learn the target PC, we update the
* jumps with the correct distance using the macro TclSetJumpTarget.
*/
#define TclEmitForwardJump(envPtr, inst, fixOffset) \
(fixOffset) = (envPtr->codeNext - envPtr->codeStart);\
TclEmitInst1((inst), 1, (envPtr)) /* a NOOP */
#ifdef VM_USE_PACKED
#define TclSetJumpTarget(envPtr, fixOffset) \
{\
ptrdiff_t jumpDist =\
(envPtr->codeNext - envPtr->codeStart) - (fixOffset);\
TclVMWord *fixPc = envPtr->codeStart + fixOffset;\
if (abs(jumpDist) > HPINT_MAX) Tcl_Panic("Oversize jump.");\
TclVMStoreOpndAtPtr(jumpDist, fixPc);\
}
#else
#define TclSetJumpTarget(envPtr, fixOffset) \
{\
ptrdiff_t jumpDist =\
(envPtr->codeNext - envPtr->codeStart) - (fixOffset);\
TclVMWord *fixPc = envPtr->codeStart + fixOffset;\
TclVMStoreOpndAtPtr(jumpDist, fixPc);\
}
#endif
/*
* Macros to update a (signed or unsigned) integer starting at a pointer.
* The two variants depend on the number of bytes. The ANSI C "prototypes"
* for these macros are:
*
* MODULE_SCOPE void TclStoreInt1AtPtr _ANSI_ARGS_((int i, unsigned char *p));
* MODULE_SCOPE void TclStoreInt4AtPtr _ANSI_ARGS_((int i, unsigned char *p));
*/
#define TclStoreInt1AtPtr(i, p) \
*(p) = (unsigned char) ((unsigned int) (i))
#define TclStoreInt4AtPtr(i, p) \
*(p) = (unsigned char) ((unsigned int) (i) >> 24); \
*(p+1) = (unsigned char) ((unsigned int) (i) >> 16); \
*(p+2) = (unsigned char) ((unsigned int) (i) >> 8); \
*(p+3) = (unsigned char) ((unsigned int) (i) )
/*
* Macros to get a signed integer (GET_INT{1,2}) or an unsigned int
* (GET_UINT{1,2}) from a pointer. There are two variants for each
* return type that depend on the number of bytes fetched.
* The ANSI C "prototypes" for these macros are:
*
* MODULE_SCOPE int TclGetInt1AtPtr _ANSI_ARGS_((unsigned char *p));
|
| ︙ | ︙ | |||
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 | # ifdef HAVE_SIGNED_CHAR # define TclGetInt1AtPtr(p) ((int) *((signed char *) p)) # else # define TclGetInt1AtPtr(p) (((int) *((char *) p)) \ | ((*(p) & 0200) ? (-256) : 0)) # endif #endif #define TclGetInt4AtPtr(p) (((int) TclGetInt1AtPtr(p) << 24) | \ (*((p)+1) << 16) | \ (*((p)+2) << 8) | \ (*((p)+3))) | > > > > < | > | 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 |
# ifdef HAVE_SIGNED_CHAR
# define TclGetInt1AtPtr(p) ((int) *((signed char *) p))
# else
# define TclGetInt1AtPtr(p) (((int) *((char *) p)) \
| ((*(p) & 0200) ? (-256) : 0))
# endif
#endif
#define TclGetUInt1AtPtr(p) ((unsigned int) *(p))
#define TclGetUInt1AtPtr(p) ((unsigned int) *(p))
#define TclGetInt4AtPtr(p) (((int) TclGetInt1AtPtr(p) << 24) | \
(*((p)+1) << 16) | \
(*((p)+2) << 8) | \
(*((p)+3)))
#define TclGetUInt4AtPtr(p) ((unsigned int) (*(p) << 24) | \
(*((p)+1) << 16) | \
(*((p)+2) << 8) | \
(*((p)+3)))
/*
* Macros used to compute the minimum and maximum of two integers.
* The ANSI C "prototypes" for these macros are:
*
* MODULE_SCOPE int TclMin _ANSI_ARGS_((int i, int j));
* MODULE_SCOPE int TclMax _ANSI_ARGS_((int i, int j));
*/
#define TclMin(i, j) ((((int) i) < ((int) j))? (i) : (j))
#define TclMax(i, j) ((((int) i) > ((int) j))? (i) : (j))
#endif /* _TCLCOMPILATION */
|
Changes to generic/tclConfig.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclConfig.c -- * * This file provides the facilities which allow Tcl and other packages * to embed configuration information into their binary libraries. * * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclConfig.c -- * * This file provides the facilities which allow Tcl and other packages * to embed configuration information into their binary libraries. * * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclConfig.c,v 1.6.4.2 2005/06/13 01:45:46 msofer Exp $ */ #include "tclInt.h" /* |
| ︙ | ︙ | |||
192 193 194 195 196 197 198 |
QueryConfigObjCmd(clientData, interp, objc, objv)
ClientData clientData;
Tcl_Interp *interp;
int objc;
struct Tcl_Obj * CONST *objv;
{
Tcl_Obj *pkgName = (Tcl_Obj*) clientData;
| | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
QueryConfigObjCmd(clientData, interp, objc, objv)
ClientData clientData;
Tcl_Interp *interp;
int objc;
struct Tcl_Obj * CONST *objv;
{
Tcl_Obj *pkgName = (Tcl_Obj*) clientData;
Tcl_Obj *pDB, *pkgDict, *val, *listPtr;
Tcl_DictSearch s;
int n, i, res, done, index;
Tcl_Obj *key, **vals;
static CONST char *subcmdStrings[] = {
"get", "list", NULL
};
|
| ︙ | ︙ | |||
244 245 246 247 248 249 250 |
case CFG_LIST:
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "list");
return TCL_ERROR;
}
Tcl_DictObjSize(interp, pkgDict, &n);
| > | > | > | | > > > | > > | | | > | | > | | 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 |
case CFG_LIST:
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "list");
return TCL_ERROR;
}
Tcl_DictObjSize(interp, pkgDict, &n);
listPtr = Tcl_NewListObj(n, NULL);
if (!listPtr) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("insufficient memory to create list", -1));
return TCL_ERROR;
}
if (n) {
List *listRepPtr =
(List *) listPtr->internalRep.twoPtrValue.ptr1;
listRepPtr->elemCount = n;
vals = &listRepPtr->elements;
for (i=0, Tcl_DictObjFirst(interp, pkgDict, &s, &key, NULL, &done);
!done; Tcl_DictObjNext(&s, &key, NULL, &done), i++) {
vals[i] = key;
Tcl_IncrRefCount(key);
}
}
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
default:
Tcl_Panic("QueryConfigObjCmd: Unknown subcommand to 'pkgconfig'. This can't happen");
break;
}
return TCL_ERROR;
|
| ︙ | ︙ |
Changes to generic/tclDecls.h.
1 2 3 4 5 6 7 8 9 10 | /* * tclDecls.h -- * * Declarations of functions in the platform independent public Tcl API. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclDecls.h -- * * Declarations of functions in the platform independent public Tcl API. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclDecls.h,v 1.110.2.1 2005/06/13 01:46:02 msofer Exp $ */ #ifndef _TCLDECLS #define _TCLDECLS #undef TCL_STORAGE_CLASS #ifdef BUILD_tcl |
| ︙ | ︙ | |||
223 224 225 226 227 228 229 | /* 30 */ EXTERN void TclFreeObj _ANSI_ARGS_((Tcl_Obj * objPtr)); #endif #ifndef Tcl_GetBoolean_TCL_DECLARED #define Tcl_GetBoolean_TCL_DECLARED /* 31 */ EXTERN int Tcl_GetBoolean _ANSI_ARGS_((Tcl_Interp * interp, | | | | | 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 | /* 30 */ EXTERN void TclFreeObj _ANSI_ARGS_((Tcl_Obj * objPtr)); #endif #ifndef Tcl_GetBoolean_TCL_DECLARED #define Tcl_GetBoolean_TCL_DECLARED /* 31 */ EXTERN int Tcl_GetBoolean _ANSI_ARGS_((Tcl_Interp * interp, CONST char * src, int * boolPtr)); #endif #ifndef Tcl_GetBooleanFromObj_TCL_DECLARED #define Tcl_GetBooleanFromObj_TCL_DECLARED /* 32 */ EXTERN int Tcl_GetBooleanFromObj _ANSI_ARGS_(( Tcl_Interp * interp, Tcl_Obj * objPtr, int * boolPtr)); #endif #ifndef Tcl_GetByteArrayFromObj_TCL_DECLARED #define Tcl_GetByteArrayFromObj_TCL_DECLARED /* 33 */ EXTERN unsigned char * Tcl_GetByteArrayFromObj _ANSI_ARGS_(( Tcl_Obj * objPtr, int * lengthPtr)); #endif #ifndef Tcl_GetDouble_TCL_DECLARED #define Tcl_GetDouble_TCL_DECLARED /* 34 */ EXTERN int Tcl_GetDouble _ANSI_ARGS_((Tcl_Interp * interp, CONST char * src, double * doublePtr)); #endif #ifndef Tcl_GetDoubleFromObj_TCL_DECLARED #define Tcl_GetDoubleFromObj_TCL_DECLARED /* 35 */ EXTERN int Tcl_GetDoubleFromObj _ANSI_ARGS_(( Tcl_Interp * interp, Tcl_Obj * objPtr, double * doublePtr)); #endif #ifndef Tcl_GetIndexFromObj_TCL_DECLARED #define Tcl_GetIndexFromObj_TCL_DECLARED /* 36 */ EXTERN int Tcl_GetIndexFromObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CONST84 char ** tablePtr, CONST char * msg, int flags, int * indexPtr)); #endif #ifndef Tcl_GetInt_TCL_DECLARED #define Tcl_GetInt_TCL_DECLARED /* 37 */ EXTERN int Tcl_GetInt _ANSI_ARGS_((Tcl_Interp * interp, CONST char * src, int * intPtr)); #endif #ifndef Tcl_GetIntFromObj_TCL_DECLARED #define Tcl_GetIntFromObj_TCL_DECLARED /* 38 */ EXTERN int Tcl_GetIntFromObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * intPtr)); #endif |
| ︙ | ︙ | |||
452 453 454 455 456 457 458 | /* 68 */ EXTERN void Tcl_AllowExceptions _ANSI_ARGS_((Tcl_Interp * interp)); #endif #ifndef Tcl_AppendElement_TCL_DECLARED #define Tcl_AppendElement_TCL_DECLARED /* 69 */ EXTERN void Tcl_AppendElement _ANSI_ARGS_((Tcl_Interp * interp, | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | /* 68 */ EXTERN void Tcl_AllowExceptions _ANSI_ARGS_((Tcl_Interp * interp)); #endif #ifndef Tcl_AppendElement_TCL_DECLARED #define Tcl_AppendElement_TCL_DECLARED /* 69 */ EXTERN void Tcl_AppendElement _ANSI_ARGS_((Tcl_Interp * interp, CONST char * element)); #endif #ifndef Tcl_AppendResult_TCL_DECLARED #define Tcl_AppendResult_TCL_DECLARED /* 70 */ EXTERN void Tcl_AppendResult _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); #endif #ifndef Tcl_AsyncCreate_TCL_DECLARED |
| ︙ | ︙ | |||
768 769 770 771 772 773 774 | EXTERN void Tcl_DoWhenIdle _ANSI_ARGS_((Tcl_IdleProc * proc, ClientData clientData)); #endif #ifndef Tcl_DStringAppend_TCL_DECLARED #define Tcl_DStringAppend_TCL_DECLARED /* 117 */ EXTERN char * Tcl_DStringAppend _ANSI_ARGS_((Tcl_DString * dsPtr, | | | | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | EXTERN void Tcl_DoWhenIdle _ANSI_ARGS_((Tcl_IdleProc * proc, ClientData clientData)); #endif #ifndef Tcl_DStringAppend_TCL_DECLARED #define Tcl_DStringAppend_TCL_DECLARED /* 117 */ EXTERN char * Tcl_DStringAppend _ANSI_ARGS_((Tcl_DString * dsPtr, CONST char * bytes, int length)); #endif #ifndef Tcl_DStringAppendElement_TCL_DECLARED #define Tcl_DStringAppendElement_TCL_DECLARED /* 118 */ EXTERN char * Tcl_DStringAppendElement _ANSI_ARGS_(( Tcl_DString * dsPtr, CONST char * element)); #endif #ifndef Tcl_DStringEndSublist_TCL_DECLARED #define Tcl_DStringEndSublist_TCL_DECLARED /* 119 */ EXTERN void Tcl_DStringEndSublist _ANSI_ARGS_(( Tcl_DString * dsPtr)); #endif |
| ︙ | ︙ | |||
835 836 837 838 839 840 841 | /* 128 */ EXTERN CONST84_RETURN char * Tcl_ErrnoMsg _ANSI_ARGS_((int err)); #endif #ifndef Tcl_Eval_TCL_DECLARED #define Tcl_Eval_TCL_DECLARED /* 129 */ EXTERN int Tcl_Eval _ANSI_ARGS_((Tcl_Interp * interp, | | | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | /* 128 */ EXTERN CONST84_RETURN char * Tcl_ErrnoMsg _ANSI_ARGS_((int err)); #endif #ifndef Tcl_Eval_TCL_DECLARED #define Tcl_Eval_TCL_DECLARED /* 129 */ EXTERN int Tcl_Eval _ANSI_ARGS_((Tcl_Interp * interp, CONST char * script)); #endif #ifndef Tcl_EvalFile_TCL_DECLARED #define Tcl_EvalFile_TCL_DECLARED /* 130 */ EXTERN int Tcl_EvalFile _ANSI_ARGS_((Tcl_Interp * interp, CONST char * fileName)); #endif |
| ︙ | ︙ | |||
872 873 874 875 876 877 878 | CONST char * hiddenCmdToken, CONST char * cmdName)); #endif #ifndef Tcl_ExprBoolean_TCL_DECLARED #define Tcl_ExprBoolean_TCL_DECLARED /* 135 */ EXTERN int Tcl_ExprBoolean _ANSI_ARGS_((Tcl_Interp * interp, | | | | | | 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 | CONST char * hiddenCmdToken, CONST char * cmdName)); #endif #ifndef Tcl_ExprBoolean_TCL_DECLARED #define Tcl_ExprBoolean_TCL_DECLARED /* 135 */ EXTERN int Tcl_ExprBoolean _ANSI_ARGS_((Tcl_Interp * interp, CONST char * expr, int * ptr)); #endif #ifndef Tcl_ExprBooleanObj_TCL_DECLARED #define Tcl_ExprBooleanObj_TCL_DECLARED /* 136 */ EXTERN int Tcl_ExprBooleanObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * ptr)); #endif #ifndef Tcl_ExprDouble_TCL_DECLARED #define Tcl_ExprDouble_TCL_DECLARED /* 137 */ EXTERN int Tcl_ExprDouble _ANSI_ARGS_((Tcl_Interp * interp, CONST char * expr, double * ptr)); #endif #ifndef Tcl_ExprDoubleObj_TCL_DECLARED #define Tcl_ExprDoubleObj_TCL_DECLARED /* 138 */ EXTERN int Tcl_ExprDoubleObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, double * ptr)); #endif #ifndef Tcl_ExprLong_TCL_DECLARED #define Tcl_ExprLong_TCL_DECLARED /* 139 */ EXTERN int Tcl_ExprLong _ANSI_ARGS_((Tcl_Interp * interp, CONST char * expr, long * ptr)); #endif #ifndef Tcl_ExprLongObj_TCL_DECLARED #define Tcl_ExprLongObj_TCL_DECLARED /* 140 */ EXTERN int Tcl_ExprLongObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, long * ptr)); #endif #ifndef Tcl_ExprObj_TCL_DECLARED #define Tcl_ExprObj_TCL_DECLARED /* 141 */ EXTERN int Tcl_ExprObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, Tcl_Obj ** resultPtrPtr)); #endif #ifndef Tcl_ExprString_TCL_DECLARED #define Tcl_ExprString_TCL_DECLARED /* 142 */ EXTERN int Tcl_ExprString _ANSI_ARGS_((Tcl_Interp * interp, CONST char * expr)); #endif #ifndef Tcl_Finalize_TCL_DECLARED #define Tcl_Finalize_TCL_DECLARED /* 143 */ EXTERN void Tcl_Finalize _ANSI_ARGS_((void)); #endif #ifndef Tcl_FindExecutable_TCL_DECLARED |
| ︙ | ︙ | |||
1064 1065 1066 1067 1068 1069 1070 | EXTERN Tcl_Obj * Tcl_GetObjResult _ANSI_ARGS_((Tcl_Interp * interp)); #endif #if !defined(__WIN32__) /* UNIX */ #ifndef Tcl_GetOpenFile_TCL_DECLARED #define Tcl_GetOpenFile_TCL_DECLARED /* 167 */ EXTERN int Tcl_GetOpenFile _ANSI_ARGS_((Tcl_Interp * interp, | | | 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 | EXTERN Tcl_Obj * Tcl_GetObjResult _ANSI_ARGS_((Tcl_Interp * interp)); #endif #if !defined(__WIN32__) /* UNIX */ #ifndef Tcl_GetOpenFile_TCL_DECLARED #define Tcl_GetOpenFile_TCL_DECLARED /* 167 */ EXTERN int Tcl_GetOpenFile _ANSI_ARGS_((Tcl_Interp * interp, CONST char * chanID, int forWriting, int checkUsage, ClientData * filePtr)); #endif #endif /* UNIX */ #ifndef Tcl_GetPathType_TCL_DECLARED #define Tcl_GetPathType_TCL_DECLARED /* 168 */ EXTERN Tcl_PathType Tcl_GetPathType _ANSI_ARGS_((CONST char * path)); |
| ︙ | ︙ | |||
1287 1288 1289 1290 1291 1292 1293 | /* 202 */ EXTERN void Tcl_PrintDouble _ANSI_ARGS_((Tcl_Interp * interp, double value, char * dst)); #endif #ifndef Tcl_PutEnv_TCL_DECLARED #define Tcl_PutEnv_TCL_DECLARED /* 203 */ | | | 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | /* 202 */ EXTERN void Tcl_PrintDouble _ANSI_ARGS_((Tcl_Interp * interp, double value, char * dst)); #endif #ifndef Tcl_PutEnv_TCL_DECLARED #define Tcl_PutEnv_TCL_DECLARED /* 203 */ EXTERN int Tcl_PutEnv _ANSI_ARGS_((CONST char * assignment)); #endif #ifndef Tcl_PosixError_TCL_DECLARED #define Tcl_PosixError_TCL_DECLARED /* 204 */ EXTERN CONST84_RETURN char * Tcl_PosixError _ANSI_ARGS_((Tcl_Interp * interp)); #endif #ifndef Tcl_QueueEvent_TCL_DECLARED |
| ︙ | ︙ | |||
1349 1350 1351 1352 1353 1354 1355 | EXTERN void Tcl_RegisterObjType _ANSI_ARGS_(( Tcl_ObjType * typePtr)); #endif #ifndef Tcl_RegExpCompile_TCL_DECLARED #define Tcl_RegExpCompile_TCL_DECLARED /* 212 */ EXTERN Tcl_RegExp Tcl_RegExpCompile _ANSI_ARGS_((Tcl_Interp * interp, | | | | | 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 | EXTERN void Tcl_RegisterObjType _ANSI_ARGS_(( Tcl_ObjType * typePtr)); #endif #ifndef Tcl_RegExpCompile_TCL_DECLARED #define Tcl_RegExpCompile_TCL_DECLARED /* 212 */ EXTERN Tcl_RegExp Tcl_RegExpCompile _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pattern)); #endif #ifndef Tcl_RegExpExec_TCL_DECLARED #define Tcl_RegExpExec_TCL_DECLARED /* 213 */ EXTERN int Tcl_RegExpExec _ANSI_ARGS_((Tcl_Interp * interp, Tcl_RegExp regexp, CONST char * text, CONST char * start)); #endif #ifndef Tcl_RegExpMatch_TCL_DECLARED #define Tcl_RegExpMatch_TCL_DECLARED /* 214 */ EXTERN int Tcl_RegExpMatch _ANSI_ARGS_((Tcl_Interp * interp, CONST char * text, CONST char * pattern)); #endif #ifndef Tcl_RegExpRange_TCL_DECLARED #define Tcl_RegExpRange_TCL_DECLARED /* 215 */ EXTERN void Tcl_RegExpRange _ANSI_ARGS_((Tcl_RegExp regexp, int index, CONST84 char ** startPtr, CONST84 char ** endPtr)); |
| ︙ | ︙ | |||
1469 1470 1471 1472 1473 1474 1475 | EXTERN int Tcl_SetRecursionLimit _ANSI_ARGS_(( Tcl_Interp * interp, int depth)); #endif #ifndef Tcl_SetResult_TCL_DECLARED #define Tcl_SetResult_TCL_DECLARED /* 232 */ EXTERN void Tcl_SetResult _ANSI_ARGS_((Tcl_Interp * interp, | | | 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | EXTERN int Tcl_SetRecursionLimit _ANSI_ARGS_(( Tcl_Interp * interp, int depth)); #endif #ifndef Tcl_SetResult_TCL_DECLARED #define Tcl_SetResult_TCL_DECLARED /* 232 */ EXTERN void Tcl_SetResult _ANSI_ARGS_((Tcl_Interp * interp, char * result, Tcl_FreeProc * freeProc)); #endif #ifndef Tcl_SetServiceMode_TCL_DECLARED #define Tcl_SetServiceMode_TCL_DECLARED /* 233 */ EXTERN int Tcl_SetServiceMode _ANSI_ARGS_((int mode)); #endif #ifndef Tcl_SetObjErrorCode_TCL_DECLARED |
| ︙ | ︙ | |||
1714 1715 1716 1717 1718 1719 1720 | EXTERN CONST84_RETURN char * Tcl_HashStats _ANSI_ARGS_(( Tcl_HashTable * tablePtr)); #endif #ifndef Tcl_ParseVar_TCL_DECLARED #define Tcl_ParseVar_TCL_DECLARED /* 270 */ EXTERN CONST84_RETURN char * Tcl_ParseVar _ANSI_ARGS_((Tcl_Interp * interp, | | | 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | EXTERN CONST84_RETURN char * Tcl_HashStats _ANSI_ARGS_(( Tcl_HashTable * tablePtr)); #endif #ifndef Tcl_ParseVar_TCL_DECLARED #define Tcl_ParseVar_TCL_DECLARED /* 270 */ EXTERN CONST84_RETURN char * Tcl_ParseVar _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, CONST84 char ** termPtr)); #endif #ifndef Tcl_PkgPresent_TCL_DECLARED #define Tcl_PkgPresent_TCL_DECLARED /* 271 */ EXTERN CONST84_RETURN char * Tcl_PkgPresent _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact)); |
| ︙ | ︙ | |||
1966 1967 1968 1969 1970 1971 1972 | Tcl_Condition * condPtr, Tcl_Mutex * mutexPtr, Tcl_Time * timePtr)); #endif #ifndef Tcl_NumUtfChars_TCL_DECLARED #define Tcl_NumUtfChars_TCL_DECLARED /* 312 */ EXTERN int Tcl_NumUtfChars _ANSI_ARGS_((CONST char * src, | | | 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 | Tcl_Condition * condPtr, Tcl_Mutex * mutexPtr, Tcl_Time * timePtr)); #endif #ifndef Tcl_NumUtfChars_TCL_DECLARED #define Tcl_NumUtfChars_TCL_DECLARED /* 312 */ EXTERN int Tcl_NumUtfChars _ANSI_ARGS_((CONST char * src, int length)); #endif #ifndef Tcl_ReadChars_TCL_DECLARED #define Tcl_ReadChars_TCL_DECLARED /* 313 */ EXTERN int Tcl_ReadChars _ANSI_ARGS_((Tcl_Channel channel, Tcl_Obj * objPtr, int charsToRead, int appendFlag)); |
| ︙ | ︙ | |||
2048 2049 2050 2051 2052 2053 2054 | EXTERN CONST84_RETURN char * Tcl_UtfAtIndex _ANSI_ARGS_((CONST char * src, int index)); #endif #ifndef Tcl_UtfCharComplete_TCL_DECLARED #define Tcl_UtfCharComplete_TCL_DECLARED /* 326 */ EXTERN int Tcl_UtfCharComplete _ANSI_ARGS_((CONST char * src, | | | 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 | EXTERN CONST84_RETURN char * Tcl_UtfAtIndex _ANSI_ARGS_((CONST char * src, int index)); #endif #ifndef Tcl_UtfCharComplete_TCL_DECLARED #define Tcl_UtfCharComplete_TCL_DECLARED /* 326 */ EXTERN int Tcl_UtfCharComplete _ANSI_ARGS_((CONST char * src, int length)); #endif #ifndef Tcl_UtfBackslash_TCL_DECLARED #define Tcl_UtfBackslash_TCL_DECLARED /* 327 */ EXTERN int Tcl_UtfBackslash _ANSI_ARGS_((CONST char * src, int * readPtr, char * dst)); #endif |
| ︙ | ︙ | |||
2193 2194 2195 2196 2197 2198 2199 | #define Tcl_UniCharIsWordChar_TCL_DECLARED /* 351 */ EXTERN int Tcl_UniCharIsWordChar _ANSI_ARGS_((int ch)); #endif #ifndef Tcl_UniCharLen_TCL_DECLARED #define Tcl_UniCharLen_TCL_DECLARED /* 352 */ | | > | | > | | | 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 | #define Tcl_UniCharIsWordChar_TCL_DECLARED /* 351 */ EXTERN int Tcl_UniCharIsWordChar _ANSI_ARGS_((int ch)); #endif #ifndef Tcl_UniCharLen_TCL_DECLARED #define Tcl_UniCharLen_TCL_DECLARED /* 352 */ EXTERN int Tcl_UniCharLen _ANSI_ARGS_(( CONST Tcl_UniChar * uniStr)); #endif #ifndef Tcl_UniCharNcmp_TCL_DECLARED #define Tcl_UniCharNcmp_TCL_DECLARED /* 353 */ EXTERN int Tcl_UniCharNcmp _ANSI_ARGS_((CONST Tcl_UniChar * ucs, CONST Tcl_UniChar * uct, unsigned long numChars)); #endif #ifndef Tcl_UniCharToUtfDString_TCL_DECLARED #define Tcl_UniCharToUtfDString_TCL_DECLARED /* 354 */ EXTERN char * Tcl_UniCharToUtfDString _ANSI_ARGS_(( CONST Tcl_UniChar * uniStr, int uniLength, Tcl_DString * dsPtr)); #endif #ifndef Tcl_UtfToUniCharDString_TCL_DECLARED #define Tcl_UtfToUniCharDString_TCL_DECLARED /* 355 */ EXTERN Tcl_UniChar * Tcl_UtfToUniCharDString _ANSI_ARGS_(( CONST char * src, int length, Tcl_DString * dsPtr)); #endif #ifndef Tcl_GetRegExpFromObj_TCL_DECLARED #define Tcl_GetRegExpFromObj_TCL_DECLARED /* 356 */ EXTERN Tcl_RegExp Tcl_GetRegExpFromObj _ANSI_ARGS_(( Tcl_Interp * interp, Tcl_Obj * patObj, |
| ︙ | ︙ | |||
2244 2245 2246 2247 2248 2249 2250 | CONST char * script, CONST char * command, int length)); #endif #ifndef Tcl_ParseBraces_TCL_DECLARED #define Tcl_ParseBraces_TCL_DECLARED /* 360 */ EXTERN int Tcl_ParseBraces _ANSI_ARGS_((Tcl_Interp * interp, | | | | | | | | 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 2283 2284 2285 2286 2287 2288 2289 2290 | CONST char * script, CONST char * command, int length)); #endif #ifndef Tcl_ParseBraces_TCL_DECLARED #define Tcl_ParseBraces_TCL_DECLARED /* 360 */ EXTERN int Tcl_ParseBraces _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, Tcl_Parse * parsePtr, int append, CONST84 char ** termPtr)); #endif #ifndef Tcl_ParseCommand_TCL_DECLARED #define Tcl_ParseCommand_TCL_DECLARED /* 361 */ EXTERN int Tcl_ParseCommand _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, int nested, Tcl_Parse * parsePtr)); #endif #ifndef Tcl_ParseExpr_TCL_DECLARED #define Tcl_ParseExpr_TCL_DECLARED /* 362 */ EXTERN int Tcl_ParseExpr _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, Tcl_Parse * parsePtr)); #endif #ifndef Tcl_ParseQuotedString_TCL_DECLARED #define Tcl_ParseQuotedString_TCL_DECLARED /* 363 */ EXTERN int Tcl_ParseQuotedString _ANSI_ARGS_(( Tcl_Interp * interp, CONST char * start, int numBytes, Tcl_Parse * parsePtr, int append, CONST84 char ** termPtr)); #endif #ifndef Tcl_ParseVarName_TCL_DECLARED #define Tcl_ParseVarName_TCL_DECLARED /* 364 */ EXTERN int Tcl_ParseVarName _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, Tcl_Parse * parsePtr, int append)); #endif #ifndef Tcl_GetCwd_TCL_DECLARED #define Tcl_GetCwd_TCL_DECLARED /* 365 */ EXTERN char * Tcl_GetCwd _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); |
| ︙ | ︙ | |||
2341 2342 2343 2344 2345 2346 2347 | /* 375 */ EXTERN int Tcl_UniCharIsPunct _ANSI_ARGS_((int ch)); #endif #ifndef Tcl_RegExpExecObj_TCL_DECLARED #define Tcl_RegExpExecObj_TCL_DECLARED /* 376 */ EXTERN int Tcl_RegExpExecObj _ANSI_ARGS_((Tcl_Interp * interp, | | | 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | /* 375 */ EXTERN int Tcl_UniCharIsPunct _ANSI_ARGS_((int ch)); #endif #ifndef Tcl_RegExpExecObj_TCL_DECLARED #define Tcl_RegExpExecObj_TCL_DECLARED /* 376 */ EXTERN int Tcl_RegExpExecObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_RegExp regexp, Tcl_Obj * textObj, int offset, int nmatches, int flags)); #endif #ifndef Tcl_RegExpGetInfo_TCL_DECLARED #define Tcl_RegExpGetInfo_TCL_DECLARED /* 377 */ EXTERN void Tcl_RegExpGetInfo _ANSI_ARGS_((Tcl_RegExp regexp, Tcl_RegExpInfo * infoPtr)); |
| ︙ | ︙ | |||
2394 2395 2396 2397 2398 2399 2400 | EXTERN void Tcl_AppendUnicodeToObj _ANSI_ARGS_((Tcl_Obj * objPtr, CONST Tcl_UniChar * unicode, int length)); #endif #ifndef Tcl_RegExpMatchObj_TCL_DECLARED #define Tcl_RegExpMatchObj_TCL_DECLARED /* 385 */ EXTERN int Tcl_RegExpMatchObj _ANSI_ARGS_((Tcl_Interp * interp, | | | 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 | EXTERN void Tcl_AppendUnicodeToObj _ANSI_ARGS_((Tcl_Obj * objPtr, CONST Tcl_UniChar * unicode, int length)); #endif #ifndef Tcl_RegExpMatchObj_TCL_DECLARED #define Tcl_RegExpMatchObj_TCL_DECLARED /* 385 */ EXTERN int Tcl_RegExpMatchObj _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * textObj, Tcl_Obj * patternObj)); #endif #ifndef Tcl_SetNotifier_TCL_DECLARED #define Tcl_SetNotifier_TCL_DECLARED /* 386 */ EXTERN void Tcl_SetNotifier _ANSI_ARGS_(( Tcl_NotifierProcs * notifierProcPtr)); #endif |
| ︙ | ︙ | |||
2593 2594 2595 2596 2597 2598 2599 | EXTERN int Tcl_IsChannelExisting _ANSI_ARGS_(( CONST char* channelName)); #endif #ifndef Tcl_UniCharNcasecmp_TCL_DECLARED #define Tcl_UniCharNcasecmp_TCL_DECLARED /* 419 */ EXTERN int Tcl_UniCharNcasecmp _ANSI_ARGS_(( | | | > | | | 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 | EXTERN int Tcl_IsChannelExisting _ANSI_ARGS_(( CONST char* channelName)); #endif #ifndef Tcl_UniCharNcasecmp_TCL_DECLARED #define Tcl_UniCharNcasecmp_TCL_DECLARED /* 419 */ EXTERN int Tcl_UniCharNcasecmp _ANSI_ARGS_(( CONST Tcl_UniChar * ucs, CONST Tcl_UniChar * uct, unsigned long numChars)); #endif #ifndef Tcl_UniCharCaseMatch_TCL_DECLARED #define Tcl_UniCharCaseMatch_TCL_DECLARED /* 420 */ EXTERN int Tcl_UniCharCaseMatch _ANSI_ARGS_(( CONST Tcl_UniChar * uniStr, CONST Tcl_UniChar * uniPattern, int nocase)); #endif #ifndef Tcl_FindHashEntry_TCL_DECLARED #define Tcl_FindHashEntry_TCL_DECLARED /* 421 */ EXTERN Tcl_HashEntry * Tcl_FindHashEntry _ANSI_ARGS_(( Tcl_HashTable * tablePtr, CONST char * key)); #endif |
| ︙ | ︙ | |||
3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 |
#endif
#ifndef Tcl_ChannelThreadActionProc_TCL_DECLARED
#define Tcl_ChannelThreadActionProc_TCL_DECLARED
/* 554 */
EXTERN Tcl_DriverThreadActionProc * Tcl_ChannelThreadActionProc _ANSI_ARGS_((
Tcl_ChannelType * chanTypePtr));
#endif
typedef struct TclStubHooks {
struct TclPlatStubs *tclPlatStubs;
struct TclIntStubs *tclIntStubs;
struct TclIntPlatStubs *tclIntPlatStubs;
} TclStubHooks;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 3503 3504 3505 |
#endif
#ifndef Tcl_ChannelThreadActionProc_TCL_DECLARED
#define Tcl_ChannelThreadActionProc_TCL_DECLARED
/* 554 */
EXTERN Tcl_DriverThreadActionProc * Tcl_ChannelThreadActionProc _ANSI_ARGS_((
Tcl_ChannelType * chanTypePtr));
#endif
#ifndef Tcl_NewBignumObj_TCL_DECLARED
#define Tcl_NewBignumObj_TCL_DECLARED
/* 555 */
EXTERN Tcl_Obj* Tcl_NewBignumObj _ANSI_ARGS_((mp_int* value));
#endif
#ifndef Tcl_DbNewBignumObj_TCL_DECLARED
#define Tcl_DbNewBignumObj_TCL_DECLARED
/* 556 */
EXTERN Tcl_Obj* Tcl_DbNewBignumObj _ANSI_ARGS_((mp_int* value,
CONST char* file, int line));
#endif
#ifndef Tcl_SetBignumObj_TCL_DECLARED
#define Tcl_SetBignumObj_TCL_DECLARED
/* 557 */
EXTERN void Tcl_SetBignumObj _ANSI_ARGS_((Tcl_Obj* obj,
mp_int* value));
#endif
#ifndef Tcl_GetBignumFromObj_TCL_DECLARED
#define Tcl_GetBignumFromObj_TCL_DECLARED
/* 558 */
EXTERN int Tcl_GetBignumFromObj _ANSI_ARGS_((Tcl_Interp* interp,
Tcl_Obj* obj, mp_int* value));
#endif
#ifndef Tcl_TruncateChannel_TCL_DECLARED
#define Tcl_TruncateChannel_TCL_DECLARED
/* 559 */
EXTERN int Tcl_TruncateChannel _ANSI_ARGS_((Tcl_Channel chan,
Tcl_WideInt length));
#endif
#ifndef Tcl_ChannelTruncateProc_TCL_DECLARED
#define Tcl_ChannelTruncateProc_TCL_DECLARED
/* 560 */
EXTERN Tcl_DriverTruncateProc * Tcl_ChannelTruncateProc _ANSI_ARGS_((
Tcl_ChannelType * chanTypePtr));
#endif
typedef struct TclStubHooks {
struct TclPlatStubs *tclPlatStubs;
struct TclIntStubs *tclIntStubs;
struct TclIntPlatStubs *tclIntPlatStubs;
} TclStubHooks;
|
| ︙ | ︙ | |||
3506 3507 3508 3509 3510 3511 3512 |
Tcl_Obj * (*tcl_DbNewDoubleObj) _ANSI_ARGS_((double doubleValue, CONST char * file, int line)); /* 24 */
Tcl_Obj * (*tcl_DbNewListObj) _ANSI_ARGS_((int objc, Tcl_Obj *CONST * objv, CONST char * file, int line)); /* 25 */
Tcl_Obj * (*tcl_DbNewLongObj) _ANSI_ARGS_((long longValue, CONST char * file, int line)); /* 26 */
Tcl_Obj * (*tcl_DbNewObj) _ANSI_ARGS_((CONST char * file, int line)); /* 27 */
Tcl_Obj * (*tcl_DbNewStringObj) _ANSI_ARGS_((CONST char * bytes, int length, CONST char * file, int line)); /* 28 */
Tcl_Obj * (*tcl_DuplicateObj) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 29 */
void (*tclFreeObj) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 30 */
| | | | | 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 |
Tcl_Obj * (*tcl_DbNewDoubleObj) _ANSI_ARGS_((double doubleValue, CONST char * file, int line)); /* 24 */
Tcl_Obj * (*tcl_DbNewListObj) _ANSI_ARGS_((int objc, Tcl_Obj *CONST * objv, CONST char * file, int line)); /* 25 */
Tcl_Obj * (*tcl_DbNewLongObj) _ANSI_ARGS_((long longValue, CONST char * file, int line)); /* 26 */
Tcl_Obj * (*tcl_DbNewObj) _ANSI_ARGS_((CONST char * file, int line)); /* 27 */
Tcl_Obj * (*tcl_DbNewStringObj) _ANSI_ARGS_((CONST char * bytes, int length, CONST char * file, int line)); /* 28 */
Tcl_Obj * (*tcl_DuplicateObj) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 29 */
void (*tclFreeObj) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 30 */
int (*tcl_GetBoolean) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * src, int * boolPtr)); /* 31 */
int (*tcl_GetBooleanFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * boolPtr)); /* 32 */
unsigned char * (*tcl_GetByteArrayFromObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int * lengthPtr)); /* 33 */
int (*tcl_GetDouble) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * src, double * doublePtr)); /* 34 */
int (*tcl_GetDoubleFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, double * doublePtr)); /* 35 */
int (*tcl_GetIndexFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CONST84 char ** tablePtr, CONST char * msg, int flags, int * indexPtr)); /* 36 */
int (*tcl_GetInt) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * src, int * intPtr)); /* 37 */
int (*tcl_GetIntFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * intPtr)); /* 38 */
int (*tcl_GetLongFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, long * longPtr)); /* 39 */
Tcl_ObjType * (*tcl_GetObjType) _ANSI_ARGS_((CONST char * typeName)); /* 40 */
char * (*tcl_GetStringFromObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int * lengthPtr)); /* 41 */
void (*tcl_InvalidateStringRep) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 42 */
int (*tcl_ListObjAppendList) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * listPtr, Tcl_Obj * elemListPtr)); /* 43 */
int (*tcl_ListObjAppendElement) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * listPtr, Tcl_Obj * objPtr)); /* 44 */
|
| ︙ | ︙ | |||
3544 3545 3546 3547 3548 3549 3550 |
void (*tcl_SetListObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int objc, Tcl_Obj *CONST objv[])); /* 62 */
void (*tcl_SetLongObj) _ANSI_ARGS_((Tcl_Obj * objPtr, long longValue)); /* 63 */
void (*tcl_SetObjLength) _ANSI_ARGS_((Tcl_Obj * objPtr, int length)); /* 64 */
void (*tcl_SetStringObj) _ANSI_ARGS_((Tcl_Obj* objPtr, CONST char* bytes, int length)); /* 65 */
void (*tcl_AddErrorInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * message)); /* 66 */
void (*tcl_AddObjErrorInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * message, int length)); /* 67 */
void (*tcl_AllowExceptions) _ANSI_ARGS_((Tcl_Interp * interp)); /* 68 */
| | | 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 |
void (*tcl_SetListObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int objc, Tcl_Obj *CONST objv[])); /* 62 */
void (*tcl_SetLongObj) _ANSI_ARGS_((Tcl_Obj * objPtr, long longValue)); /* 63 */
void (*tcl_SetObjLength) _ANSI_ARGS_((Tcl_Obj * objPtr, int length)); /* 64 */
void (*tcl_SetStringObj) _ANSI_ARGS_((Tcl_Obj* objPtr, CONST char* bytes, int length)); /* 65 */
void (*tcl_AddErrorInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * message)); /* 66 */
void (*tcl_AddObjErrorInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * message, int length)); /* 67 */
void (*tcl_AllowExceptions) _ANSI_ARGS_((Tcl_Interp * interp)); /* 68 */
void (*tcl_AppendElement) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * element)); /* 69 */
void (*tcl_AppendResult) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 70 */
Tcl_AsyncHandler (*tcl_AsyncCreate) _ANSI_ARGS_((Tcl_AsyncProc * proc, ClientData clientData)); /* 71 */
void (*tcl_AsyncDelete) _ANSI_ARGS_((Tcl_AsyncHandler async)); /* 72 */
int (*tcl_AsyncInvoke) _ANSI_ARGS_((Tcl_Interp * interp, int code)); /* 73 */
void (*tcl_AsyncMark) _ANSI_ARGS_((Tcl_AsyncHandler async)); /* 74 */
int (*tcl_AsyncReady) _ANSI_ARGS_((void)); /* 75 */
void (*tcl_BackgroundError) _ANSI_ARGS_((Tcl_Interp * interp)); /* 76 */
|
| ︙ | ︙ | |||
3597 3598 3599 3600 3601 3602 3603 |
void (*tcl_DetachPids) _ANSI_ARGS_((int numPids, Tcl_Pid * pidPtr)); /* 111 */
#endif /* __WIN32__ */
void (*tcl_DeleteTimerHandler) _ANSI_ARGS_((Tcl_TimerToken token)); /* 112 */
void (*tcl_DeleteTrace) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Trace trace)); /* 113 */
void (*tcl_DontCallWhenDeleted) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_InterpDeleteProc * proc, ClientData clientData)); /* 114 */
int (*tcl_DoOneEvent) _ANSI_ARGS_((int flags)); /* 115 */
void (*tcl_DoWhenIdle) _ANSI_ARGS_((Tcl_IdleProc * proc, ClientData clientData)); /* 116 */
| | | | | | | | | 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 |
void (*tcl_DetachPids) _ANSI_ARGS_((int numPids, Tcl_Pid * pidPtr)); /* 111 */
#endif /* __WIN32__ */
void (*tcl_DeleteTimerHandler) _ANSI_ARGS_((Tcl_TimerToken token)); /* 112 */
void (*tcl_DeleteTrace) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Trace trace)); /* 113 */
void (*tcl_DontCallWhenDeleted) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_InterpDeleteProc * proc, ClientData clientData)); /* 114 */
int (*tcl_DoOneEvent) _ANSI_ARGS_((int flags)); /* 115 */
void (*tcl_DoWhenIdle) _ANSI_ARGS_((Tcl_IdleProc * proc, ClientData clientData)); /* 116 */
char * (*tcl_DStringAppend) _ANSI_ARGS_((Tcl_DString * dsPtr, CONST char * bytes, int length)); /* 117 */
char * (*tcl_DStringAppendElement) _ANSI_ARGS_((Tcl_DString * dsPtr, CONST char * element)); /* 118 */
void (*tcl_DStringEndSublist) _ANSI_ARGS_((Tcl_DString * dsPtr)); /* 119 */
void (*tcl_DStringFree) _ANSI_ARGS_((Tcl_DString * dsPtr)); /* 120 */
void (*tcl_DStringGetResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * dsPtr)); /* 121 */
void (*tcl_DStringInit) _ANSI_ARGS_((Tcl_DString * dsPtr)); /* 122 */
void (*tcl_DStringResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * dsPtr)); /* 123 */
void (*tcl_DStringSetLength) _ANSI_ARGS_((Tcl_DString * dsPtr, int length)); /* 124 */
void (*tcl_DStringStartSublist) _ANSI_ARGS_((Tcl_DString * dsPtr)); /* 125 */
int (*tcl_Eof) _ANSI_ARGS_((Tcl_Channel chan)); /* 126 */
CONST84_RETURN char * (*tcl_ErrnoId) _ANSI_ARGS_((void)); /* 127 */
CONST84_RETURN char * (*tcl_ErrnoMsg) _ANSI_ARGS_((int err)); /* 128 */
int (*tcl_Eval) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * script)); /* 129 */
int (*tcl_EvalFile) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * fileName)); /* 130 */
int (*tcl_EvalObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 131 */
void (*tcl_EventuallyFree) _ANSI_ARGS_((ClientData clientData, Tcl_FreeProc * freeProc)); /* 132 */
void (*tcl_Exit) _ANSI_ARGS_((int status)); /* 133 */
int (*tcl_ExposeCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * hiddenCmdToken, CONST char * cmdName)); /* 134 */
int (*tcl_ExprBoolean) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * expr, int * ptr)); /* 135 */
int (*tcl_ExprBooleanObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * ptr)); /* 136 */
int (*tcl_ExprDouble) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * expr, double * ptr)); /* 137 */
int (*tcl_ExprDoubleObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, double * ptr)); /* 138 */
int (*tcl_ExprLong) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * expr, long * ptr)); /* 139 */
int (*tcl_ExprLongObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, long * ptr)); /* 140 */
int (*tcl_ExprObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, Tcl_Obj ** resultPtrPtr)); /* 141 */
int (*tcl_ExprString) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * expr)); /* 142 */
void (*tcl_Finalize) _ANSI_ARGS_((void)); /* 143 */
void (*tcl_FindExecutable) _ANSI_ARGS_((CONST char * argv0)); /* 144 */
Tcl_HashEntry * (*tcl_FirstHashEntry) _ANSI_ARGS_((Tcl_HashTable * tablePtr, Tcl_HashSearch * searchPtr)); /* 145 */
int (*tcl_Flush) _ANSI_ARGS_((Tcl_Channel chan)); /* 146 */
void (*tcl_FreeResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 147 */
int (*tcl_GetAlias) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * slaveCmd, Tcl_Interp ** targetInterpPtr, CONST84 char ** targetCmdPtr, int * argcPtr, CONST84 char *** argvPtr)); /* 148 */
int (*tcl_GetAliasObj) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * slaveCmd, Tcl_Interp ** targetInterpPtr, CONST84 char ** targetCmdPtr, int * objcPtr, Tcl_Obj *** objv)); /* 149 */
|
| ︙ | ︙ | |||
3648 3649 3650 3651 3652 3653 3654 |
int (*tcl_GetErrno) _ANSI_ARGS_((void)); /* 161 */
CONST84_RETURN char * (*tcl_GetHostName) _ANSI_ARGS_((void)); /* 162 */
int (*tcl_GetInterpPath) _ANSI_ARGS_((Tcl_Interp * askInterp, Tcl_Interp * slaveInterp)); /* 163 */
Tcl_Interp * (*tcl_GetMaster) _ANSI_ARGS_((Tcl_Interp * interp)); /* 164 */
CONST char * (*tcl_GetNameOfExecutable) _ANSI_ARGS_((void)); /* 165 */
Tcl_Obj * (*tcl_GetObjResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 166 */
#if !defined(__WIN32__) /* UNIX */
| | | 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 |
int (*tcl_GetErrno) _ANSI_ARGS_((void)); /* 161 */
CONST84_RETURN char * (*tcl_GetHostName) _ANSI_ARGS_((void)); /* 162 */
int (*tcl_GetInterpPath) _ANSI_ARGS_((Tcl_Interp * askInterp, Tcl_Interp * slaveInterp)); /* 163 */
Tcl_Interp * (*tcl_GetMaster) _ANSI_ARGS_((Tcl_Interp * interp)); /* 164 */
CONST char * (*tcl_GetNameOfExecutable) _ANSI_ARGS_((void)); /* 165 */
Tcl_Obj * (*tcl_GetObjResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 166 */
#if !defined(__WIN32__) /* UNIX */
int (*tcl_GetOpenFile) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * chanID, int forWriting, int checkUsage, ClientData * filePtr)); /* 167 */
#endif /* UNIX */
#ifdef __WIN32__
void *reserved167;
#endif /* __WIN32__ */
Tcl_PathType (*tcl_GetPathType) _ANSI_ARGS_((CONST char * path)); /* 168 */
int (*tcl_Gets) _ANSI_ARGS_((Tcl_Channel chan, Tcl_DString * dsPtr)); /* 169 */
int (*tcl_GetsObj) _ANSI_ARGS_((Tcl_Channel chan, Tcl_Obj * objPtr)); /* 170 */
|
| ︙ | ︙ | |||
3693 3694 3695 3696 3697 3698 3699 |
Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST84 char ** argv, int flags)); /* 197 */
#endif /* __WIN32__ */
Tcl_Channel (*tcl_OpenFileChannel) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * fileName, CONST char * modeString, int permissions)); /* 198 */
Tcl_Channel (*tcl_OpenTcpClient) _ANSI_ARGS_((Tcl_Interp * interp, int port, CONST char * address, CONST char * myaddr, int myport, int async)); /* 199 */
Tcl_Channel (*tcl_OpenTcpServer) _ANSI_ARGS_((Tcl_Interp * interp, int port, CONST char * host, Tcl_TcpAcceptProc * acceptProc, ClientData callbackData)); /* 200 */
void (*tcl_Preserve) _ANSI_ARGS_((ClientData data)); /* 201 */
void (*tcl_PrintDouble) _ANSI_ARGS_((Tcl_Interp * interp, double value, char * dst)); /* 202 */
| | | | | | | 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 |
Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST84 char ** argv, int flags)); /* 197 */
#endif /* __WIN32__ */
Tcl_Channel (*tcl_OpenFileChannel) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * fileName, CONST char * modeString, int permissions)); /* 198 */
Tcl_Channel (*tcl_OpenTcpClient) _ANSI_ARGS_((Tcl_Interp * interp, int port, CONST char * address, CONST char * myaddr, int myport, int async)); /* 199 */
Tcl_Channel (*tcl_OpenTcpServer) _ANSI_ARGS_((Tcl_Interp * interp, int port, CONST char * host, Tcl_TcpAcceptProc * acceptProc, ClientData callbackData)); /* 200 */
void (*tcl_Preserve) _ANSI_ARGS_((ClientData data)); /* 201 */
void (*tcl_PrintDouble) _ANSI_ARGS_((Tcl_Interp * interp, double value, char * dst)); /* 202 */
int (*tcl_PutEnv) _ANSI_ARGS_((CONST char * assignment)); /* 203 */
CONST84_RETURN char * (*tcl_PosixError) _ANSI_ARGS_((Tcl_Interp * interp)); /* 204 */
void (*tcl_QueueEvent) _ANSI_ARGS_((Tcl_Event * evPtr, Tcl_QueuePosition position)); /* 205 */
int (*tcl_Read) _ANSI_ARGS_((Tcl_Channel chan, char * bufPtr, int toRead)); /* 206 */
#if !defined(__WIN32__) /* UNIX */
void (*tcl_ReapDetachedProcs) _ANSI_ARGS_((void)); /* 207 */
#endif /* UNIX */
#ifdef __WIN32__
void (*tcl_ReapDetachedProcs) _ANSI_ARGS_((void)); /* 207 */
#endif /* __WIN32__ */
int (*tcl_RecordAndEval) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmd, int flags)); /* 208 */
int (*tcl_RecordAndEvalObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * cmdPtr, int flags)); /* 209 */
void (*tcl_RegisterChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 210 */
void (*tcl_RegisterObjType) _ANSI_ARGS_((Tcl_ObjType * typePtr)); /* 211 */
Tcl_RegExp (*tcl_RegExpCompile) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pattern)); /* 212 */
int (*tcl_RegExpExec) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_RegExp regexp, CONST char * text, CONST char * start)); /* 213 */
int (*tcl_RegExpMatch) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * text, CONST char * pattern)); /* 214 */
void (*tcl_RegExpRange) _ANSI_ARGS_((Tcl_RegExp regexp, int index, CONST84 char ** startPtr, CONST84 char ** endPtr)); /* 215 */
void (*tcl_Release) _ANSI_ARGS_((ClientData clientData)); /* 216 */
void (*tcl_ResetResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 217 */
int (*tcl_ScanElement) _ANSI_ARGS_((CONST char * str, int * flagPtr)); /* 218 */
int (*tcl_ScanCountedElement) _ANSI_ARGS_((CONST char * str, int length, int * flagPtr)); /* 219 */
int (*tcl_SeekOld) _ANSI_ARGS_((Tcl_Channel chan, int offset, int mode)); /* 220 */
int (*tcl_ServiceAll) _ANSI_ARGS_((void)); /* 221 */
int (*tcl_ServiceEvent) _ANSI_ARGS_((int flags)); /* 222 */
void (*tcl_SetAssocData) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_InterpDeleteProc * proc, ClientData clientData)); /* 223 */
void (*tcl_SetChannelBufferSize) _ANSI_ARGS_((Tcl_Channel chan, int sz)); /* 224 */
int (*tcl_SetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, CONST char * optionName, CONST char * newValue)); /* 225 */
int (*tcl_SetCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, CONST Tcl_CmdInfo * infoPtr)); /* 226 */
void (*tcl_SetErrno) _ANSI_ARGS_((int err)); /* 227 */
void (*tcl_SetErrorCode) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 228 */
void (*tcl_SetMaxBlockTime) _ANSI_ARGS_((Tcl_Time * timePtr)); /* 229 */
void (*tcl_SetPanicProc) _ANSI_ARGS_((Tcl_PanicProc * panicProc)); /* 230 */
int (*tcl_SetRecursionLimit) _ANSI_ARGS_((Tcl_Interp * interp, int depth)); /* 231 */
void (*tcl_SetResult) _ANSI_ARGS_((Tcl_Interp * interp, char * result, Tcl_FreeProc * freeProc)); /* 232 */
int (*tcl_SetServiceMode) _ANSI_ARGS_((int mode)); /* 233 */
void (*tcl_SetObjErrorCode) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * errorObjPtr)); /* 234 */
void (*tcl_SetObjResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * resultObjPtr)); /* 235 */
void (*tcl_SetStdChannel) _ANSI_ARGS_((Tcl_Channel channel, int type)); /* 236 */
CONST84_RETURN char * (*tcl_SetVar) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * varName, CONST char * newValue, int flags)); /* 237 */
CONST84_RETURN char * (*tcl_SetVar2) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * part1, CONST char * part2, CONST char * newValue, int flags)); /* 238 */
CONST84_RETURN char * (*tcl_SignalId) _ANSI_ARGS_((int sig)); /* 239 */
|
| ︙ | ︙ | |||
3765 3766 3767 3768 3769 3770 3771 |
int (*tcl_Write) _ANSI_ARGS_((Tcl_Channel chan, CONST char * s, int slen)); /* 263 */
void (*tcl_WrongNumArgs) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], CONST char * message)); /* 264 */
int (*tcl_DumpActiveMemory) _ANSI_ARGS_((CONST char * fileName)); /* 265 */
void (*tcl_ValidateAllMemory) _ANSI_ARGS_((CONST char * file, int line)); /* 266 */
void (*tcl_AppendResultVA) _ANSI_ARGS_((Tcl_Interp * interp, va_list argList)); /* 267 */
void (*tcl_AppendStringsToObjVA) _ANSI_ARGS_((Tcl_Obj * objPtr, va_list argList)); /* 268 */
CONST84_RETURN char * (*tcl_HashStats) _ANSI_ARGS_((Tcl_HashTable * tablePtr)); /* 269 */
| | | 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 |
int (*tcl_Write) _ANSI_ARGS_((Tcl_Channel chan, CONST char * s, int slen)); /* 263 */
void (*tcl_WrongNumArgs) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], CONST char * message)); /* 264 */
int (*tcl_DumpActiveMemory) _ANSI_ARGS_((CONST char * fileName)); /* 265 */
void (*tcl_ValidateAllMemory) _ANSI_ARGS_((CONST char * file, int line)); /* 266 */
void (*tcl_AppendResultVA) _ANSI_ARGS_((Tcl_Interp * interp, va_list argList)); /* 267 */
void (*tcl_AppendStringsToObjVA) _ANSI_ARGS_((Tcl_Obj * objPtr, va_list argList)); /* 268 */
CONST84_RETURN char * (*tcl_HashStats) _ANSI_ARGS_((Tcl_HashTable * tablePtr)); /* 269 */
CONST84_RETURN char * (*tcl_ParseVar) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, CONST84 char ** termPtr)); /* 270 */
CONST84_RETURN char * (*tcl_PkgPresent) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact)); /* 271 */
CONST84_RETURN char * (*tcl_PkgPresentEx) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact, ClientData * clientDataPtr)); /* 272 */
int (*tcl_PkgProvide) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version)); /* 273 */
CONST84_RETURN char * (*tcl_PkgRequire) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact)); /* 274 */
void (*tcl_SetErrorCodeVA) _ANSI_ARGS_((Tcl_Interp * interp, va_list argList)); /* 275 */
int (*tcl_VarEvalVA) _ANSI_ARGS_((Tcl_Interp * interp, va_list argList)); /* 276 */
Tcl_Pid (*tcl_WaitPid) _ANSI_ARGS_((Tcl_Pid pid, int * statPtr, int options)); /* 277 */
|
| ︙ | ︙ | |||
3807 3808 3809 3810 3811 3812 3813 |
VOID * (*tcl_GetThreadData) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr, int size)); /* 305 */
Tcl_Obj * (*tcl_GetVar2Ex) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * part1, CONST char * part2, int flags)); /* 306 */
ClientData (*tcl_InitNotifier) _ANSI_ARGS_((void)); /* 307 */
void (*tcl_MutexLock) _ANSI_ARGS_((Tcl_Mutex * mutexPtr)); /* 308 */
void (*tcl_MutexUnlock) _ANSI_ARGS_((Tcl_Mutex * mutexPtr)); /* 309 */
void (*tcl_ConditionNotify) _ANSI_ARGS_((Tcl_Condition * condPtr)); /* 310 */
void (*tcl_ConditionWait) _ANSI_ARGS_((Tcl_Condition * condPtr, Tcl_Mutex * mutexPtr, Tcl_Time * timePtr)); /* 311 */
| | | | 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 |
VOID * (*tcl_GetThreadData) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr, int size)); /* 305 */
Tcl_Obj * (*tcl_GetVar2Ex) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * part1, CONST char * part2, int flags)); /* 306 */
ClientData (*tcl_InitNotifier) _ANSI_ARGS_((void)); /* 307 */
void (*tcl_MutexLock) _ANSI_ARGS_((Tcl_Mutex * mutexPtr)); /* 308 */
void (*tcl_MutexUnlock) _ANSI_ARGS_((Tcl_Mutex * mutexPtr)); /* 309 */
void (*tcl_ConditionNotify) _ANSI_ARGS_((Tcl_Condition * condPtr)); /* 310 */
void (*tcl_ConditionWait) _ANSI_ARGS_((Tcl_Condition * condPtr, Tcl_Mutex * mutexPtr, Tcl_Time * timePtr)); /* 311 */
int (*tcl_NumUtfChars) _ANSI_ARGS_((CONST char * src, int length)); /* 312 */
int (*tcl_ReadChars) _ANSI_ARGS_((Tcl_Channel channel, Tcl_Obj * objPtr, int charsToRead, int appendFlag)); /* 313 */
void (*tcl_RestoreResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_SavedResult * statePtr)); /* 314 */
void (*tcl_SaveResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_SavedResult * statePtr)); /* 315 */
int (*tcl_SetSystemEncoding) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 316 */
Tcl_Obj * (*tcl_SetVar2Ex) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * part1, CONST char * part2, Tcl_Obj * newValuePtr, int flags)); /* 317 */
void (*tcl_ThreadAlert) _ANSI_ARGS_((Tcl_ThreadId threadId)); /* 318 */
void (*tcl_ThreadQueueEvent) _ANSI_ARGS_((Tcl_ThreadId threadId, Tcl_Event* evPtr, Tcl_QueuePosition position)); /* 319 */
Tcl_UniChar (*tcl_UniCharAtIndex) _ANSI_ARGS_((CONST char * src, int index)); /* 320 */
Tcl_UniChar (*tcl_UniCharToLower) _ANSI_ARGS_((int ch)); /* 321 */
Tcl_UniChar (*tcl_UniCharToTitle) _ANSI_ARGS_((int ch)); /* 322 */
Tcl_UniChar (*tcl_UniCharToUpper) _ANSI_ARGS_((int ch)); /* 323 */
int (*tcl_UniCharToUtf) _ANSI_ARGS_((int ch, char * buf)); /* 324 */
CONST84_RETURN char * (*tcl_UtfAtIndex) _ANSI_ARGS_((CONST char * src, int index)); /* 325 */
int (*tcl_UtfCharComplete) _ANSI_ARGS_((CONST char * src, int length)); /* 326 */
int (*tcl_UtfBackslash) _ANSI_ARGS_((CONST char * src, int * readPtr, char * dst)); /* 327 */
CONST84_RETURN char * (*tcl_UtfFindFirst) _ANSI_ARGS_((CONST char * src, int ch)); /* 328 */
CONST84_RETURN char * (*tcl_UtfFindLast) _ANSI_ARGS_((CONST char * src, int ch)); /* 329 */
CONST84_RETURN char * (*tcl_UtfNext) _ANSI_ARGS_((CONST char * src)); /* 330 */
CONST84_RETURN char * (*tcl_UtfPrev) _ANSI_ARGS_((CONST char * src, CONST char * start)); /* 331 */
int (*tcl_UtfToExternal) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Encoding encoding, CONST char * src, int srcLen, int flags, Tcl_EncodingState * statePtr, char * dst, int dstLen, int * srcReadPtr, int * dstWrotePtr, int * dstCharsPtr)); /* 332 */
char * (*tcl_UtfToExternalDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 333 */
|
| ︙ | ︙ | |||
3847 3848 3849 3850 3851 3852 3853 |
int (*tcl_UniCharIsAlnum) _ANSI_ARGS_((int ch)); /* 345 */
int (*tcl_UniCharIsAlpha) _ANSI_ARGS_((int ch)); /* 346 */
int (*tcl_UniCharIsDigit) _ANSI_ARGS_((int ch)); /* 347 */
int (*tcl_UniCharIsLower) _ANSI_ARGS_((int ch)); /* 348 */
int (*tcl_UniCharIsSpace) _ANSI_ARGS_((int ch)); /* 349 */
int (*tcl_UniCharIsUpper) _ANSI_ARGS_((int ch)); /* 350 */
int (*tcl_UniCharIsWordChar) _ANSI_ARGS_((int ch)); /* 351 */
| | | | | | | | | | | | | 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 |
int (*tcl_UniCharIsAlnum) _ANSI_ARGS_((int ch)); /* 345 */
int (*tcl_UniCharIsAlpha) _ANSI_ARGS_((int ch)); /* 346 */
int (*tcl_UniCharIsDigit) _ANSI_ARGS_((int ch)); /* 347 */
int (*tcl_UniCharIsLower) _ANSI_ARGS_((int ch)); /* 348 */
int (*tcl_UniCharIsSpace) _ANSI_ARGS_((int ch)); /* 349 */
int (*tcl_UniCharIsUpper) _ANSI_ARGS_((int ch)); /* 350 */
int (*tcl_UniCharIsWordChar) _ANSI_ARGS_((int ch)); /* 351 */
int (*tcl_UniCharLen) _ANSI_ARGS_((CONST Tcl_UniChar * uniStr)); /* 352 */
int (*tcl_UniCharNcmp) _ANSI_ARGS_((CONST Tcl_UniChar * ucs, CONST Tcl_UniChar * uct, unsigned long numChars)); /* 353 */
char * (*tcl_UniCharToUtfDString) _ANSI_ARGS_((CONST Tcl_UniChar * uniStr, int uniLength, Tcl_DString * dsPtr)); /* 354 */
Tcl_UniChar * (*tcl_UtfToUniCharDString) _ANSI_ARGS_((CONST char * src, int length, Tcl_DString * dsPtr)); /* 355 */
Tcl_RegExp (*tcl_GetRegExpFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * patObj, int flags)); /* 356 */
Tcl_Obj * (*tcl_EvalTokens) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Token * tokenPtr, int count)); /* 357 */
void (*tcl_FreeParse) _ANSI_ARGS_((Tcl_Parse * parsePtr)); /* 358 */
void (*tcl_LogCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * script, CONST char * command, int length)); /* 359 */
int (*tcl_ParseBraces) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, Tcl_Parse * parsePtr, int append, CONST84 char ** termPtr)); /* 360 */
int (*tcl_ParseCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, int nested, Tcl_Parse * parsePtr)); /* 361 */
int (*tcl_ParseExpr) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, Tcl_Parse * parsePtr)); /* 362 */
int (*tcl_ParseQuotedString) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, Tcl_Parse * parsePtr, int append, CONST84 char ** termPtr)); /* 363 */
int (*tcl_ParseVarName) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * start, int numBytes, Tcl_Parse * parsePtr, int append)); /* 364 */
char * (*tcl_GetCwd) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 365 */
int (*tcl_Chdir) _ANSI_ARGS_((CONST char * dirName)); /* 366 */
int (*tcl_Access) _ANSI_ARGS_((CONST char * path, int mode)); /* 367 */
int (*tcl_Stat) _ANSI_ARGS_((CONST char * path, struct stat * bufPtr)); /* 368 */
int (*tcl_UtfNcmp) _ANSI_ARGS_((CONST char * s1, CONST char * s2, unsigned long n)); /* 369 */
int (*tcl_UtfNcasecmp) _ANSI_ARGS_((CONST char * s1, CONST char * s2, unsigned long n)); /* 370 */
int (*tcl_StringCaseMatch) _ANSI_ARGS_((CONST char * str, CONST char * pattern, int nocase)); /* 371 */
int (*tcl_UniCharIsControl) _ANSI_ARGS_((int ch)); /* 372 */
int (*tcl_UniCharIsGraph) _ANSI_ARGS_((int ch)); /* 373 */
int (*tcl_UniCharIsPrint) _ANSI_ARGS_((int ch)); /* 374 */
int (*tcl_UniCharIsPunct) _ANSI_ARGS_((int ch)); /* 375 */
int (*tcl_RegExpExecObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_RegExp regexp, Tcl_Obj * textObj, int offset, int nmatches, int flags)); /* 376 */
void (*tcl_RegExpGetInfo) _ANSI_ARGS_((Tcl_RegExp regexp, Tcl_RegExpInfo * infoPtr)); /* 377 */
Tcl_Obj * (*tcl_NewUnicodeObj) _ANSI_ARGS_((CONST Tcl_UniChar * unicode, int numChars)); /* 378 */
void (*tcl_SetUnicodeObj) _ANSI_ARGS_((Tcl_Obj * objPtr, CONST Tcl_UniChar * unicode, int numChars)); /* 379 */
int (*tcl_GetCharLength) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 380 */
Tcl_UniChar (*tcl_GetUniChar) _ANSI_ARGS_((Tcl_Obj * objPtr, int index)); /* 381 */
Tcl_UniChar * (*tcl_GetUnicode) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 382 */
Tcl_Obj * (*tcl_GetRange) _ANSI_ARGS_((Tcl_Obj * objPtr, int first, int last)); /* 383 */
void (*tcl_AppendUnicodeToObj) _ANSI_ARGS_((Tcl_Obj * objPtr, CONST Tcl_UniChar * unicode, int length)); /* 384 */
int (*tcl_RegExpMatchObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * textObj, Tcl_Obj * patternObj)); /* 385 */
void (*tcl_SetNotifier) _ANSI_ARGS_((Tcl_NotifierProcs * notifierProcPtr)); /* 386 */
Tcl_Mutex * (*tcl_GetAllocMutex) _ANSI_ARGS_((void)); /* 387 */
int (*tcl_GetChannelNames) _ANSI_ARGS_((Tcl_Interp * interp)); /* 388 */
int (*tcl_GetChannelNamesEx) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pattern)); /* 389 */
int (*tcl_ProcObjCmd) _ANSI_ARGS_((ClientData clientData, Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[])); /* 390 */
void (*tcl_ConditionFinalize) _ANSI_ARGS_((Tcl_Condition * condPtr)); /* 391 */
void (*tcl_MutexFinalize) _ANSI_ARGS_((Tcl_Mutex * mutex)); /* 392 */
|
| ︙ | ︙ | |||
3914 3915 3916 3917 3918 3919 3920 |
int (*tcl_JoinThread) _ANSI_ARGS_((Tcl_ThreadId threadId, int* result)); /* 412 */
int (*tcl_IsChannelShared) _ANSI_ARGS_((Tcl_Channel channel)); /* 413 */
int (*tcl_IsChannelRegistered) _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Channel channel)); /* 414 */
void (*tcl_CutChannel) _ANSI_ARGS_((Tcl_Channel channel)); /* 415 */
void (*tcl_SpliceChannel) _ANSI_ARGS_((Tcl_Channel channel)); /* 416 */
void (*tcl_ClearChannelHandlers) _ANSI_ARGS_((Tcl_Channel channel)); /* 417 */
int (*tcl_IsChannelExisting) _ANSI_ARGS_((CONST char* channelName)); /* 418 */
| | | | 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 |
int (*tcl_JoinThread) _ANSI_ARGS_((Tcl_ThreadId threadId, int* result)); /* 412 */
int (*tcl_IsChannelShared) _ANSI_ARGS_((Tcl_Channel channel)); /* 413 */
int (*tcl_IsChannelRegistered) _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Channel channel)); /* 414 */
void (*tcl_CutChannel) _ANSI_ARGS_((Tcl_Channel channel)); /* 415 */
void (*tcl_SpliceChannel) _ANSI_ARGS_((Tcl_Channel channel)); /* 416 */
void (*tcl_ClearChannelHandlers) _ANSI_ARGS_((Tcl_Channel channel)); /* 417 */
int (*tcl_IsChannelExisting) _ANSI_ARGS_((CONST char* channelName)); /* 418 */
int (*tcl_UniCharNcasecmp) _ANSI_ARGS_((CONST Tcl_UniChar * ucs, CONST Tcl_UniChar * uct, unsigned long numChars)); /* 419 */
int (*tcl_UniCharCaseMatch) _ANSI_ARGS_((CONST Tcl_UniChar * uniStr, CONST Tcl_UniChar * uniPattern, int nocase)); /* 420 */
Tcl_HashEntry * (*tcl_FindHashEntry) _ANSI_ARGS_((Tcl_HashTable * tablePtr, CONST char * key)); /* 421 */
Tcl_HashEntry * (*tcl_CreateHashEntry) _ANSI_ARGS_((Tcl_HashTable * tablePtr, CONST char * key, int * newPtr)); /* 422 */
void (*tcl_InitCustomHashTable) _ANSI_ARGS_((Tcl_HashTable * tablePtr, int keyType, Tcl_HashKeyType * typePtr)); /* 423 */
void (*tcl_InitObjHashTable) _ANSI_ARGS_((Tcl_HashTable * tablePtr)); /* 424 */
ClientData (*tcl_CommandTraceInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * varName, int flags, Tcl_CommandTraceProc * procPtr, ClientData prevClientData)); /* 425 */
int (*tcl_TraceCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * varName, int flags, Tcl_CommandTraceProc * proc, ClientData clientData)); /* 426 */
void (*tcl_UntraceCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * varName, int flags, Tcl_CommandTraceProc * proc, ClientData clientData)); /* 427 */
|
| ︙ | ︙ | |||
4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 |
int (*tcl_GetEnsembleMappingDict) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command token, Tcl_Obj ** mapDictPtr)); /* 548 */
int (*tcl_GetEnsembleUnknownHandler) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command token, Tcl_Obj ** unknownListPtr)); /* 549 */
int (*tcl_GetEnsembleFlags) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command token, int * flagsPtr)); /* 550 */
int (*tcl_GetEnsembleNamespace) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command token, Tcl_Namespace ** namespacePtrPtr)); /* 551 */
void (*tcl_SetTimeProc) _ANSI_ARGS_((Tcl_GetTimeProc* getProc, Tcl_ScaleTimeProc* scaleProc, ClientData clientData)); /* 552 */
void (*tcl_QueryTimeProc) _ANSI_ARGS_((Tcl_GetTimeProc** getProc, Tcl_ScaleTimeProc** scaleProc, ClientData* clientData)); /* 553 */
Tcl_DriverThreadActionProc * (*tcl_ChannelThreadActionProc) _ANSI_ARGS_((Tcl_ChannelType * chanTypePtr)); /* 554 */
} TclStubs;
#ifdef __cplusplus
extern "C" {
#endif
extern TclStubs *tclStubsPtr;
#ifdef __cplusplus
| > > > > > > | 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 |
int (*tcl_GetEnsembleMappingDict) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command token, Tcl_Obj ** mapDictPtr)); /* 548 */
int (*tcl_GetEnsembleUnknownHandler) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command token, Tcl_Obj ** unknownListPtr)); /* 549 */
int (*tcl_GetEnsembleFlags) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command token, int * flagsPtr)); /* 550 */
int (*tcl_GetEnsembleNamespace) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command token, Tcl_Namespace ** namespacePtrPtr)); /* 551 */
void (*tcl_SetTimeProc) _ANSI_ARGS_((Tcl_GetTimeProc* getProc, Tcl_ScaleTimeProc* scaleProc, ClientData clientData)); /* 552 */
void (*tcl_QueryTimeProc) _ANSI_ARGS_((Tcl_GetTimeProc** getProc, Tcl_ScaleTimeProc** scaleProc, ClientData* clientData)); /* 553 */
Tcl_DriverThreadActionProc * (*tcl_ChannelThreadActionProc) _ANSI_ARGS_((Tcl_ChannelType * chanTypePtr)); /* 554 */
Tcl_Obj* (*tcl_NewBignumObj) _ANSI_ARGS_((mp_int* value)); /* 555 */
Tcl_Obj* (*tcl_DbNewBignumObj) _ANSI_ARGS_((mp_int* value, CONST char* file, int line)); /* 556 */
void (*tcl_SetBignumObj) _ANSI_ARGS_((Tcl_Obj* obj, mp_int* value)); /* 557 */
int (*tcl_GetBignumFromObj) _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Obj* obj, mp_int* value)); /* 558 */
int (*tcl_TruncateChannel) _ANSI_ARGS_((Tcl_Channel chan, Tcl_WideInt length)); /* 559 */
Tcl_DriverTruncateProc * (*tcl_ChannelTruncateProc) _ANSI_ARGS_((Tcl_ChannelType * chanTypePtr)); /* 560 */
} TclStubs;
#ifdef __cplusplus
extern "C" {
#endif
extern TclStubs *tclStubsPtr;
#ifdef __cplusplus
|
| ︙ | ︙ | |||
6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 | #define Tcl_QueryTimeProc \ (tclStubsPtr->tcl_QueryTimeProc) /* 553 */ #endif #ifndef Tcl_ChannelThreadActionProc #define Tcl_ChannelThreadActionProc \ (tclStubsPtr->tcl_ChannelThreadActionProc) /* 554 */ #endif #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TCLDECLS */ | > > > > > > > > > > > > > > > > > > > > > > > > | 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 6394 | #define Tcl_QueryTimeProc \ (tclStubsPtr->tcl_QueryTimeProc) /* 553 */ #endif #ifndef Tcl_ChannelThreadActionProc #define Tcl_ChannelThreadActionProc \ (tclStubsPtr->tcl_ChannelThreadActionProc) /* 554 */ #endif #ifndef Tcl_NewBignumObj #define Tcl_NewBignumObj \ (tclStubsPtr->tcl_NewBignumObj) /* 555 */ #endif #ifndef Tcl_DbNewBignumObj #define Tcl_DbNewBignumObj \ (tclStubsPtr->tcl_DbNewBignumObj) /* 556 */ #endif #ifndef Tcl_SetBignumObj #define Tcl_SetBignumObj \ (tclStubsPtr->tcl_SetBignumObj) /* 557 */ #endif #ifndef Tcl_GetBignumFromObj #define Tcl_GetBignumFromObj \ (tclStubsPtr->tcl_GetBignumFromObj) /* 558 */ #endif #ifndef Tcl_TruncateChannel #define Tcl_TruncateChannel \ (tclStubsPtr->tcl_TruncateChannel) /* 559 */ #endif #ifndef Tcl_ChannelTruncateProc #define Tcl_ChannelTruncateProc \ (tclStubsPtr->tcl_ChannelTruncateProc) /* 560 */ #endif #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TCLDECLS */ |
Changes to generic/tclDictObj.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclDictObj.c -- * * This file contains procedures that implement the Tcl dict object * type and its accessor command. * * Copyright (c) 2002 by Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclDictObj.c -- * * This file contains procedures that implement the Tcl dict object * type and its accessor command. * * Copyright (c) 2002 by Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclDictObj.c,v 1.27.4.1 2005/06/13 01:46:04 msofer Exp $ */ #include "tclInt.h" /* * Forward declaration. */ |
| ︙ | ︙ | |||
1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 |
if (result != TCL_OK) {
return TCL_ERROR;
}
if (objc == 4) {
pattern = TclGetString(objv[3]);
}
listPtr = Tcl_NewListObj(0, NULL);
for (; !done ; Tcl_DictObjNext(&search, &keyPtr, NULL, &done)) {
if (pattern==NULL || Tcl_StringMatch(TclGetString(keyPtr), pattern)) {
/*
* Assume this operation always succeeds.
*/
Tcl_ListObjAppendElement(interp, listPtr, keyPtr);
}
}
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
| > > > > > > > > > | 1667 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 1697 |
if (result != TCL_OK) {
return TCL_ERROR;
}
if (objc == 4) {
pattern = TclGetString(objv[3]);
}
listPtr = Tcl_NewListObj(0, NULL);
if ((pattern != NULL) && TclMatchIsTrivial(pattern)) {
Tcl_Obj *valuePtr = NULL;
Tcl_DictObjGet(interp, objv[2], objv[3], &valuePtr);
if (valuePtr != NULL) {
Tcl_ListObjAppendElement(interp, listPtr, objv[3]);
}
goto searchDone;
}
for (; !done ; Tcl_DictObjNext(&search, &keyPtr, NULL, &done)) {
if (pattern==NULL || Tcl_StringMatch(TclGetString(keyPtr), pattern)) {
/*
* Assume this operation always succeeds.
*/
Tcl_ListObjAppendElement(interp, listPtr, keyPtr);
}
}
searchDone:
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
2527 2528 2529 2530 2531 2532 2533 |
*/
if (Tcl_DictObjFirst(interp, objv[2], &search,
&keyObj, &valueObj, &done) != TCL_OK) {
return TCL_ERROR;
}
pattern = TclGetString(objv[4]);
resultObj = Tcl_NewDictObj();
| > > > > > > | | | | | > | 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 |
*/
if (Tcl_DictObjFirst(interp, objv[2], &search,
&keyObj, &valueObj, &done) != TCL_OK) {
return TCL_ERROR;
}
pattern = TclGetString(objv[4]);
resultObj = Tcl_NewDictObj();
if (TclMatchIsTrivial(pattern)) {
Tcl_DictObjGet(interp, objv[2], objv[4], &valueObj);
if (valueObj != NULL) {
Tcl_DictObjPut(interp, resultObj, objv[4], valueObj);
}
} else {
while (!done) {
if (Tcl_StringMatch(TclGetString(keyObj), pattern)) {
Tcl_DictObjPut(interp, resultObj, keyObj, valueObj);
}
Tcl_DictObjNext(&search, &keyObj, &valueObj, &done);
}
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
case FILTER_VALUES:
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "dictionary value globPattern");
|
| ︙ | ︙ |
Changes to generic/tclEncoding.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclEncoding.c -- * * Contains the implementation of the encoding conversion package. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclEncoding.c -- * * Contains the implementation of the encoding conversion package. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclEncoding.c,v 1.32.2.1 2005/06/13 01:46:04 msofer Exp $ */ #include "tclInt.h" typedef size_t (LengthProc)_ANSI_ARGS_((CONST char *src)); /* |
| ︙ | ︙ | |||
146 147 148 149 150 151 152 | /* * A map from encoding names to the directories in which their data * files have been seen. The string value of the map is shared by all * threads. Access to the shared string is governed by a mutex lock. */ | < | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
/*
* A map from encoding names to the directories in which their data
* files have been seen. The string value of the map is shared by all
* threads. Access to the shared string is governed by a mutex lock.
*/
static ProcessGlobalValue encodingFileMap =
{0, 0, NULL, NULL, NULL, NULL, NULL};
/*
* A list of directories making up the "library path". Historically
* this search path has served many uses, but the only one remaining
* is a base for the encodingSearchPath above. If the application
* does not explicitly set the encodingSearchPath, then it will be
* initialized by appending /encoding to each directory in this
|
| ︙ | ︙ | |||
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 | */ static int BinaryProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static void EscapeFreeProc _ANSI_ARGS_((ClientData clientData)); static int EscapeFromUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int EscapeToUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static void FillEncodingFileMap (); static void FreeEncoding _ANSI_ARGS_((Tcl_Encoding encoding)); static Encoding * GetTableEncoding _ANSI_ARGS_(( EscapeEncodingData *dataPtr, int state)); static Tcl_Encoding LoadEncodingFile _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name)); static Tcl_Encoding LoadTableEncoding _ANSI_ARGS_((CONST char *name, int type, Tcl_Channel chan)); static Tcl_Encoding LoadEscapeEncoding _ANSI_ARGS_((CONST char *name, Tcl_Channel chan)); | > > > | > | 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 | */ static int BinaryProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static void DupEncodingIntRep _ANSI_ARGS_((Tcl_Obj *srcPtr, Tcl_Obj *dupPtr)); static void EscapeFreeProc _ANSI_ARGS_((ClientData clientData)); static int EscapeFromUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int EscapeToUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static void FillEncodingFileMap (); static void FreeEncoding _ANSI_ARGS_((Tcl_Encoding encoding)); static void FreeEncodingIntRep _ANSI_ARGS_((Tcl_Obj *objPtr)); static Encoding * GetTableEncoding _ANSI_ARGS_(( EscapeEncodingData *dataPtr, int state)); static Tcl_Encoding LoadEncodingFile _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name)); static Tcl_Encoding LoadTableEncoding _ANSI_ARGS_((CONST char *name, int type, Tcl_Channel chan)); static Tcl_Encoding LoadEscapeEncoding _ANSI_ARGS_((CONST char *name, Tcl_Channel chan)); static Tcl_Channel OpenEncodingFileChannel _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name)); static void TableFreeProc _ANSI_ARGS_((ClientData clientData)); static int TableFromUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int TableToUtfProc _ANSI_ARGS_((ClientData clientData, |
| ︙ | ︙ | |||
256 257 258 259 260 261 262 263 264 265 266 267 268 269 | int *dstCharsPtr)); static int UtfExtToUtfIntProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); /* *---------------------------------------------------------------------- * * TclGetEncodingSearchPath -- * * Keeps the per-thread copy of the encoding search path current | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
int *dstCharsPtr));
static int UtfExtToUtfIntProc _ANSI_ARGS_((ClientData clientData,
CONST char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr));
/*
* A Tcl_ObjType for holding a cached Tcl_Encoding as the intrep.
* This should help the lifetime of encodings be more useful.
* See concerns raised in [Bug 1077262].
*/
static Tcl_ObjType EncodingType = {
"encoding", FreeEncodingIntRep, DupEncodingIntRep, NULL, NULL
};
/*
*----------------------------------------------------------------------
*
* TclGetEncodingFromObj --
*
* Writes to (*encodingPtr) the Tcl_Encoding value of (*objPtr),
* if possible, and returns TCL_OK. If no such encoding exists,
* TCL_ERROR is returned, and if interp is non-NULL, an error message
* is written there.
*
* Results:
* Standard Tcl return code.
*
* Side effects:
* Caches the Tcl_Encoding value as the internal rep of (*objPtr).
*
*----------------------------------------------------------------------
*/
int
TclGetEncodingFromObj(interp, objPtr, encodingPtr)
Tcl_Interp *interp;
Tcl_Obj *objPtr;
Tcl_Encoding *encodingPtr;
{
CONST char *name = Tcl_GetString(objPtr);
if (objPtr->typePtr != &EncodingType) {
Tcl_Encoding encoding = Tcl_GetEncoding(interp, name);
if (encoding == NULL) {
return TCL_ERROR;
}
TclFreeIntRep(objPtr);
objPtr->internalRep.otherValuePtr = (VOID *) encoding;
objPtr->typePtr = &EncodingType;
}
*encodingPtr = Tcl_GetEncoding(NULL, name);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* FreeEncodingIntRep --
*
* The Tcl_FreeInternalRepProc for the "encoding" Tcl_ObjType.
*
*----------------------------------------------------------------------
*/
static void
FreeEncodingIntRep(objPtr)
Tcl_Obj *objPtr;
{
Tcl_FreeEncoding((Tcl_Encoding) objPtr->internalRep.otherValuePtr);
}
/*
*----------------------------------------------------------------------
*
* DupEncodingIntRep --
*
* The Tcl_DupInternalRepProc for the "encoding" Tcl_ObjType.
*
*----------------------------------------------------------------------
*/
static void
DupEncodingIntRep(srcPtr, dupPtr)
Tcl_Obj *srcPtr;
Tcl_Obj *dupPtr;
{
dupPtr->internalRep.otherValuePtr = (VOID *)
Tcl_GetEncoding(NULL, srcPtr->bytes);
}
/*
*----------------------------------------------------------------------
*
* TclGetEncodingSearchPath --
*
* Keeps the per-thread copy of the encoding search path current
|
| ︙ | ︙ | |||
298 299 300 301 302 303 304 |
{
int dummy;
if (TCL_ERROR == Tcl_ListObjLength(NULL, searchPath, &dummy)) {
return TCL_ERROR;
}
TclSetProcessGlobalValue(&encodingSearchPath, searchPath, NULL);
| < | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
{
int dummy;
if (TCL_ERROR == Tcl_ListObjLength(NULL, searchPath, &dummy)) {
return TCL_ERROR;
}
TclSetProcessGlobalValue(&encodingSearchPath, searchPath, NULL);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclGetLibraryPath --
|
| ︙ | ︙ | |||
351 352 353 354 355 356 357 |
}
TclSetProcessGlobalValue(&libraryPath, path, NULL);
}
/*
*---------------------------------------------------------------------------
*
| | > > > | | | 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 |
}
TclSetProcessGlobalValue(&libraryPath, path, NULL);
}
/*
*---------------------------------------------------------------------------
*
* FillEncodingFileMap --
*
* Called to bring the encoding file map in sync with the current
* value of the encoding search path.
*
* Scan the directories on the encoding search path, find the
* *.enc files, and store the found pathnames in a map associated
* with the encoding name.
*
* In particular, if $dir is on the encoding search path, and the
* file $dir/foo.enc is found, then store a "foo" -> $dir entry
* in the map. Later, any need for the "foo" encoding will quickly
* be able to construct the $dir/foo.enc pathname for reading the
* encoding data.
*
* Results:
* None.
*
* Side effects:
* Entries are added to the encoding file map.
*
*---------------------------------------------------------------------------
*/
void
FillEncodingFileMap()
{
int i, numDirs = 0;
Tcl_Obj *map, *searchPath;
searchPath = TclGetEncodingSearchPath();
Tcl_IncrRefCount(searchPath);
Tcl_ListObjLength(NULL, searchPath, &numDirs);
|
| ︙ | ︙ | |||
415 416 417 418 419 420 421 |
Tcl_DecrRefCount(file);
Tcl_DecrRefCount(encodingName);
}
Tcl_DecrRefCount(matchFileList);
Tcl_DecrRefCount(directory);
}
Tcl_DecrRefCount(searchPath);
| < < < < < < < < < < < < < < < < < < < < < < < < < < < | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
Tcl_DecrRefCount(file);
Tcl_DecrRefCount(encodingName);
}
Tcl_DecrRefCount(matchFileList);
Tcl_DecrRefCount(directory);
}
Tcl_DecrRefCount(searchPath);
TclSetProcessGlobalValue(&encodingFileMap, map, NULL);
Tcl_DecrRefCount(map);
}
/*
*---------------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 |
TclpSetInitialEncodings();
TclpFindExecutable(argv0);
}
/*
*---------------------------------------------------------------------------
*
* LoadEncodingFile --
*
* Read a file that describes an encoding and create a new Encoding
* from the data.
*
* Results:
* The return value is the newly loaded Encoding, or NULL if
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 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 |
TclpSetInitialEncodings();
TclpFindExecutable(argv0);
}
/*
*---------------------------------------------------------------------------
*
* OpenEncodingFileChannel --
*
* Open the file believed to hold data for the encoding, "name".
*
* Results:
* Returns the readable Tcl_Channel from opening the file, or NULL
* if the file could not be successfully opened. If NULL was
* returned, an error message is left in interp's result object,
* unless interp was NULL.
*
* Side effects:
* Channel may be opened. Information about the filesystem may be
* cached to speed later calls.
*
*---------------------------------------------------------------------------
*/
static Tcl_Channel
OpenEncodingFileChannel(interp, name)
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. */
{
Tcl_Obj *nameObj = Tcl_NewStringObj(name, -1);
Tcl_Obj *fileNameObj = Tcl_DuplicateObj(nameObj);
Tcl_Obj *searchPath = Tcl_DuplicateObj(TclGetEncodingSearchPath());
Tcl_Obj *map = TclGetProcessGlobalValue(&encodingFileMap);
Tcl_Obj **dir, *path, *directory = NULL;
Tcl_Channel chan = NULL;
int i, numDirs;
Tcl_ListObjGetElements(NULL, searchPath, &numDirs, &dir);
Tcl_IncrRefCount(nameObj);
Tcl_AppendToObj(fileNameObj, ".enc", -1);
Tcl_IncrRefCount(fileNameObj);
Tcl_DictObjGet(NULL, map, nameObj, &directory);
/* Check that any cached directory is still on the encoding search path */
if (NULL != directory) {
int verified = 0;
for (i=0; i<numDirs && !verified; i++) {
if (dir[i] == directory) {
verified = 1;
}
}
if (!verified) {
CONST char *dirString = Tcl_GetString(directory);
for (i=0; i<numDirs && !verified; i++) {
if (strcmp(dirString, Tcl_GetString(dir[i])) == 0) {
verified = 1;
}
}
}
if (!verified) {
/* Directory no longer on the search path. Remove from cache */
map = Tcl_DuplicateObj(map);
Tcl_DictObjRemove(NULL, map, nameObj);
TclSetProcessGlobalValue(&encodingFileMap, map, NULL);
directory = NULL;
}
}
if (NULL != directory) {
/* Got a directory from the cache. Try to use it first */
Tcl_IncrRefCount(directory);
path = Tcl_FSJoinToPath(directory, 1, &fileNameObj);
Tcl_IncrRefCount(path);
Tcl_DecrRefCount(directory);
chan = Tcl_FSOpenFileChannel(NULL, path, "r", 0);
Tcl_DecrRefCount(path);
}
/* Scan the search path until we find it. */
for (i=0; i<numDirs && (chan == NULL); i++) {
path = Tcl_FSJoinToPath(dir[i], 1, &fileNameObj);
Tcl_IncrRefCount(path);
chan = Tcl_FSOpenFileChannel(NULL, path, "r", 0);
Tcl_DecrRefCount(path);
if (chan != NULL) {
/* Save directory in the cache */
map = Tcl_DuplicateObj(TclGetProcessGlobalValue(&encodingFileMap));
Tcl_DictObjPut(NULL, map, nameObj, dir[i]);
TclSetProcessGlobalValue(&encodingFileMap, map, NULL);
}
}
if ((NULL == chan) && (interp != NULL)) {
Tcl_AppendResult(interp, "unknown encoding \"", name, "\"", NULL);
}
Tcl_DecrRefCount(fileNameObj);
Tcl_DecrRefCount(nameObj);
Tcl_DecrRefCount(searchPath);
return chan;
}
/*
*---------------------------------------------------------------------------
*
* LoadEncodingFile --
*
* Read a file that describes an encoding and create a new Encoding
* from the data.
*
* Results:
* The return value is the newly loaded Encoding, or NULL if
|
| ︙ | ︙ | |||
1328 1329 1330 1331 1332 1333 1334 |
static Tcl_Encoding
LoadEncodingFile(interp, name)
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. */
{
| | | < < | < < < < < < < < < | < < < < < < | < < < < < < < < < | < < < < < < | 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 1523 |
static Tcl_Encoding
LoadEncodingFile(interp, name)
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. */
{
Tcl_Channel chan = NULL;
Tcl_Encoding encoding = NULL;
int ch;
chan = OpenEncodingFileChannel(interp, name);
if (chan == NULL) {
return NULL;
}
Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
while (1) {
Tcl_DString ds;
Tcl_DStringInit(&ds);
Tcl_Gets(chan, &ds);
ch = Tcl_DStringValue(&ds)[0];
Tcl_DStringFree(&ds);
if (ch != '#') {
break;
}
}
switch (ch) {
case 'S': {
encoding = LoadTableEncoding(name, ENCODING_SINGLEBYTE, chan);
break;
}
case 'D': {
encoding = LoadTableEncoding(name, ENCODING_DOUBLEBYTE, chan);
|
| ︙ | ︙ | |||
1406 1407 1408 1409 1410 1411 1412 |
}
}
if ((encoding == NULL) && (interp != NULL)) {
Tcl_AppendResult(interp, "invalid encoding file \"", name, "\"", NULL);
}
Tcl_Close(NULL, chan);
return encoding;
| < < < < < < | 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 |
}
}
if ((encoding == NULL) && (interp != NULL)) {
Tcl_AppendResult(interp, "invalid encoding file \"", name, "\"", NULL);
}
Tcl_Close(NULL, chan);
return encoding;
}
/*
*-------------------------------------------------------------------------
*
* LoadTableEncoding --
*
|
| ︙ | ︙ | |||
3095 3096 3097 3098 3099 3100 3101 |
}
bytes = Tcl_GetStringFromObj(searchPath, &numBytes);
*lengthPtr = numBytes;
*valuePtr = ckalloc((unsigned int) numBytes + 1);
memcpy((VOID *) *valuePtr, (VOID *) bytes, (size_t) numBytes + 1);
Tcl_DecrRefCount(searchPath);
}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 3216 3217 3218 3219 3220 3221 3222 |
}
bytes = Tcl_GetStringFromObj(searchPath, &numBytes);
*lengthPtr = numBytes;
*valuePtr = ckalloc((unsigned int) numBytes + 1);
memcpy((VOID *) *valuePtr, (VOID *) bytes, (size_t) numBytes + 1);
Tcl_DecrRefCount(searchPath);
}
|
Changes to generic/tclEnv.c.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclEnv.c,v 1.22.4.1 2005/06/13 01:46:05 msofer Exp $ */ #include "tclInt.h" TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ */ static int cacheSize = 0; /* Number of env strings in environCache. */ |
| ︙ | ︙ | |||
316 317 318 319 320 321 322 | * The environ array gets updated, as do all of the interpreters * that we manage. * *---------------------------------------------------------------------- */ int | | | | | | 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 |
* The environ array gets updated, as do all of the interpreters
* that we manage.
*
*----------------------------------------------------------------------
*/
int
Tcl_PutEnv(assignment)
CONST char *assignment; /* Info about environment variable in the
* form NAME=value. (native) */
{
Tcl_DString nameString;
CONST char *name;
char *value;
if (assignment == NULL) {
return 0;
}
/*
* 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.
*/
name = Tcl_ExternalToUtfDString(NULL, assignment, -1, &nameString);
value = strchr(name, '=');
if ((value != NULL) && (value != name)) {
value[0] = '\0';
TclSetEnv(name, value+1);
}
|
| ︙ | ︙ |
Changes to generic/tclEvent.c.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 2004 by Zoran Vasiljevic. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 2004 by Zoran Vasiljevic. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclEvent.c,v 1.56.2.1 2005/06/13 01:46:05 msofer Exp $ */ #include "tclInt.h" /* * The data structure below is used to report background errors. One * such structure is allocated for each error; it holds information |
| ︙ | ︙ | |||
794 795 796 797 798 799 800 801 802 803 804 805 806 807 |
TclInitAlloc(); /* process wide mutex init */
#endif
#ifdef TCL_MEM_DEBUG
TclInitDbCkalloc(); /* process wide mutex init */
#endif
TclpInitPlatform(); /* creates signal handler(s) */
TclInitObjSubsystem(); /* register obj types, create mutexes */
TclInitIOSubsystem(); /* inits a tsd key (noop) */
TclInitEncodingSubsystem(); /* process wide encoding init */
TclpSetInterfaces();
TclInitNamespaceSubsystem(); /* register ns obj type (mutexed) */
}
TclpInitUnlock();
| > > | 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
TclInitAlloc(); /* process wide mutex init */
#endif
#ifdef TCL_MEM_DEBUG
TclInitDbCkalloc(); /* process wide mutex init */
#endif
TclpInitPlatform(); /* creates signal handler(s) */
TclInitDoubleConversion(); /* initializes constants for
* converting to/from double */
TclInitObjSubsystem(); /* register obj types, create mutexes */
TclInitIOSubsystem(); /* inits a tsd key (noop) */
TclInitEncodingSubsystem(); /* process wide encoding init */
TclpSetInterfaces();
TclInitNamespaceSubsystem(); /* register ns obj type (mutexed) */
}
TclpInitUnlock();
|
| ︙ | ︙ | |||
934 935 936 937 938 939 940 941 942 943 944 945 946 947 | * Once load has been finalized, we will have deleted any * temporary copies of shared libraries and can therefore * reset the filesystem to its original state. */ TclFinalizeLoad(); TclResetFilesystem(); /* * There shouldn't be any malloc'ed memory after this. */ #if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) TclFinalizeThreadAlloc(); #endif | > > > > | 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | * Once load has been finalized, we will have deleted any * temporary copies of shared libraries and can therefore * reset the filesystem to its original state. */ TclFinalizeLoad(); TclResetFilesystem(); /* Now we can free constants for conversions to/from double */ TclFinalizeDoubleConversion(); /* * There shouldn't be any malloc'ed memory after this. */ #if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) TclFinalizeThreadAlloc(); #endif |
| ︙ | ︙ |
Changes to generic/tclExecute.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclExecute.c -- * * This file contains procedures that execute byte-compiled Tcl * commands. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | > | < | > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | /* * tclExecute.c -- * * This file contains procedures that execute byte-compiled Tcl * commands. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2005 by Miguel Sofer. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclExecute.c,v 1.171.2.31 2005/10/10 17:59:38 msofer Exp $ */ #include "tclInt.h" #include "tclCompile.h" #include <math.h> #include <float.h> /* * Hack to determine whether we may expect IEEE floating point. * The hack is formally incorrect in that non-IEEE platforms might * have the same precision and range, but VAX, IBM, and Cray do not; * are there any other floating point units that we might care about? */ #if ( FLT_RADIX == 2 ) && ( DBL_MANT_DIG == 53 ) && ( DBL_MAX_EXP == 1024 ) #define IEEE_FLOATING_POINT #endif /* * The stuff below is a bit of a hack so that this file can be used * in environments that include no UNIX, i.e. no errno. Just define * errno here. */ |
| ︙ | ︙ | |||
91 92 93 94 95 96 97 | int tclTraceExec = 0; #endif /* * Mapping from expression instruction opcodes to strings; used for error * messages. Note that these entries must match the order and number of the | | < < < | > | | < > | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
int tclTraceExec = 0;
#endif
/*
* Mapping from expression instruction opcodes to strings; used for error
* messages. Note that these entries must match the order and number of the
* expression opcodes (e.g., INST_LNOT) in tclCompile.h.
*/
static CONST char *operatorStrings[] = {
"== or !=", "== or !=", "< or >=", "< or >=", "> or <=", "> or <=",
"eq or ne", "eq or ne", "in or ni", "in or ni",
"!", "!!", "|", "^", "&", "<<", ">>", "+", "-", "*", "/", "%",
"+", "-", "~", "**", "BUILTIN FUNCTION", "FUNCTION",
""
};
/*
* Mapping from Tcl result codes to strings; used for error and debugging
* messages.
*/
|
| ︙ | ︙ | |||
132 133 134 135 136 137 138 | /* * Macros for testing floating-point values for certain special cases. Test * for not-a-number by comparing a value against itself; test for infinity * by comparing against the largest floating-point value. */ | > | | > > > > | | < | < < < | < | 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 |
/*
* Macros for testing floating-point values for certain special cases. Test
* for not-a-number by comparing a value against itself; test for infinity
* by comparing against the largest floating-point value.
*/
#ifdef _MSC_VER
#define IS_NAN(f) (_isnan((f)))
#define IS_INF(f) ( ! (_finite((f))))
#else
#define IS_NAN(f) ((f) != (f))
#define IS_INF(f) ( (f) > DBL_MAX || (f) < -DBL_MAX )
#endif
/*
* The new macro for ending an instruction; note that a
* reasonable C-optimiser will resolve all branches
* at compile time. (result) is always a constant; the macro
* NEXT_INST_F handles constant (nCleanup), NEXT_INST_V is
* resolved at runtime for variable (nCleanup).
*
* ARGUMENTS:
* pcAdjustment: how much to increment pc
* nCleanup: how many objects to remove from the stack
* resultHandling: 0 indicates no object should be pushed on the
* stack; otherwise, push objResultPtr. If (result < 0), objResultPtr
* already has the correct reference count.
*/
#define NEXT_INST_F(nCleanup, resultHandling) \
if (nCleanup == 0) {\
if (resultHandling != 0) {\
if ((resultHandling) > 0) {\
PUSH_OBJECT(objResultPtr);\
} else {\
*(++tosPtr) = objResultPtr;\
}\
} \
goto cleanup0;\
} else if (resultHandling != 0) {\
if ((resultHandling) > 0) {\
Tcl_IncrRefCount(objResultPtr);\
}\
switch (nCleanup) {\
case 1: goto cleanup1_pushObjResultPtr;\
case 2: goto cleanup2_pushObjResultPtr;\
default: Tcl_Panic("ERROR: bad usage of macro NEXT_INST_F");\
}\
} else {\
switch (nCleanup) {\
case 1: goto cleanup1;\
case 2: goto cleanup2;\
default: Tcl_Panic("ERROR: bad usage of macro NEXT_INST_F");\
}\
}
#define NEXT_INST_V(nCleanup, resultHandling) \
cleanup = (nCleanup);\
if (resultHandling) {\
if ((resultHandling) > 0) {\
Tcl_IncrRefCount(objResultPtr);\
}\
goto cleanupV_pushObjResultPtr;\
} else {\
|
| ︙ | ︙ | |||
205 206 207 208 209 210 211 |
* to TclExecuteByteCode.
*/
#define CACHE_STACK_INFO() \
tosPtr = eePtr->tosPtr
#define DECACHE_STACK_INFO() \
| | > | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
* to TclExecuteByteCode.
*/
#define CACHE_STACK_INFO() \
tosPtr = eePtr->tosPtr
#define DECACHE_STACK_INFO() \
eePtr->tosPtr = tosPtr; \
checkInterp = 1
/*
* Macros used to access items on the Tcl evaluation stack. PUSH_OBJECT
* increments the object's ref count since it makes the stack have another
* reference pointing to the object. However, POP_OBJECT does not decrement
* the ref count. This is because the stack may hold the only reference to
|
| ︙ | ︙ | |||
340 341 342 343 344 345 346 | /* * Declarations for local procedures to this file: */ static int TclExecuteByteCode _ANSI_ARGS_((Tcl_Interp *interp, ByteCode *codePtr)); | < < < < < < < < < < < < < < < < < < < < | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 |
/*
* Declarations for local procedures to this file:
*/
static int TclExecuteByteCode _ANSI_ARGS_((Tcl_Interp *interp,
ByteCode *codePtr));
#ifdef TCL_COMPILE_STATS
static int EvalStatsCmd _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[]));
#endif /* TCL_COMPILE_STATS */
#ifdef TCL_COMPILE_DEBUG
static char * GetOpcodeName _ANSI_ARGS_((TclVMWord *pc));
#endif /* TCL_COMPILE_DEBUG */
static ExceptionRange * GetExceptRangeForPc _ANSI_ARGS_((TclVMWord *pc,
ByteCode* codePtr));
static char * GetSrcInfoForPc _ANSI_ARGS_((TclVMWord *pc,
ByteCode* codePtr, int *lengthPtr));
static void GrowEvaluationStack _ANSI_ARGS_((ExecEnv *eePtr));
static void IllegalExprOperandType _ANSI_ARGS_((
Tcl_Interp *interp, TclVMWord *pc,
Tcl_Obj *opndPtr));
static void InitByteCodeExecution _ANSI_ARGS_((
Tcl_Interp *interp));
#ifdef TCL_COMPILE_DEBUG
static void PrintByteCodeInfo _ANSI_ARGS_((ByteCode *codePtr));
static char * StringForResultCode _ANSI_ARGS_((int result));
static void ValidatePcAndStackTop _ANSI_ARGS_((
ByteCode *codePtr, TclVMWord *pc,
int stackTop, int stackLowerBound,
int checkStack));
#endif /* TCL_COMPILE_DEBUG */
static Tcl_WideInt ExponWide _ANSI_ARGS_((Tcl_WideInt w, Tcl_WideInt w2,
int *errExpon));
static long ExponLong _ANSI_ARGS_((long i, long i2,
int *errExpon));
/*
*----------------------------------------------------------------------
*
* InitByteCodeExecution --
*
* This procedure is called once to initialize the Tcl bytecode
|
| ︙ | ︙ | |||
517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
stackPtr++;
eePtr->stackPtr = stackPtr;
stackPtr[-1] = (Tcl_Obj *) ((char *) 1);
eePtr->tosPtr = stackPtr - 1;
eePtr->endPtr = stackPtr + (TCL_STACK_INITIAL_SIZE - 2);
Tcl_MutexLock(&execMutex);
if (!execInitialized) {
TclInitAuxDataTypeTable();
InitByteCodeExecution(interp);
execInitialized = 1;
}
Tcl_MutexUnlock(&execMutex);
| > > > > > | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
stackPtr++;
eePtr->stackPtr = stackPtr;
stackPtr[-1] = (Tcl_Obj *) ((char *) 1);
eePtr->tosPtr = stackPtr - 1;
eePtr->endPtr = stackPtr + (TCL_STACK_INITIAL_SIZE - 2);
TclNewIntObj(eePtr->constants[0], 0);
Tcl_IncrRefCount(eePtr->constants[0]);
TclNewIntObj(eePtr->constants[1], 1);
Tcl_IncrRefCount(eePtr->constants[1]);
Tcl_MutexLock(&execMutex);
if (!execInitialized) {
TclInitAuxDataTypeTable();
InitByteCodeExecution(interp);
execInitialized = 1;
}
Tcl_MutexUnlock(&execMutex);
|
| ︙ | ︙ | |||
555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
ExecEnv *eePtr; /* Execution environment to free. */
{
if (eePtr->stackPtr[-1] == (Tcl_Obj *) ((char *) 1)) {
ckfree((char *) (eePtr->stackPtr-1));
} else {
Tcl_Panic("ERROR: freeing an execEnv whose stack is still in use.\n");
}
ckfree((char *) eePtr);
}
/*
*----------------------------------------------------------------------
*
* TclFinalizeExecution --
| > > | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
ExecEnv *eePtr; /* Execution environment to free. */
{
if (eePtr->stackPtr[-1] == (Tcl_Obj *) ((char *) 1)) {
ckfree((char *) (eePtr->stackPtr-1));
} else {
Tcl_Panic("ERROR: freeing an execEnv whose stack is still in use.\n");
}
TclDecrRefCount(eePtr->constants[0]);
TclDecrRefCount(eePtr->constants[1]);
ckfree((char *) eePtr);
}
/*
*----------------------------------------------------------------------
*
* TclFinalizeExecution --
|
| ︙ | ︙ | |||
775 776 777 778 779 780 781 |
* allocated in frame. */
LiteralTable *localTablePtr = &(compEnv.localLitTable);
register ByteCode *codePtr = NULL;
/* Tcl Internal type of bytecode.
* Initialized to avoid compiler warning. */
AuxData *auxDataPtr;
LiteralEntry *entryPtr;
| | | | > | | > | | > | | > | 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 |
* allocated in frame. */
LiteralTable *localTablePtr = &(compEnv.localLitTable);
register ByteCode *codePtr = NULL;
/* Tcl Internal type of bytecode.
* Initialized to avoid compiler warning. */
AuxData *auxDataPtr;
LiteralEntry *entryPtr;
Tcl_Obj *saveObjPtr, *resultPtr;
char *string;
int length, i, result;
/*
* First handle some common expressions specially.
*/
string = Tcl_GetStringFromObj(objPtr, &length);
if (length == 1) {
if (*string == '0') {
TclNewLongObj(resultPtr, 0);
Tcl_IncrRefCount(resultPtr);
*resultPtrPtr = resultPtr;
return TCL_OK;
} else if (*string == '1') {
TclNewLongObj(resultPtr, 1);
Tcl_IncrRefCount(resultPtr);
*resultPtrPtr = resultPtr;
return TCL_OK;
}
} else if ((length == 2) && (*string == '!')) {
if (*(string+1) == '0') {
TclNewLongObj(resultPtr, 1);
Tcl_IncrRefCount(resultPtr);
*resultPtrPtr = resultPtr;
return TCL_OK;
} else if (*(string+1) == '1') {
TclNewLongObj(resultPtr, 0);
Tcl_IncrRefCount(resultPtr);
*resultPtrPtr = resultPtr;
return TCL_OK;
}
}
/*
* Get the ByteCode from the object. If it exists, make sure it hasn't
* been invalidated by, e.g., someone redefining a command with a
|
| ︙ | ︙ | |||
891 892 893 894 895 896 897 | /* * Add a "done" instruction as the last instruction and change the * object into a ByteCode object. Ownership of the literal objects * and aux data items is given to the ByteCode object. */ | | > > > | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 |
/*
* Add a "done" instruction as the last instruction and change the
* object into a ByteCode object. Ownership of the literal objects
* and aux data items is given to the ByteCode object.
*/
TclEmitInst0(INST_DONE, &compEnv);
TclInitByteCodeObj(objPtr, &compEnv);
#if VM_ENABLE_OPTIMISER
TclOptimiseByteCode (interp, objPtr);
#endif
TclFreeCompileEnv(&compEnv);
codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr;
#ifdef TCL_COMPILE_DEBUG
if (tclTraceCompile == 2) {
TclPrintByteCodeObj(interp, objPtr);
}
#endif /* TCL_COMPILE_DEBUG */
|
| ︙ | ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | * error message. * * Side effects: * Almost certainly, depending on the ByteCode's instructions. * *---------------------------------------------------------------------- */ | > > > > | | | > | | | | > > > > | 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 |
* error message.
*
* Side effects:
* Almost certainly, depending on the ByteCode's instructions.
*
*----------------------------------------------------------------------
*/
#define ENABLE_PEEPHOLE 1
#ifndef ENABLE_PEEPHOLE
#define ENABLE_PEEPHOLE !defined(TCL_COMPILE_DEBUG)
#endif
static int
TclExecuteByteCode(interp, codePtr)
Tcl_Interp *interp; /* Token for command interpreter. */
ByteCode *codePtr; /* The bytecode sequence to interpret. */
{
/*
* Compiler cast directive - not a real variable.
* Interp *iPtr = (Interp *) interp;
*/
#define iPtr ((Interp *) interp)
/*
* Constants: variables that do not change during the execution,
* used sporadically.
*/
ExecEnv *eePtr; /* Points to the execution environment. */
int initStackTop; /* Stack top at start of execution. */
int initCatch; /* Catch stack top at start of execution. */
ShortVar *compiledLocals;
Namespace *namespacePtr;
char **varNames;
/*
* Globals: variables that store state, must remain valid at
* all times.
*/
int catchItems;
Tcl_Obj **tosPtr; /* Cached pointer to top of evaluation stack. */
TclVMWord *pc = codePtr->codeStart;
/* The current program counter. */
int instructionCount = 0; /* Counter that is used to work out
* when to call Tcl_AsyncReady() */
Tcl_Obj *expandNestList = NULL;
int checkInterp = 0; /* Indicates when a check of interp readyness
* is necessary. Set by DECACHE_STACK_INFO() */
int inst;
TclPSizedInt opnd;
/*
* Transfer variables - needed only between opcodes, but not
* while executing an instruction.
*/
register int cleanup;
|
| ︙ | ︙ | |||
1143 1144 1145 1146 1147 1148 1149 |
* NOTE: These are now defined locally where needed.
*/
#ifdef TCL_COMPILE_DEBUG
int traceInstructions = (tclTraceExec == 3);
char cmdNameBuf[21];
#endif
| | > > | | | | > > > | | | 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 |
* NOTE: These are now defined locally where needed.
*/
#ifdef TCL_COMPILE_DEBUG
int traceInstructions = (tclTraceExec == 3);
char cmdNameBuf[21];
#endif
/*
* The execution uses a unified stack: first the catch stack, immediately
* above it the execution stack.
*
* Make sure the catch stack is large enough to hold the maximum number
* of catch commands that could ever be executing at the same time (this
* will be no more than the exception range array's depth).
* Make sure the execution stack is large enough to execute this ByteCode.
*/
#define catchStackPtr ((catchItem *) &eePtr->stackPtr[initCatch])
eePtr = iPtr->execEnvPtr;
initCatch = eePtr->tosPtr - eePtr->stackPtr;
catchItems = 0;
tosPtr = eePtr->tosPtr + CATCH_ITEM_SIZE*(codePtr->maxCatchDepth+1);
while ((tosPtr + codePtr->maxStackDepth) > eePtr->endPtr) {
GrowEvaluationStack(eePtr);
tosPtr = eePtr->tosPtr
+ CATCH_ITEM_SIZE*(codePtr->maxCatchDepth+1);
}
initStackTop = tosPtr - eePtr->stackPtr;
#ifdef TCL_COMPILE_DEBUG
if (tclTraceExec >= 2) {
PrintByteCodeInfo(codePtr);
fprintf(stdout, " Starting stack top=%d\n", initStackTop);
fflush(stdout);
}
#endif
#ifdef TCL_COMPILE_STATS
iPtr->stats.numExecutions++;
#endif
if (iPtr->varFramePtr != NULL) {
namespacePtr = iPtr->varFramePtr->nsPtr;
compiledLocals = iPtr->varFramePtr->compiledLocals;
varNames = (char **)&(compiledLocals[iPtr->varFramePtr->numCompiledLocals]);
} else {
namespacePtr = iPtr->globalNsPtr;
compiledLocals = NULL;
varNames = NULL;
}
/*
* Loop executing instructions until a "done" instruction, a
* TCL_RETURN, or some error.
*/
NEXT_INST_F(0, 0);
/*
* Targets for standard instruction endings; unrolled
* for speed in the most frequent cases (instructions that
* consume up to two stack elements).
*
|
| ︙ | ︙ | |||
1252 1253 1254 1255 1256 1257 1258 1259 |
/*
* We really want to do nothing now, but this is needed
* for some compilers (SunPro CC)
*/
break;
}
}
cleanup0:
| > > > > > > > | | | | 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 |
/*
* We really want to do nothing now, but this is needed
* for some compilers (SunPro CC)
*/
break;
}
}
/*
* Move to the next instruction and extract the (instruction, operand)
* fields.
*/
cleanup0:
TclVMGetInstAndOpAtPtr(pc, inst, opnd);
#ifdef TCL_COMPILE_DEBUG
/*
* Skip the stack depth check if an expansion is in progress
*/
ValidatePcAndStackTop(codePtr, pc, (tosPtr - eePtr->stackPtr),
initStackTop, /*checkStack*/ (expandNestList == NULL));
if (traceInstructions) {
fprintf(stdout, "%2d: %2d ", iPtr->numLevels, (tosPtr - eePtr->stackPtr));
TclPrintInstruction(codePtr, pc);
fflush(stdout);
}
#endif /* TCL_COMPILE_DEBUG */
#ifdef TCL_COMPILE_STATS
iPtr->stats.instructionCount[inst]++;
#endif
/*
* Check for asynchronous handlers [Bug 746722]; we
* do the check every ASYNC_CHECK_COUNT_MASK instruction,
* of the form (2**n-1).
*/
|
| ︙ | ︙ | |||
1297 1298 1299 1300 1301 1302 1303 |
CACHE_STACK_INFO();
if (result == TCL_ERROR) {
goto checkForCatch;
}
}
}
| | | < | > > | | 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 |
CACHE_STACK_INFO();
if (result == TCL_ERROR) {
goto checkForCatch;
}
}
}
switch (inst) {
case INST_RETURN:
{
int code, level;
Tcl_Obj *returnOpts = POP_OBJECT();
HP_EXTRACT(opnd, code, level);
result = TclProcessReturn(interp, code, level, returnOpts);
Tcl_DecrRefCount(returnOpts);
if (result != TCL_OK) {
Tcl_SetObjResult(interp, *tosPtr);
cleanup = 1;
goto processExceptionReturn;
}
pc++;
NEXT_INST_F(0, 0);
}
case INST_DONE:
if (tosPtr <= eePtr->stackPtr + initStackTop) {
tosPtr--;
goto abnormalReturn;
}
|
| ︙ | ︙ | |||
1337 1338 1339 1340 1341 1342 1343 |
iPtr->objResultPtr);
if (traceInstructions) {
fprintf(stdout, "\n");
}
#endif
goto checkForCatch;
| | | | > | | > > > > > | | | | | | < < < < < < < < < < < < < < < < | | < < < < > > > | | | > > > > > > > > > > > > > > > > | | > > > > > | | > | | | | | | > > | > > | < < < > | | | < < | 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 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 |
iPtr->objResultPtr);
if (traceInstructions) {
fprintf(stdout, "\n");
}
#endif
goto checkForCatch;
case INST_PUSH:
#if ENABLE_PEEPHOLE
instPushPeephole:
#endif
#if (defined(TCL_COMPILE_DEBUG)||defined(VM_USE_PACKED))
PUSH_OBJECT(codePtr->objArrayPtr[opnd]);
TRACE_WITH_OBJ(("%u => ", (unsigned) opnd), *(tosPtr));
#else
/* /// UNHOLY CAST: fix when reading opnds from instructions, instead
* of at the top. This here does ptr->TclPSizedInt->ptr */
PUSH_OBJECT((Tcl_Obj *) opnd);
#endif
pc++;
#if ENABLE_PEEPHOLE
/*
* Runtime peephole optimisation: check if we are pushing again.
*/
TclVMGetInstAndOpAtPtr(pc, inst, opnd);
if (inst == INST_PUSH) {
goto instPushPeephole;
}
#endif
NEXT_INST_F(0, 0);
case INST_POP:
{
Tcl_Obj *valuePtr;
TRACE_WITH_OBJ(("=> discarding "), *tosPtr);
valuePtr = POP_OBJECT();
TclDecrRefCount(valuePtr);
}
pc++;
NEXT_INST_F(0, 0);
case INST_START_CMD:
/*
* Remark that if the interpreter is marked for deletion
* its compileEpoch is modified, so that the epoch
* check also verifies that the interp is not deleted.
* If no outside call has been made since the last check, it is safe
* to omit the check.
*/
iPtr->cmdCount++;
if (!checkInterp ||
(((codePtr->compileEpoch == iPtr->compileEpoch)
&& (codePtr->nsEpoch == namespacePtr->resolverEpoch))
|| (codePtr->flags & TCL_BYTECODE_PRECOMPILED))) {
#if ENABLE_PEEPHOLE
/*
* Non-bc'ed commands start by pushing the command name; many
* others start by PUSHing (constant first arg): peep.
*/
while (TclVMGetInstAtPtr(++pc) == INST_START_CMD) {
iPtr->cmdCount++;
}
TclVMGetInstAndOpAtPtr(pc, inst, opnd);
if (inst == INST_PUSH) {
goto instPushPeephole;
}
#else
pc++;
#endif
NEXT_INST_F(0, 0);
} else {
char *bytes;
int length;
Tcl_Obj *newObjResultPtr;
int pushRes;
/* NOTE: depends on VM_VAR_OMIT_PUSH being 1.*/
pushRes = !(opnd & VM_VAR_OMIT_PUSH);
opnd = opnd >> 1;
bytes = GetSrcInfoForPc(pc, codePtr, &length);
DECACHE_STACK_INFO();
result = Tcl_EvalEx(interp, bytes, length, 0);
CACHE_STACK_INFO();
if (result != TCL_OK) {
cleanup = 0;
goto processExceptionReturn;
}
pc += opnd;
if (pushRes) {
objResultPtr = Tcl_GetObjResult(interp);
{
TclNewObj(newObjResultPtr);
Tcl_IncrRefCount(newObjResultPtr);
iPtr->objResultPtr = newObjResultPtr;
}
NEXT_INST_F(0, -1);
} else {
NEXT_INST_F(0, 0);
}
}
case INST_DUP:
objResultPtr = *tosPtr;
TRACE_WITH_OBJ(("=> "), objResultPtr);
pc++;
NEXT_INST_F(0, 1);
case INST_OVER:
{
objResultPtr = *(tosPtr - opnd);
TRACE_WITH_OBJ(("=> "), objResultPtr);
pc++;
NEXT_INST_F(0, 1);
}
case INST_CONCAT:
{
int length, appendLen = 0;
char *bytes, *p;
Tcl_Obj **currPtr;
/*
* Compute the length to be appended.
*/
for (currPtr = tosPtr - (opnd-2); currPtr <= tosPtr;
currPtr++) {
bytes = Tcl_GetStringFromObj(*currPtr, &length);
|
| ︙ | ︙ | |||
1466 1467 1468 1469 1470 1471 1472 |
* object by dropping all the others from the stack; this
* saves both the computation and copy of the string rep
* of the first object, enabling the fast '$x[set x {}]'
* idiom for 'K $x [set x{}]'.
*/
if (appendLen == 0) {
| | > | | 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 |
* object by dropping all the others from the stack; this
* saves both the computation and copy of the string rep
* of the first object, enabling the fast '$x[set x {}]'
* idiom for 'K $x [set x{}]'.
*/
if (appendLen == 0) {
TRACE_WITH_OBJ(("%u => ", (unsigned) opnd), objResultPtr);
pc++;
NEXT_INST_V((opnd-1), 0);
}
/*
* If the first object is shared, we need a new obj for
* the result; otherwise, we can reuse the first object.
* In any case, make sure it has enough room to accomodate
* all the concatenated bytes. Note that if it is unshared
|
| ︙ | ︙ | |||
1513 1514 1515 1516 1517 1518 1519 | memcpy((VOID *) p, (VOID *) bytes, (size_t) length); p += length; } } *p = '\0'; | | > | | 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 |
memcpy((VOID *) p, (VOID *) bytes,
(size_t) length);
p += length;
}
}
*p = '\0';
TRACE_WITH_OBJ(("%u => ", (unsigned) opnd), objResultPtr);
pc++;
NEXT_INST_V(opnd, 1);
}
case INST_EXPAND_START:
/*
* Push an element to the expandNestList. This records
* the current tosPtr - i.e., the point in the stack
* where the expanded command starts.
|
| ︙ | ︙ | |||
1539 1540 1541 1542 1543 1544 1545 |
{
Tcl_Obj *objPtr;
TclNewObj(objPtr);
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) (tosPtr - eePtr->stackPtr);
objPtr->internalRep.twoPtrValue.ptr2 = (VOID *) expandNestList;
expandNestList = objPtr;
| > | | 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 |
{
Tcl_Obj *objPtr;
TclNewObj(objPtr);
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) (tosPtr - eePtr->stackPtr);
objPtr->internalRep.twoPtrValue.ptr2 = (VOID *) expandNestList;
expandNestList = objPtr;
pc++;
NEXT_INST_F(0, 0);
}
case INST_EXPAND_STKTOP:
{
int objc, length, i;
Tcl_Obj **objv, *valuePtr, *objPtr;
|
| ︙ | ︙ | |||
1573 1574 1575 1576 1577 1578 1579 | * Make sure there is enough room in the stack to expand * this list *and* process the rest of the command (at least * up to the next argument expansion or command end). * The operand is the current stack depth, as seen by the * compiler. */ | | > | < < | | | | | | | | | | | | | | > | | < < < | < < < | < < < < < < | | | > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | > | > > > > > | > > > > > > | | | | | | | | | | | | | | | | | | | | | | > > | | | | | | < < < < < < < | 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 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 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 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 |
* Make sure there is enough room in the stack to expand
* this list *and* process the rest of the command (at least
* up to the next argument expansion or command end).
* The operand is the current stack depth, as seen by the
* compiler.
*/
length = objc + codePtr->maxStackDepth - opnd;
while ((tosPtr + length) > eePtr->endPtr) {
DECACHE_STACK_INFO();
GrowEvaluationStack(eePtr);
CACHE_STACK_INFO();
}
/*
* Expand the list at stacktop onto the stack; free the list.
*/
for (i = 0; i < objc; i++) {
PUSH_OBJECT(objv[i]);
}
TclDecrRefCount(valuePtr);
pc++;
NEXT_INST_F(0, 0);
}
/*
* INVOCATION BLOCK
*/
case INST_INVOKE_EXPANDED:
{
Tcl_Obj *objPtr;
objPtr = expandNestList;
expandNestList = (Tcl_Obj *) objPtr->internalRep.twoPtrValue.ptr2;
opnd = tosPtr - eePtr->stackPtr
- (ptrdiff_t) objPtr->internalRep.twoPtrValue.ptr1;
TclDecrRefCount(objPtr);
}
if (opnd == 0) {
/*
* Nothing was expanded, return {}.
*/
TclNewObj(objResultPtr);
pc++;
NEXT_INST_F(0, 1);
}
case INST_INVOKE_STK:
{
Tcl_Obj **objv = (tosPtr - (opnd-1));
int length;
char *bytes;
#if ENABLE_PEEPHOLE
TclPSizedInt dummy;
#endif
/*
* We keep the stack reference count as a (char *), as that
* works nicely as a portable pointer-sized counter.
*/
char **preservedStackRefCountPtr;
#ifdef TCL_COMPILE_DEBUG
if (tclTraceExec >= 2) {
int i;
if (traceInstructions) {
strncpy(cmdNameBuf, TclGetString(objv[0]), 20);
TRACE(("%u => call ", (unsigned) opnd));
} else {
fprintf(stdout, "%d: (%u) invoking ",
iPtr->numLevels,
(unsigned int)(pc - codePtr->codeStart));
}
for (i = 0; i < opnd; i++) {
TclPrintObject(stdout, objv[i], 15);
fprintf(stdout, " ");
}
fprintf(stdout, "\n");
fflush(stdout);
}
#endif /*TCL_COMPILE_DEBUG*/
/*
* If trace procedures will be called, we need a
* command string to pass to TclEvalObjvInternal; note
* that a copy of the string will be made there to
* include the ending \0.
*/
bytes = NULL;
length = 0;
if (iPtr->tracePtr != NULL) {
Trace *tracePtr, *nextTracePtr;
for (tracePtr = iPtr->tracePtr; tracePtr != NULL;
tracePtr = nextTracePtr) {
nextTracePtr = tracePtr->nextPtr;
if (tracePtr->level == 0 ||
iPtr->numLevels <= tracePtr->level) {
/*
* Traces will be called: get command string
*/
bytes = GetSrcInfoForPc(pc, codePtr, &length);
break;
}
}
} else {
Command *cmdPtr;
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[0]);
if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_HAS_EXEC_TRACES)) {
bytes = GetSrcInfoForPc(pc, codePtr, &length);
}
}
/*
* A reference to part of the stack vector itself
* escapes our control: increase its refCount
* to stop it from being deallocated by a recursive
* call to ourselves. The extra variable is needed
* because all others are liable to change due to the
* trace procedures.
*/
preservedStackRefCountPtr = (char **) (eePtr->stackPtr-1);
++*preservedStackRefCountPtr;
/*
* Reset the instructionCount variable, since we're about
* to check for async stuff anyway while processing
* TclEvalObjvInternal.
*/
instructionCount = 1;
/*
* Finally, let TclEvalObjvInternal handle the command.
*/
DECACHE_STACK_INFO();
Tcl_ResetResult(interp);
result = TclEvalObjvInternal(interp, opnd,
objv, bytes, length, 0);
CACHE_STACK_INFO();
/*
* If the old stack is going to be released, it is
* safe to do so now, since no references to objv are
* going to be used from now on.
*/
--*preservedStackRefCountPtr;
if (*preservedStackRefCountPtr == (char *) 0) {
ckfree((VOID *) preservedStackRefCountPtr);
}
if (result == TCL_OK) {
/*
* Push the call's object result and continue execution
* with the next instruction.
*/
TRACE_WITH_OBJ(("%u => ... after \"%.20s\": TCL_OK, result=",
(unsigned) opnd, cmdNameBuf),
Tcl_GetObjResult(interp));
#if ENABLE_PEEPHOLE
/*
* Peephole opt - if we are popping the result, do not push it
* and skip the INST_POP
*/
TclVMGetInstAndOpAtPtr((pc+1), inst, dummy);
if (inst == INST_POP) {
pc += 2;
NEXT_INST_V(opnd, 0);
}
#endif
objResultPtr = Tcl_GetObjResult(interp);
/*
* Reset the interp's result to avoid possible duplications
* of large objects [Bug 781585]. We do not call
* Tcl_ResetResult() to avoid any side effects caused by
* the resetting of errorInfo and errorCode [Bug 804681],
* which are not needed here. We chose instead to manipulate
* the interp's object result directly.
*
* Note that the result object is now in objResultPtr, it
* keeps the refCount it had in its role of iPtr->objResultPtr.
*/
{
Tcl_Obj *objPtr;
TclNewObj(objPtr);
Tcl_IncrRefCount(objPtr);
iPtr->objResultPtr = objPtr;
}
pc++;
NEXT_INST_V(opnd, -1);
} else {
TRACE(("%u => ... after \"%.20s\": ", (unsigned) opnd, cmdNameBuf));
pc--;
cleanup = opnd;
goto processExceptionReturn;
}
}
case INST_EVAL_STK:
{
Tcl_Obj *objPtr;
objPtr = *tosPtr;
DECACHE_STACK_INFO();
result = TclCompEvalObj(interp, objPtr);
CACHE_STACK_INFO();
|
| ︙ | ︙ | |||
1814 1815 1816 1817 1818 1819 1820 | * Note that the result object is now in objResultPtr, it * keeps the refCount it had in its role of iPtr->objResultPtr. */ TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); iPtr->objResultPtr = objPtr; | > | > > > > > > > > > | > | < < < < < < < < | < | | < > | | | | < < > | < | > > > > > | | < | | | | < > | < > > > | < < < | < | | | | | < < | < < < | < < < < < < | < < < | < < | | | | | | < | | | | | | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | < | < | | | | | > | | > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | > | > | < | | < < < | < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < < | < | < < < < < < | < < < < < < | < < | < < | < < | < < | < < < < < | < < < < | < < < < < < < < < < < | < < < < < < < < < < < | < | < | < < < < | < | < < < < < < < < < < < < < < < | < < | < < < < | < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | < < < | < < < < < < < < < < < < < | < < < < < < < < < < < | < < < < < | < < < < < < | < < < < < < < < < < < | < < | < | | < < < < < | < < < < | | < < < < < < < < < < | < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | < < < < | < < < | | < < < < | < < < < < | < < < < | | | | | | | | | | | | | | | | | < < < | | | | | | > > > | | | | | > | | < < < < < < < < < < < < < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < | | < < < < < | < < < < < < < | < < < | < < < < < < < < < < < | < < < < | < < < | < < < < < < < | < < < < > | | | < | | | | < | < | | > | | | > | | 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 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 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 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 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 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 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 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 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 |
* Note that the result object is now in objResultPtr, it
* keeps the refCount it had in its role of iPtr->objResultPtr.
*/
TclNewObj(objPtr);
Tcl_IncrRefCount(objPtr);
iPtr->objResultPtr = objPtr;
pc++;
NEXT_INST_F(1, -1);
} else {
/*
* Note to maintainers: it is important that INST_EVAL_STK
* pop its argument from the stack before jumping to
* processExceptionReturn! DO NOT OPTIMISE!
*/
objPtr = POP_OBJECT();
TRACE(("\"%.30s\" => ", O2S(objPtr)));
Tcl_DecrRefCount(objPtr);
cleanup = 0;
goto processExceptionReturn;
}
}
case INST_EXPR_STK:
{
Tcl_Obj *objPtr, *valuePtr;
objPtr = *tosPtr;
DECACHE_STACK_INFO();
Tcl_ResetResult(interp);
result = Tcl_ExprObj(interp, objPtr, &valuePtr);
CACHE_STACK_INFO();
if (result != TCL_OK) {
TRACE_WITH_OBJ(("\"%.30s\" => ERROR: ", O2S(objPtr)),
Tcl_GetObjResult(interp));
goto checkForCatch;
}
objResultPtr = valuePtr;
TRACE_WITH_OBJ(("\"%.30s\" => ", O2S(objPtr)), valuePtr);
pc++;
NEXT_INST_F(1, -1); /* already has right refct */
}
{
char *part2;
Var *varPtr, *arrayPtr;
unsigned int index;
case INST_LOAD_SCALAR:
index = opnd & HP_MASK;
varPtr = (Var *) &(compiledLocals[index]);
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
if (TclIsVarDirectReadable(varPtr)) {
/*
* No errors, no traces: just get the value.
*/
objResultPtr = varPtr->value.objPtr;
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_F(0, 1);
}
cleanup = 0;
arrayPtr = NULL;
part2 = NULL;
goto doCallPtrGetVar;
case INST_LOAD:
index = opnd & HP_MASK;
if (index < HPUINT_MAX) {
/*
* A local indexed variable.
*/
varPtr = (Var *) &(compiledLocals[index]);
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
TRACE(("%u => ", (unsigned) index));
if (!(opnd & HP_STASH(VM_VAR_ARRAY, 0)) /*isArray*/) {
/*
* A local indexed scalar: With the optimiser, this branch
* will never be followed. We keep it functional, but
* divert it to the "slow" version.
*/
cleanup = 0;
arrayPtr = NULL;
part2 = NULL;
goto doCallPtrGetVar;
}
part2 = Tcl_GetString(*tosPtr); /* element name */
arrayPtr = varPtr;
varPtr = TclLookupArrayElement(interp, varNames[index], part2,
TCL_LEAVE_ERR_MSG, "read", 0, 1, arrayPtr);
if (!varPtr) {
TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
result = TCL_ERROR;
goto checkForCatch;
}
if (TclIsVarDirectReadable(varPtr)
&& TclIsVarUntraced(arrayPtr)) {
/*
* No errors, no traces: just get the value.
*/
objResultPtr = varPtr->value.objPtr;
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_F(1, 1);
}
cleanup = 1;
/*
* There are either errors or the variable is traced:
* call TclPtrGetVar to process fully.
*/
doCallPtrGetVar:
DECACHE_STACK_INFO();
objResultPtr = TclPtrGetVar(interp, varPtr, arrayPtr,
varNames[index], part2, TCL_LEAVE_ERR_MSG);
CACHE_STACK_INFO();
if (!objResultPtr) {
TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
result = TCL_ERROR;
goto checkForCatch;
}
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_V(cleanup, 1);
} else {
/*
* A lookup-by-name is requested - defer to TclObjGetVar2
*/
DECACHE_STACK_INFO();
if ((opnd & HP_STASH(VM_VAR_ARRAY, 0)) /*isArray*/) {
cleanup = 2;
objResultPtr = Tcl_ObjGetVar2(interp, *(tosPtr-1),
*tosPtr, TCL_LEAVE_ERR_MSG);
} else {
cleanup = 1;
objResultPtr = Tcl_ObjGetVar2(interp, *(tosPtr),
NULL, TCL_LEAVE_ERR_MSG);
}
CACHE_STACK_INFO();
if (objResultPtr == NULL) {
TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
result = TCL_ERROR;
goto checkForCatch;
}
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_V(cleanup, 1);
}
}
{
char *part2;
Var *varPtr, *arrayPtr;
Tcl_Obj *valuePtr;
unsigned int index;
int flags;
case INST_STORE_SCALAR:
index = opnd & HP_MASK;
varPtr = (Var *) &(compiledLocals[index]);
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
TRACE(("%u => ", (unsigned) index));
/*
* NOTE: this instruction is only generated by the optimiser when
* a plain set is requested. There is no need to check the flags
* again.
*/
if (TclIsVarDirectWritable(varPtr)) {
/*
* No traces, no errors, plain 'set': we can safely inline.
* The value *will* be set to what's requested, so that
* the stack top remains pointing to the same Tcl_Obj.
*/
valuePtr = varPtr->value.objPtr;
objResultPtr = *tosPtr;
if (valuePtr != objResultPtr) {
if (valuePtr != NULL) {
TclDecrRefCount(valuePtr);
} else {
TclSetVarDirectScalar(varPtr);
}
varPtr->value.objPtr = objResultPtr;
if (opnd & HP_STASH(VM_VAR_OMIT_PUSH, 0)) {
/* Remove from stacktop, hijack its refCount for the
* variable value. */
tosPtr--;
} else {
/* Add the refCount for the variable value, stack remains
* as is */
Tcl_IncrRefCount(objResultPtr);
}
} else {
if (opnd & HP_STASH(VM_VAR_OMIT_PUSH, 0)) {
/* Remove from stacktop, reduce refCount*/
tosPtr--;
TclDecrRefCount(objResultPtr);
} else {
/* Do nothing - stacktop remains as is, refCount is
* correct */
}
}
pc++;
NEXT_INST_F(0,0);
}
cleanup = 1;
part2 = NULL;
arrayPtr = NULL;
HP_EXTRACT(opnd, flags, index);
goto doCallPtrSetVar;
case INST_STORE:
HP_EXTRACT(opnd, flags, index);
if (index < HPUINT_MAX) {
/*
* A local indexed variable
*/
varPtr = (Var *) &(compiledLocals[index]);
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
TRACE(("%u => ", (unsigned) index));
if (!(flags & VM_VAR_ARRAY)) {
/*
* A local indexed scalar: With the optimiser, this branch
* will only be followed for append and lappend, not for
* plain set. This means that it will be processed by
* doCallPtrSetVar, so go directly there.
*/
cleanup = 1;
part2 = NULL;
arrayPtr = NULL;
goto doCallPtrSetVar;
}
part2 = Tcl_GetString(*(tosPtr-1)); /* element name */
arrayPtr = varPtr;
varPtr = TclLookupArrayElement(interp, varNames[index], part2,
TCL_LEAVE_ERR_MSG, "set", 1, 1, arrayPtr);
if (!varPtr) {
TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
result = TCL_ERROR;
goto checkForCatch;
}
if (((flags & VM_STORE_FLAGS_FILTER) == TCL_LEAVE_ERR_MSG)
&& TclIsVarDirectWritable(varPtr)
&& TclIsVarUntraced(arrayPtr)) {
/*
* No traces, no errors, plain 'set': we can safely inline.
* The value *will* be set to what's requested, so that
* the stack top remains pointing to the same Tcl_Obj.
*/
valuePtr = varPtr->value.objPtr;
objResultPtr = *tosPtr;
if (valuePtr != objResultPtr) {
if (valuePtr) {
TclDecrRefCount(valuePtr);
} else {
TclSetVarDirectScalar(varPtr);
}
varPtr->value.objPtr = objResultPtr;
Tcl_IncrRefCount(objResultPtr);
}
pc++;
NEXT_INST_F(2, !(flags & VM_VAR_OMIT_PUSH));
}
cleanup = 2;
doCallPtrSetVar:
DECACHE_STACK_INFO();
objResultPtr = TclPtrSetVar(interp, varPtr, arrayPtr,
varNames[index], part2, *tosPtr, (flags & VM_STORE_FLAGS_FILTER));
CACHE_STACK_INFO();
if (objResultPtr == NULL) {
TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
result = TCL_ERROR;
goto checkForCatch;
}
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_V(cleanup, !(flags & VM_VAR_OMIT_PUSH));
} else {
/*
* A lookup-by-name is requested - defer to TclObjGetVar2
*/
DECACHE_STACK_INFO();
if ((flags & VM_VAR_ARRAY)) {
cleanup = 3;
objResultPtr = Tcl_ObjSetVar2(interp, *(tosPtr-2),
*(tosPtr-1), *tosPtr, (flags & VM_STORE_FLAGS_FILTER));
} else {
cleanup = 2;
objResultPtr = Tcl_ObjSetVar2(interp, *(tosPtr-1),
NULL, *tosPtr, (flags & VM_STORE_FLAGS_FILTER));
}
CACHE_STACK_INFO();
if (objResultPtr == NULL) {
TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
result = TCL_ERROR;
goto checkForCatch;
}
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_V(cleanup, !(flags & VM_VAR_OMIT_PUSH));
}
}
case INST_INCR:
{
Tcl_Obj *objPtr;
int isWide = 0;
long i;
Tcl_WideInt w;
char *part2 = NULL;
Var *varPtr, *arrayPtr = NULL;
unsigned int index;
int pushRes, isArray;
HP_EXTRACT(opnd, i, index);
pushRes = (!(i & VM_VAR_OMIT_PUSH));
isArray = ((i & VM_VAR_ARRAY)!=0);
i = (i >> 2);
if (i == (HPINT_MIN >> 2)) {
/*
* Signals that the increment is to be fetched from the
* stack: either it was not known at compile time, or it did
* not fit in the VM_WORD.
*/
objPtr = *tosPtr;
if (objPtr->typePtr == &tclIntType) {
i = objPtr->internalRep.longValue;
isWide = 0;
} else if (objPtr->typePtr == &tclWideIntType) {
i = 0; /* lint */
w = objPtr->internalRep.wideValue;
isWide = 1;
} else {
i = 0; /* lint */
REQUIRE_WIDE_OR_INT(result, objPtr, i, w);
if (result != TCL_OK) {
TRACE_WITH_OBJ(("%u (by %s) => ERROR converting increment amount to int: ",
(unsigned) opnd, O2S(objPtr)), Tcl_GetObjResult(interp));
Tcl_AddErrorInfo(interp, "\n (reading increment)");
goto checkForCatch;
}
isWide = (objPtr->typePtr == &tclWideIntType);
}
tosPtr--;
TclDecrRefCount(objPtr);
}
if (index < HPUINT_MAX) {
/*
* A local indexed variable
*/
varPtr = (Var *) &(compiledLocals[index]);
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
TRACE(("%u => ", (unsigned) index));
cleanup = isArray;
if (isArray) {
part2 = Tcl_GetString(*tosPtr); /* element name */
arrayPtr = varPtr;
varPtr = TclLookupArrayElement(interp, varNames[index], part2,
TCL_LEAVE_ERR_MSG, "read", 0, 0, arrayPtr);
if (varPtr == NULL) {
TRACE_APPEND(("ERROR: %.30s\n",
O2S(Tcl_GetObjResult(interp))));
Tcl_AddObjErrorInfo(interp,
"\n (reading value of variable to increment)", -1);
result = TCL_ERROR;
goto checkForCatch;
}
}
objPtr = varPtr->value.objPtr;
if (TclIsVarDirectReadable(varPtr)
&& (!arrayPtr || TclIsVarUntraced(arrayPtr))
&& (objPtr->typePtr == &tclIntType) && !isWide) {
/*
* No errors, no traces, the variable already has an
* integer value: inline processing.
*/
i += objPtr->internalRep.longValue;
if (Tcl_IsShared(objPtr)) {
objPtr->refCount--; /* we know it is shared */
TclNewLongObj(objResultPtr, i);
Tcl_IncrRefCount(objResultPtr);
varPtr->value.objPtr = objResultPtr;
} else {
TclSetLongObj(objPtr, i);
objResultPtr = objPtr;
}
} else {
DECACHE_STACK_INFO();
if (isWide) {
objResultPtr = TclPtrIncrWideVar(interp, varPtr, arrayPtr,
varNames[index],part2, w, TCL_LEAVE_ERR_MSG);
} else {
objResultPtr = TclPtrIncrVar(interp, varPtr, arrayPtr,
varNames[index], part2, i, TCL_LEAVE_ERR_MSG);
}
CACHE_STACK_INFO();
if (objResultPtr == NULL) {
TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
result = TCL_ERROR;
goto checkForCatch;
}
}
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_V(cleanup, pushRes);
} else {
/*
* A lookup-by-name is requested - defer to TclIncrVar2
*/
Tcl_Obj *part1Ptr, *part2Ptr;
if (isArray) {
cleanup = 2;
part1Ptr = *(tosPtr-1);
part2Ptr = *(tosPtr);
} else {
cleanup = 1;
part1Ptr = *(tosPtr);
part2Ptr = NULL;
}
DECACHE_STACK_INFO();
if (isWide) {
objResultPtr = TclIncrWideVar2(interp, part1Ptr,
part2Ptr, w, TCL_LEAVE_ERR_MSG);
} else {
objResultPtr = TclIncrVar2(interp, part1Ptr,
part2Ptr, i, TCL_LEAVE_ERR_MSG);
}
CACHE_STACK_INFO();
if (objResultPtr == NULL) {
TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
result = TCL_ERROR;
goto checkForCatch;
}
}
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_V(cleanup, pushRes);
}
case INST_JUMP:
TRACE(("%d => new pc %u\n", (int) opnd,
(unsigned int)(pc + opnd - codePtr->codeStart)));
pc += opnd;
NEXT_INST_F(0,0);
{
int jmpOffset[2];
int b;
Tcl_Obj *valuePtr;
case INST_JUMP_FALSE:
jmpOffset[0] = opnd; /* FALSE offset */
jmpOffset[1] = 1; /* TRUE offset*/
goto doCondJump;
case INST_JUMP_TRUE:
jmpOffset[0] = 1; /* FALSE offset */
jmpOffset[1] = opnd; /* TRUE offset*/
doCondJump:
valuePtr = *tosPtr;
if (valuePtr->typePtr == &tclIntType) {
b = (valuePtr->internalRep.longValue != 0);
} else if (valuePtr->typePtr == &tclDoubleType) {
b = (valuePtr->internalRep.doubleValue != 0.0);
} else if (valuePtr->typePtr == &tclWideIntType) {
Tcl_WideInt w;
TclGetWide(w,valuePtr);
b = (w != W0);
} else {
/*
* Taking b's address impedes it being a register
* variable (in gcc at least), so we avoid doing it.
*/
int b1;
result = Tcl_GetBooleanFromObj(interp, valuePtr, &b1);
if (result != TCL_OK) {
TRACE_WITH_OBJ(("%d => ERROR: ", (int) opnd), Tcl_GetObjResult(interp));
goto checkForCatch;
}
b = b1;
}
#ifndef TCL_COMPILE_DEBUG
TclDecrRefCount(valuePtr);
tosPtr--;
pc += jmpOffset[b];
NEXT_INST_F(0,0);
#else
if (b) {
if (inst == INST_JUMP_TRUE) {
TRACE(("%d => %.20s true, new pc %u\n", (int) opnd, O2S(valuePtr),
(unsigned int)(pc+opnd - codePtr->codeStart)));
pc += opnd;
} else {
TRACE(("%d => %.20s true\n", 2, O2S(valuePtr)));
pc++;
}
} else {
if (inst == INST_JUMP_TRUE) {
TRACE(("%d => %.20s false\n", 2, O2S(valuePtr)));
pc++;
} else {
TRACE(("%d => %.20s false, new pc %u\n", (int) opnd, O2S(valuePtr),
(unsigned int)(pc + opnd - codePtr->codeStart)));
pc += opnd;
}
}
NEXT_INST_F(1, 0);
#endif
}
/*
* ---------------------------------------------------------
* Start of INST_LIST and related instructions.
*/
case INST_LIST:
/*
* Pop the opnd (objc) top stack elements into a new list obj
* and then decrement their ref counts.
*/
objResultPtr = Tcl_NewListObj(opnd, (tosPtr - (opnd-1)));
TRACE_WITH_OBJ(("%u => ", (unsigned) opnd), objResultPtr);
pc++;
NEXT_INST_V(opnd, 1);
case INST_LIST_LENGTH:
{
Tcl_Obj *valuePtr;
int length;
valuePtr = *tosPtr;
result = Tcl_ListObjLength(interp, valuePtr, &length);
if (result != TCL_OK) {
TRACE_WITH_OBJ(("%.30s => ERROR: ", O2S(valuePtr)),
Tcl_GetObjResult(interp));
goto checkForCatch;
}
TclNewIntObj(objResultPtr, length);
TRACE(("%.20s => %d\n", O2S(valuePtr), length));
pc++;
NEXT_INST_F(1, 1);
}
case INST_LIST_INDEX:
{
/*** lindex with objc == 3 ***/
Tcl_Obj *valuePtr, *value2Ptr;
|
| ︙ | ︙ | |||
2717 2718 2719 2720 2721 2722 2723 |
}
/*
* Stash the list element on the stack
*/
TRACE(("%.20s %.20s => %s\n",
O2S(valuePtr), O2S(value2Ptr), O2S(objResultPtr)));
| > | | < | | > | | < | | > | | < | 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 |
}
/*
* Stash the list element on the stack
*/
TRACE(("%.20s %.20s => %s\n",
O2S(valuePtr), O2S(value2Ptr), O2S(objResultPtr)));
pc++;
NEXT_INST_F(2, -1); /* already has the correct refCount */
}
case INST_LIST_INDEX_IMM:
{
/*** lindex with objc==3 and index in bytecode stream ***/
int listc, idx;
Tcl_Obj **listv;
Tcl_Obj *valuePtr;
/*
* Pop the list and get the index
*/
valuePtr = *tosPtr;
/*
* Get the contents of the list, making sure that it
* really is a list in the process.
*/
result = Tcl_ListObjGetElements(interp, valuePtr, &listc, &listv);
if (result != TCL_OK) {
TRACE_WITH_OBJ(("\"%.30s\" %d => ERROR: ", O2S(valuePtr), (int) opnd),
Tcl_GetObjResult(interp));
goto checkForCatch;
}
/*
* Select the list item based on the index. Negative
* operand == end-based indexing.
*/
if (opnd < -1) {
idx = opnd+1 + listc;
} else {
idx = opnd;
}
if (idx >= 0 && idx < listc) {
objResultPtr = listv[idx];
} else {
TclNewObj(objResultPtr);
}
TRACE_WITH_OBJ(("\"%.30s\" %d => ", O2S(valuePtr), (int) opnd), objResultPtr);
pc++;
NEXT_INST_F(1, 1);
}
case INST_LIST_INDEX_MULTI:
{
/*
* 'lindex' with multiple index args:
*
* Determine the count of index args.
*/
int numIdx;
numIdx = opnd-1;
/*
* Do the 'lindex' operation.
*/
objResultPtr = TclLindexFlat(interp, *(tosPtr - numIdx),
numIdx, tosPtr - numIdx + 1);
/*
* Check for errors
*/
if (objResultPtr == NULL) {
TRACE_WITH_OBJ(("%d => ERROR: ", (int) opnd), Tcl_GetObjResult(interp));
result = TCL_ERROR;
goto checkForCatch;
}
/*
* Set result
*/
TRACE(("%d => %s\n", (int) opnd, O2S(objResultPtr)));
pc++;
NEXT_INST_V(opnd, -1);
}
case INST_LSET_FLAT:
{
/*
* Lset with 3, 5, or more args. Get the number
* of index args.
*/
int numIdx;
Tcl_Obj *valuePtr, *value2Ptr;
numIdx = opnd - 2;
/*
* Get the old value of variable, and remove the stack ref.
* This is safe because the variable still references the
* object; the ref count will never go zero here.
*/
|
| ︙ | ︙ | |||
2834 2835 2836 2837 2838 2839 2840 |
objResultPtr = TclLsetFlat(interp, value2Ptr, numIdx,
tosPtr - numIdx, valuePtr);
/*
* Check for errors
*/
if (objResultPtr == NULL) {
| | | > | | 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 |
objResultPtr = TclLsetFlat(interp, value2Ptr, numIdx,
tosPtr - numIdx, valuePtr);
/*
* Check for errors
*/
if (objResultPtr == NULL) {
TRACE_WITH_OBJ(("%d => ERROR: ", (int) opnd), Tcl_GetObjResult(interp));
result = TCL_ERROR;
goto checkForCatch;
}
/*
* Set result
*/
TRACE(("%d => %s\n", (int) opnd, O2S(objResultPtr)));
pc++;
NEXT_INST_V((numIdx+1), -1);
}
case INST_LSET_LIST:
{
/*
* 'lset' with 4 args.
*/
|
| ︙ | ︙ | |||
2887 2888 2889 2890 2891 2892 2893 |
goto checkForCatch;
}
/*
* Set result
*/
TRACE(("=> %s\n", O2S(objResultPtr)));
| > | | < | > > | > | | 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 |
goto checkForCatch;
}
/*
* Set result
*/
TRACE(("=> %s\n", O2S(objResultPtr)));
pc++;
NEXT_INST_F(2, -1);
}
case INST_LIST_RANGE_IMM:
{
/*** lrange with objc==4 and both indices in bytecode stream ***/
int listc, fromIdx, toIdx;
Tcl_Obj **listv;
Tcl_Obj *valuePtr;
/*
* Pop the list and get the indices
*/
valuePtr = *tosPtr;
HP_EXTRACT(opnd, toIdx, fromIdx);
/*
* Get the contents of the list, making sure that it
* really is a list in the process.
*/
result = Tcl_ListObjGetElements(interp, valuePtr, &listc, &listv);
if (result != TCL_OK) {
TRACE_WITH_OBJ(("\"%.30s\" %d %d => ERROR: ", O2S(valuePtr),
fromIdx, toIdx), Tcl_GetObjResult(interp));
goto checkForCatch;
}
/*
* Skip a lot of work if we're about to throw the result away
* (common with uses of [lassign].)
*/
#if ENABLE_PEEPHOLE
TclVMGetInstAndOpAtPtr((pc+1), inst, opnd);
if (inst == INST_POP) {
pc +=2;
NEXT_INST_F(1, 0);
}
#endif
/*
* Adjust the indices for end-based handling.
*/
if (fromIdx < -1) {
|
| ︙ | ︙ | |||
2963 2964 2965 2966 2967 2968 2969 |
}
objResultPtr = Tcl_NewListObj(toIdx-fromIdx+1, listv+fromIdx);
} else {
TclNewObj(objResultPtr);
}
TRACE_WITH_OBJ(("\"%.30s\" %d %d => ", O2S(valuePtr),
| | > | | 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 |
}
objResultPtr = Tcl_NewListObj(toIdx-fromIdx+1, listv+fromIdx);
} else {
TclNewObj(objResultPtr);
}
TRACE_WITH_OBJ(("\"%.30s\" %d %d => ", O2S(valuePtr),
fromIdx, toIdx), objResultPtr);
pc++;
NEXT_INST_F(1, 1);
}
case INST_LIST_IN:
case INST_LIST_NOT_IN: {
/*
* Basic list containment operators.
*/
|
| ︙ | ︙ | |||
3004 3005 3006 3007 3008 3009 3010 |
if (s1len == s2len) {
found = (strcmp(s1, s2) == 0);
}
i++;
} while (i < llen && found == 0);
}
| | | | > | > > > > | < < < > | < < < < < < < > | | | 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 2741 2742 2743 2744 2745 2746 2747 2748 2749 |
if (s1len == s2len) {
found = (strcmp(s1, s2) == 0);
}
i++;
} while (i < llen && found == 0);
}
if (inst == INST_LIST_NOT_IN) {
found = !found;
}
TRACE(("%.20s %.20s => %d\n", O2S(valuePtr), O2S(value2Ptr), found));
/*
* Jump-if-true extension. Note that opnd==0 (which would mean
* 'ignore the result, continue with the next instruction' and have
* the effect of two INST_POPs) is taken to mean "push the result".
*/
if (opnd) {
if (found) {
pc += opnd;
} else {
pc++;
}
NEXT_INST_F(2,0);
}
pc++;
TclNewIntObj(objResultPtr, found);
NEXT_INST_F(2, 1);
}
/*
* End of INST_LIST and related instructions.
* ---------------------------------------------------------
*/
|
| ︙ | ︙ | |||
3054 3055 3056 3057 3058 3059 3060 |
valuePtr = *(tosPtr - 1);
if (valuePtr == value2Ptr) {
/*
* On the off-chance that the objects are the same,
* we don't really have to think hard about equality.
*/
| | | | | | > | > > > > | < < < > | < < < < < < < > | | | 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 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 |
valuePtr = *(tosPtr - 1);
if (valuePtr == value2Ptr) {
/*
* On the off-chance that the objects are the same,
* we don't really have to think hard about equality.
*/
iResult = (inst == INST_STR_EQ);
} else {
char *s1, *s2;
int s1len, s2len;
s1 = Tcl_GetStringFromObj(valuePtr, &s1len);
s2 = Tcl_GetStringFromObj(value2Ptr, &s2len);
if (s1len == s2len) {
/*
* We only need to check (in)equality when
* we have equal length strings.
*/
if (inst == INST_STR_NEQ) {
iResult = (strcmp(s1, s2) != 0);
} else {
/* INST_STR_EQ */
iResult = (strcmp(s1, s2) == 0);
}
} else {
iResult = (inst == INST_STR_NEQ);
}
}
TRACE(("%.20s %.20s => %d\n", O2S(valuePtr), O2S(value2Ptr), iResult));
/*
* Jump-if-true extension. Note that opnd==0 (which would mean
* 'ignore the result, continue with the next instruction' and have
* the effect of two INST_POPs) is taken to mean "push the result".
*/
if (opnd) {
if (iResult) {
pc += opnd;
} else {
pc++;
}
NEXT_INST_F(2,0);
}
pc++;
objResultPtr = eePtr->constants[iResult];
NEXT_INST_F(2, 1);
}
case INST_STR_CMP:
{
/*
* String compare
*/
|
| ︙ | ︙ | |||
3171 3172 3173 3174 3175 3176 3177 |
}
if (iResult < 0) {
iResult = -1;
} else if (iResult > 0) {
iResult = 1;
}
| | > | | > | | 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 |
}
if (iResult < 0) {
iResult = -1;
} else if (iResult > 0) {
iResult = 1;
}
TclNewIntObj(objResultPtr, iResult);
TRACE(("%.20s %.20s => %d\n", O2S(valuePtr), O2S(value2Ptr), iResult));
pc++;
NEXT_INST_F(2, 1);
}
case INST_STR_LEN:
{
int length;
Tcl_Obj *valuePtr;
valuePtr = *tosPtr;
if (valuePtr->typePtr == &tclByteArrayType) {
(void) Tcl_GetByteArrayFromObj(valuePtr, &length);
} else {
length = Tcl_GetCharLength(valuePtr);
}
TclNewIntObj(objResultPtr, length);
TRACE(("%.20s => %d\n", O2S(valuePtr), length));
pc++;
NEXT_INST_F(1, 1);
}
case INST_STR_INDEX:
{
/*
* String compare
*/
|
| ︙ | ︙ | |||
3254 3255 3256 3257 3258 3259 3260 |
}
} else {
TclNewObj(objResultPtr);
}
TRACE(("%.20s %.20s => %s\n", O2S(valuePtr), O2S(value2Ptr),
O2S(objResultPtr)));
| > | | | 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 |
}
} else {
TclNewObj(objResultPtr);
}
TRACE(("%.20s %.20s => %s\n", O2S(valuePtr), O2S(value2Ptr),
O2S(objResultPtr)));
pc++;
NEXT_INST_F(2, 1);
}
case INST_STR_MATCH:
{
int nocase, match;
Tcl_Obj *valuePtr, *value2Ptr;
nocase = opnd;
valuePtr = *tosPtr; /* String */
value2Ptr = *(tosPtr - 1); /* Pattern */
/*
* Check that at least one of the objects is Unicode before
* promoting both.
*/
|
| ︙ | ︙ | |||
3291 3292 3293 3294 3295 3296 3297 |
/*
* Reuse value2Ptr object already on stack if possible.
* Adjustment is 2 due to the nocase byte
*/
TRACE(("%.20s %.20s => %d\n", O2S(valuePtr), O2S(value2Ptr), match));
| | | | < < < < | 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 |
/*
* Reuse value2Ptr object already on stack if possible.
* Adjustment is 2 due to the nocase byte
*/
TRACE(("%.20s %.20s => %d\n", O2S(valuePtr), O2S(value2Ptr), match));
pc++;
objResultPtr = eePtr->constants[match];
NEXT_INST_F(2, 1);
}
case INST_EQ:
case INST_NEQ:
case INST_LT:
case INST_GT:
case INST_LE:
|
| ︙ | ︙ | |||
3370 3371 3372 3373 3374 3375 3376 | (void) Tcl_GetDoubleFromObj((Tcl_Interp *) NULL, valuePtr, &d1); } t1Ptr = valuePtr->typePtr; } } | | | 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 |
(void) Tcl_GetDoubleFromObj((Tcl_Interp *) NULL,
valuePtr, &d1);
}
t1Ptr = valuePtr->typePtr;
}
}
switch (inst) {
case INST_EQ:
case INST_LE:
case INST_GE:
iResult = !((t1Ptr == &tclDoubleType)
&& IS_NAN(valuePtr->internalRep.doubleValue));
break;
case INST_LT:
|
| ︙ | ︙ | |||
3431 3432 3433 3434 3435 3436 3437 | * strcmp is not correct for \x00 < \x01, but that is * unlikely to occur here. We could use the TclUtfNCmp2 * to handle this. */ int s1len, s2len; s1 = Tcl_GetStringFromObj(valuePtr, &s1len); s2 = Tcl_GetStringFromObj(value2Ptr, &s2len); | | | 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 |
* strcmp is not correct for \x00 < \x01, but that is
* unlikely to occur here. We could use the TclUtfNCmp2
* to handle this.
*/
int s1len, s2len;
s1 = Tcl_GetStringFromObj(valuePtr, &s1len);
s2 = Tcl_GetStringFromObj(value2Ptr, &s2len);
switch (inst) {
case INST_EQ:
if (s1len == s2len) {
iResult = (strcmp(s1, s2) == 0);
} else {
iResult = 0;
}
break;
|
| ︙ | ︙ | |||
3471 3472 3473 3474 3475 3476 3477 |
if (t1Ptr == &tclDoubleType) {
d1 = valuePtr->internalRep.doubleValue;
GET_DOUBLE_VALUE(d2, value2Ptr, t2Ptr);
} else { /* t1Ptr is integer, t2Ptr is double */
GET_DOUBLE_VALUE(d1, valuePtr, t1Ptr);
d2 = value2Ptr->internalRep.doubleValue;
}
| | | 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 |
if (t1Ptr == &tclDoubleType) {
d1 = valuePtr->internalRep.doubleValue;
GET_DOUBLE_VALUE(d2, value2Ptr, t2Ptr);
} else { /* t1Ptr is integer, t2Ptr is double */
GET_DOUBLE_VALUE(d1, valuePtr, t1Ptr);
d2 = value2Ptr->internalRep.doubleValue;
}
switch (inst) {
case INST_EQ:
iResult = d1 == d2;
break;
case INST_NEQ:
iResult = d1 != d2;
break;
case INST_LT:
|
| ︙ | ︙ | |||
3507 3508 3509 3510 3511 3512 3513 |
} else if (t2Ptr == &tclIntType) {
TclGetWide(w,valuePtr);
w2 = Tcl_LongAsWide(value2Ptr->internalRep.longValue);
} else {
TclGetWide(w,valuePtr);
TclGetWide(w2,value2Ptr);
}
| | | 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 |
} else if (t2Ptr == &tclIntType) {
TclGetWide(w,valuePtr);
w2 = Tcl_LongAsWide(value2Ptr->internalRep.longValue);
} else {
TclGetWide(w,valuePtr);
TclGetWide(w2,value2Ptr);
}
switch (inst) {
case INST_EQ:
iResult = w == w2;
break;
case INST_NEQ:
iResult = w != w2;
break;
case INST_LT:
|
| ︙ | ︙ | |||
3533 3534 3535 3536 3537 3538 3539 |
}
} else {
/*
* Compare as ints.
*/
i = valuePtr->internalRep.longValue;
i2 = value2Ptr->internalRep.longValue;
| | | 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 |
}
} else {
/*
* Compare as ints.
*/
i = valuePtr->internalRep.longValue;
i2 = value2Ptr->internalRep.longValue;
switch (inst) {
case INST_EQ:
iResult = i == i2;
break;
case INST_NEQ:
iResult = i != i2;
break;
case INST_LT:
|
| ︙ | ︙ | |||
3563 3564 3565 3566 3567 3568 3569 |
/*
* Peep-hole optimisation: if you're about to jump, do jump
* from here.
*/
foundResult:
| < > | | | | > | > | > | | < > | < > | | | 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 |
/*
* Peep-hole optimisation: if you're about to jump, do jump
* from here.
*/
foundResult:
/*
* Jump-if-true extension. Note that opnd==0 (which would mean
* 'ignore the result, do this again' and have the effect of two
* INST_POPs and a jump back here) is taken to mean "push the
* result".
*/
if (opnd) {
if (iResult) {
pc += opnd;
} else {
pc++;
}
NEXT_INST_F(2,0);
}
pc++;
objResultPtr = eePtr->constants[iResult];
NEXT_INST_F(2, 1);
}
case INST_MOD:
case INST_LSHIFT:
case INST_RSHIFT:
case INST_BITOR:
case INST_BITXOR:
|
| ︙ | ︙ | |||
3630 3631 3632 3633 3634 3635 3636 | (value2Ptr->typePtr? value2Ptr->typePtr->name : "null"))); IllegalExprOperandType(interp, pc, value2Ptr); goto checkForCatch; } } | | | 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 |
(value2Ptr->typePtr?
value2Ptr->typePtr->name : "null")));
IllegalExprOperandType(interp, pc, value2Ptr);
goto checkForCatch;
}
}
switch (inst) {
case INST_MOD:
/*
* This code is tricky: C doesn't guarantee much about
* the quotient or remainder, but Tcl does. The
* remainder always has the same sign as the divisor and
* a smaller absolute value.
*/
|
| ︙ | ︙ | |||
3864 3865 3866 3867 3868 3869 3870 | iResult = i & i2; break; } /* * Reuse the valuePtr object already on stack if possible. */ | | | | | | | | | 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 |
iResult = i & i2;
break;
}
/*
* Reuse the valuePtr object already on stack if possible.
*/
pc++;
if (Tcl_IsShared(valuePtr)) {
if (doWide) {
TclNewWideIntObj(objResultPtr, wResult);
TRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
} else {
TclNewLongObj(objResultPtr, iResult);
TRACE(("%ld %ld => %ld\n", i, i2, iResult));
}
NEXT_INST_F(2, 1);
} else { /* reuse the valuePtr object */
if (doWide) {
TRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
TclSetWideIntObj(valuePtr, wResult);
} else {
TRACE(("%ld %ld => %ld\n", i, i2, iResult));
TclSetLongObj(valuePtr, iResult);
}
NEXT_INST_F(1, 0);
}
}
case INST_ADD:
case INST_SUB:
case INST_MULT:
case INST_DIV:
|
| ︙ | ︙ | |||
3992 3993 3994 3995 3996 3997 3998 |
} else if (t2Ptr == &tclIntType) {
d2 = i2; /* promote value 2 to double */
} else if (t1Ptr == &tclWideIntType) {
d1 = Tcl_WideAsDouble(w);
} else if (t2Ptr == &tclWideIntType) {
d2 = Tcl_WideAsDouble(w2);
}
| | > > > > > > > > | | | 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 |
} else if (t2Ptr == &tclIntType) {
d2 = i2; /* promote value 2 to double */
} else if (t1Ptr == &tclWideIntType) {
d1 = Tcl_WideAsDouble(w);
} else if (t2Ptr == &tclWideIntType) {
d2 = Tcl_WideAsDouble(w2);
}
switch (inst) {
case INST_ADD:
dResult = d1 + d2;
break;
case INST_SUB:
dResult = d1 - d2;
break;
case INST_MULT:
dResult = d1 * d2;
break;
case INST_DIV:
#ifndef IEEE_FLOATING_POINT
if (d2 == 0.0) {
TRACE(("%.6g %.6g => DIVIDE BY ZERO\n", d1, d2));
goto divideByZero;
}
#endif
/*
* We presume that we are running with zero-divide
* unmasked if we're on an IEEE box. Otherwise,
* this statement might cause demons to fly out
* our noses.
*/
dResult = d1 / d2;
break;
case INST_EXPON:
if (d1==0.0 && d2<0.0) {
TRACE(("%.6g %.6g => EXPONENT OF ZERO\n", d1, d2));
goto exponOfZero;
}
dResult = pow(d1, d2);
break;
}
/*
* Check now for IEEE floating-point error.
*/
if (IS_NAN(dResult)) {
TRACE(("%.20s %.20s => IEEE FLOATING PT ERROR\n",
O2S(valuePtr), O2S(value2Ptr)));
TclExprFloatError(interp, dResult);
result = TCL_ERROR;
goto checkForCatch;
}
} else if ((t1Ptr == &tclWideIntType)
|| (t2Ptr == &tclWideIntType)) {
/*
* Do wide integer arithmetic.
*/
doWide = 1;
if (t1Ptr == &tclIntType) {
w = Tcl_LongAsWide(i);
} else if (t2Ptr == &tclIntType) {
w2 = Tcl_LongAsWide(i2);
}
switch (inst) {
case INST_ADD:
wResult = w + w2;
break;
case INST_SUB:
wResult = w - w2;
break;
case INST_MULT:
|
| ︙ | ︙ | |||
4087 4088 4089 4090 4091 4092 4093 |
break;
}
}
} else {
/*
* Do integer arithmetic.
*/
| | | 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 |
break;
}
}
} else {
/*
* Do integer arithmetic.
*/
switch (inst) {
case INST_ADD:
iResult = i + i2;
break;
case INST_SUB:
iResult = i - i2;
break;
case INST_MULT:
|
| ︙ | ︙ | |||
4135 4136 4137 4138 4139 4140 4141 | } } } /* * Reuse the valuePtr object already on stack if possible. */ | | | | | | | | | | | 3848 3849 3850 3851 3852 3853 3854 3855 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 |
}
}
}
/*
* Reuse the valuePtr object already on stack if possible.
*/
pc++;
if (Tcl_IsShared(valuePtr)) {
if (doDouble) {
TclNewDoubleObj(objResultPtr, dResult);
TRACE(("%.6g %.6g => %.6g\n", d1, d2, dResult));
} else if (doWide) {
TclNewWideIntObj(objResultPtr, wResult);
TRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
} else {
TclNewLongObj(objResultPtr, iResult);
TRACE(("%ld %ld => %ld\n", i, i2, iResult));
}
NEXT_INST_F(2, 1);
} else { /* reuse the valuePtr object */
if (doDouble) { /* NB: stack top is off by 1 */
TRACE(("%.6g %.6g => %.6g\n", d1, d2, dResult));
TclSetDoubleObj(valuePtr, dResult);
} else if (doWide) {
TRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
TclSetWideIntObj(valuePtr, wResult);
} else {
TRACE(("%ld %ld => %ld\n", i, i2, iResult));
TclSetLongObj(valuePtr, iResult);
}
NEXT_INST_F(1, 0);
}
}
case INST_UPLUS:
{
/*
* Operand must be numeric.
|
| ︙ | ︙ | |||
4215 4216 4217 4218 4219 4220 4221 | * Ensure that the operand's string rep is the same as the * formatted version of its internal rep. This makes sure * that "expr +000123" yields "83", not "000123". We * implement this by _discarding_ the string rep since we * know it will be regenerated, if needed later, by * formatting the internal rep's value. */ | | > | | | | | | > | 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 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 |
* Ensure that the operand's string rep is the same as the
* formatted version of its internal rep. This makes sure
* that "expr +000123" yields "83", not "000123". We
* implement this by _discarding_ the string rep since we
* know it will be regenerated, if needed later, by
* formatting the internal rep's value.
*/
pc++;
if (Tcl_IsShared(valuePtr)) {
if (tPtr == &tclIntType) {
TclNewLongObj(objResultPtr, valuePtr->internalRep.longValue);
} else if (tPtr == &tclWideIntType) {
Tcl_WideInt w;
TclGetWide(w,valuePtr);
TclNewWideIntObj(objResultPtr, w);
} else {
TclNewDoubleObj(objResultPtr, valuePtr->internalRep.doubleValue);
}
TRACE_WITH_OBJ(("%s => ", O2S(objResultPtr)), objResultPtr);
NEXT_INST_F(1, 1);
} else {
TclInvalidateStringRep(valuePtr);
TRACE_WITH_OBJ(("%s => ", O2S(valuePtr)), valuePtr);
NEXT_INST_F(0, 0);
}
}
case INST_UMINUS:
case INST_LNOT:
case INST_LYES:
{
/*
* The operand must be numeric or a boolean string as
* accepted by Tcl_GetBooleanFromObj(). If the operand
* object is unshared modify it directly, otherwise
* create a copy to modify: this is "copy on write".
* Free any old string representation since it is now
|
| ︙ | ︙ | |||
4270 4271 4272 4273 4274 4275 4276 |
* interpreted as an integer.)
*/
} else {
/*
* Otherwise, we need to generate a numeric internal rep.
* from the string rep.
*/
| < < < | | | | | | | | | | | | | | | | | | < > > | | | | | | | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > < | < < < | < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < | | 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 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 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 |
* interpreted as an integer.)
*/
} else {
/*
* Otherwise, we need to generate a numeric internal rep.
* from the string rep.
*/
int length;
char *s = Tcl_GetStringFromObj(valuePtr, &length);
if (TclLooksLikeInt(s, length)) {
GET_WIDE_OR_INT(result, valuePtr, i, w);
} else {
result = Tcl_GetDoubleFromObj((Tcl_Interp *) NULL,
valuePtr, &d);
}
if (result == TCL_ERROR && inst == INST_LNOT) {
result = Tcl_GetBooleanFromObj((Tcl_Interp *)NULL,
valuePtr, &boolvar);
i = (long)boolvar; /* i is long, not int! */
}
if (result != TCL_OK) {
TRACE(("\"%.20s\" => ILLEGAL TYPE %s\n",
s, (tPtr? tPtr->name : "null")));
IllegalExprOperandType(interp, pc, valuePtr);
goto checkForCatch;
}
tPtr = valuePtr->typePtr;
}
pc++;
if (inst == INST_UMINUS) {
if (Tcl_IsShared(valuePtr)) {
/*
* Create a new object.
*/
if (tPtr == &tclIntType) {
i = valuePtr->internalRep.longValue;
TclNewLongObj(objResultPtr, -i);
TRACE_WITH_OBJ(("%ld => ", i), objResultPtr);
} else if (tPtr == &tclWideIntType) {
TclGetWide(w,valuePtr);
TclNewWideIntObj(objResultPtr, -w);
TRACE_WITH_OBJ((LLD" => ", w), objResultPtr);
} else {
d = valuePtr->internalRep.doubleValue;
TclNewDoubleObj(objResultPtr, -d);
TRACE_WITH_OBJ(("%.6g => ", d), objResultPtr);
}
NEXT_INST_F(1, 1);
} else {
/*
* valuePtr is unshared. Modify it directly.
*/
if (tPtr == &tclIntType) {
i = valuePtr->internalRep.longValue;
TclSetLongObj(valuePtr, -i);
TRACE_WITH_OBJ(("%ld => ", i), valuePtr);
} else if (tPtr == &tclWideIntType) {
TclGetWide(w,valuePtr);
TclSetWideIntObj(valuePtr, -w);
TRACE_WITH_OBJ((LLD" => ", w), valuePtr);
} else {
d = valuePtr->internalRep.doubleValue;
TclSetDoubleObj(valuePtr, -d);
TRACE_WITH_OBJ(("%.6g => ", d), valuePtr);
}
NEXT_INST_F(0, 0);
}
} else { /* inst is INST_LNOT or INST_LYES*/
if ((tPtr == &tclIntType) || (tPtr == &tclBooleanType)){
i = valuePtr->internalRep.longValue;
TRACE_WITH_OBJ(("%ld => ", i), objResultPtr);
} else if (tPtr == &tclWideIntType) {
TclGetWide(w,valuePtr);
i = (w != W0);
TRACE_WITH_OBJ((LLD" => ", w), objResultPtr);
} else {
i = (valuePtr->internalRep.doubleValue != 0.0);
TRACE_WITH_OBJ(("%.6g => ", d), objResultPtr);
}
objResultPtr = ((inst == INST_LNOT)?
eePtr->constants[!i]:eePtr->constants[i]);
NEXT_INST_F(1, 1);
}
}
case INST_BITNOT:
{
/*
* The operand must be an integer. If the operand object is
|
| ︙ | ︙ | |||
4386 4387 4388 4389 4390 4391 4392 |
if (result != TCL_OK) { /* try to convert to double */
TRACE(("\"%.20s\" => ILLEGAL TYPE %s\n",
O2S(valuePtr), (tPtr? tPtr->name : "null")));
IllegalExprOperandType(interp, pc, valuePtr);
goto checkForCatch;
}
}
| | > | | | | < < < < < < < < < < < < < < < < < < < < < < < | < | < < < < < < < < < < < | | < < | < < > | > > > | < < < < | < < < < < < < | | < > > | | > | | 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 |
if (result != TCL_OK) { /* try to convert to double */
TRACE(("\"%.20s\" => ILLEGAL TYPE %s\n",
O2S(valuePtr), (tPtr? tPtr->name : "null")));
IllegalExprOperandType(interp, pc, valuePtr);
goto checkForCatch;
}
}
pc++;
if (valuePtr->typePtr == &tclWideIntType) {
TclGetWide(w,valuePtr);
if (Tcl_IsShared(valuePtr)) {
TclNewWideIntObj(objResultPtr, ~w);
TRACE(("0x%llx => (%llu)\n", w, ~w));
NEXT_INST_F(1, 1);
} else {
/*
* valuePtr is unshared. Modify it directly.
*/
TclSetWideIntObj(valuePtr, ~w);
TRACE(("0x%llx => (%llu)\n", w, ~w));
NEXT_INST_F(0, 0);
}
} else {
i = valuePtr->internalRep.longValue;
if (Tcl_IsShared(valuePtr)) {
TclNewLongObj(objResultPtr, ~i);
TRACE(("0x%lx => (%lu)\n", i, ~i));
NEXT_INST_F(1, 1);
} else {
/*
* valuePtr is unshared. Modify it directly.
*/
TclSetLongObj(valuePtr, ~i);
TRACE(("0x%lx => (%lu)\n", i, ~i));
NEXT_INST_F(0, 0);
}
}
}
case INST_CALL_BUILTIN_FUNC:
Tcl_Panic("TclExecuteByteCode: obsolete INST_CALL_BUILTIN_FUNC found");
case INST_CALL_FUNC:
Tcl_Panic("TclExecuteByteCode: obsolete INST_CALL_FUNC found");
case INST_TRY_CVT_TO_NUMERIC:
{
/*
* Try to convert the topmost stack object to an int or
* double object. This is done in order to support Tcl's
* policy of interpreting operands if at all possible as
* first integers, else floating-point numbers.
|
| ︙ | ︙ | |||
4501 4502 4503 4504 4505 4506 4507 |
* interpreted as an integer.)
*/
} else {
/*
* Otherwise, we need to generate a numeric internal rep.
* from the string rep.
*/
| < < < < | | | | | | | | | | | < | 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 |
* interpreted as an integer.)
*/
} else {
/*
* Otherwise, we need to generate a numeric internal rep.
* from the string rep.
*/
s = Tcl_GetStringFromObj(valuePtr, &length);
if (TclLooksLikeInt(s, length)) {
GET_WIDE_OR_INT(result, valuePtr, i, w);
} else {
result = Tcl_GetDoubleFromObj((Tcl_Interp *) NULL,
valuePtr, &d);
}
if (result == TCL_OK) {
converted = 1;
}
result = TCL_OK; /* reset the result variable */
tPtr = valuePtr->typePtr;
}
/*
* Ensure that the topmost stack object, if numeric, has a
* string rep the same as the formatted version of its
* internal rep. This is used, e.g., to make sure that "expr
|
| ︙ | ︙ | |||
4543 4544 4545 4546 4547 4548 4549 |
/*
* We only need to make a copy of the object
* when it already had a string rep
*/
needNew = 1;
if (tPtr == &tclIntType) {
i = valuePtr->internalRep.longValue;
| | | | | > | | > > > > > > > > | | | | > > > > > > | | | > | > | | > | < > | > > | | > > | < < | | > | < < | | < < | | < < | > > | < > | > | | < | < | | | > | | > > > | < | | | < | < > | < < | < < > > > > > | | > | > | | < | > | > > | > | > | > > | | > > > | > | | > > > > > > > | | | > > > > > > > > > > | > > > < > > | < < < < > > > > > > > > | > | | | < < < | | 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 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 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 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 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 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 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 |
/*
* We only need to make a copy of the object
* when it already had a string rep
*/
needNew = 1;
if (tPtr == &tclIntType) {
i = valuePtr->internalRep.longValue;
TclNewLongObj(objResultPtr, i);
} else if (tPtr == &tclWideIntType) {
TclGetWide(w,valuePtr);
TclNewWideIntObj(objResultPtr, w);
} else {
d = valuePtr->internalRep.doubleValue;
TclNewDoubleObj(objResultPtr, d);
}
tPtr = objResultPtr->typePtr;
}
} else {
Tcl_InvalidateStringRep(valuePtr);
}
if (tPtr == &tclDoubleType) {
d = objResultPtr->internalRep.doubleValue;
if (IS_NAN(d)) {
TRACE(("\"%.20s\" => IEEE FLOATING PT ERROR\n",
O2S(objResultPtr)));
TclExprFloatError(interp, d);
result = TCL_ERROR;
goto checkForCatch;
}
}
converted = converted; /* lint, converted not used. */
TRACE(("\"%.20s\" => numeric, %s, %s\n", O2S(valuePtr),
(converted? "converted" : "not converted"),
(needNew? "new Tcl_Obj" : "same Tcl_Obj")));
} else {
TRACE(("\"%.20s\" => not numeric\n", O2S(valuePtr)));
}
pc++;
if (needNew) {
NEXT_INST_F(1, 1);
} else {
NEXT_INST_F(0, 0);
}
}
case INST_BREAK:
case INST_CONTINUE:
#if ENABLE_PEEPHOLE
if (opnd < 0) {
unknownLoopExceptionReturn:
/*
* No active loop range, detected at compile time.
*/
#endif
DECACHE_STACK_INFO();
Tcl_ResetResult(interp);
CACHE_STACK_INFO();
result = ((inst == INST_BREAK)? TCL_BREAK : TCL_CONTINUE);
if (opnd == -2) {
/*
* Trapped by a catch, detected at compile time.
*/
goto processCatch;
} else {
cleanup = 0;
goto processExceptionReturn;
}
#if ENABLE_PEEPHOLE
} else {
ExceptionRange *rangePtr = &codePtr->exceptArrayPtr[opnd];
if (inst == INST_BREAK) {
pc = (codePtr->codeStart + rangePtr->breakOffset);
NEXT_INST_F(0,0);
} else if (rangePtr->continueOffset != -1) {
pc = codePtr->codeStart + rangePtr->continueOffset;
NEXT_INST_F(0,0);
}
goto unknownLoopExceptionReturn;
}
#endif
case INST_FOREACH_START:
{
/*
* Initialize the temporary local var that holds the count
* of the number of iterations of the loop body to -1.
*/
ForeachInfo *infoPtr;
int iterTmpIndex;
Var *iterVarPtr;
Tcl_Obj *oldValuePtr;
infoPtr = (ForeachInfo *)
codePtr->auxDataArrayPtr[opnd].clientData;
iterTmpIndex = infoPtr->loopCtTemp;
iterVarPtr = (Var *) &(compiledLocals[iterTmpIndex]);
oldValuePtr = iterVarPtr->value.objPtr;
if (oldValuePtr == NULL) {
TclNewLongObj(iterVarPtr->value.objPtr, -1);
Tcl_IncrRefCount(iterVarPtr->value.objPtr);
TclSetVarDirectScalar(iterVarPtr);
} else {
TclSetLongObj(oldValuePtr, -1);
}
TRACE(("%u => loop iter count temp %d\n",
(unsigned) opnd, iterTmpIndex));
/*
* Jump to the test at INST_FOREACH_STEP
*/
infoPtr->restartPc = codePtr->codeStart +
codePtr->exceptArrayPtr[infoPtr->rangeIndex].codeOffset;
pc = codePtr->codeStart +
codePtr->exceptArrayPtr[infoPtr->rangeIndex].continueOffset;
NEXT_INST_F(0,0);
}
case INST_FOREACH_STEP:
{
/*
* "Step" a foreach loop (i.e., begin its next iteration) by
* assigning the next value list element to each loop var.
*/
ForeachInfo *infoPtr;
ForeachVarList *varListPtr;
int numLists;
Tcl_Obj *listPtr,*valuePtr, *value2Ptr;
Tcl_Obj **elements;
Var *iterVarPtr, *listVarPtr;
int iterNum, listTmpIndex, listLen, numVars;
int varIndex, valIndex, continueLoop, j;
long i;
Var *varPtr;
char *part1;
infoPtr = (ForeachInfo *)
codePtr->auxDataArrayPtr[opnd].clientData;
numLists = infoPtr->numLists;
/*
* Increment the temp holding the loop iteration number.
*/
iterVarPtr = (Var *) &(compiledLocals[infoPtr->loopCtTemp]);
valuePtr = iterVarPtr->value.objPtr;
iterNum = (valuePtr->internalRep.longValue + 1);
TclSetLongObj(valuePtr, iterNum);
/*
* Check whether all value lists are exhausted and we should
* stop the loop.
*/
continueLoop = 0;
listTmpIndex = infoPtr->firstValueTemp;
for (i = 0; i < numLists; i++) {
varListPtr = infoPtr->varLists[i];
numVars = varListPtr->numVars;
listVarPtr = (Var *) &(compiledLocals[listTmpIndex]);
listPtr = listVarPtr->value.objPtr;
result = Tcl_ListObjLength(interp, listPtr, &listLen);
if (result != TCL_OK) {
TRACE_WITH_OBJ(("%u => ERROR converting list %ld, \"%s\": ",
(unsigned) opnd, i, O2S(listPtr)),
Tcl_GetObjResult(interp));
goto checkForCatch;
}
if (listLen > (iterNum * numVars)) {
continueLoop = 1;
}
listTmpIndex++;
}
/*
* If some var in some var list still has a remaining list
* element iterate one more time. Assign to var the next
* element from its value list. We already checked above
* that each list temp holds a valid list object (by calling
* Tcl_ListObjLength), but cannot rely on that check remaining
* valid: one list could have been shimmered as a side effect of
* setting a traced variable.
*/
if (continueLoop) {
listTmpIndex = infoPtr->firstValueTemp;
for (i = 0; i < numLists; i++) {
varListPtr = infoPtr->varLists[i];
numVars = varListPtr->numVars;
listVarPtr = (Var *) &(compiledLocals[listTmpIndex]);
listPtr = listVarPtr->value.objPtr;
Tcl_ListObjGetElements(interp, listPtr, &listLen, &elements);
valIndex = (iterNum * numVars);
for (j = 0; j < numVars; j++) {
int setEmptyStr = 0;
if (valIndex >= listLen) {
setEmptyStr = 1;
TclNewObj(valuePtr);
} else {
valuePtr = elements[valIndex];
}
varIndex = varListPtr->varIndexes[j];
varPtr = (Var *) &(compiledLocals[varIndex]);
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
if (TclIsVarDirectWritable(varPtr)) {
value2Ptr = varPtr->value.objPtr;
if (valuePtr != value2Ptr) {
if (value2Ptr != NULL) {
TclDecrRefCount(value2Ptr);
} else {
TclSetVarDirectScalar(varPtr);
}
varPtr->value.objPtr = valuePtr;
Tcl_IncrRefCount(valuePtr);
}
} else {
part1 = varNames[varIndex];
DECACHE_STACK_INFO();
value2Ptr = TclPtrSetVar(interp, varPtr, NULL, part1,
NULL, valuePtr, TCL_LEAVE_ERR_MSG);
CACHE_STACK_INFO();
if (value2Ptr == NULL) {
TRACE_WITH_OBJ(("%u => ERROR init. index temp %d: ",
(unsigned) opnd, varIndex),
Tcl_GetObjResult(interp));
if (setEmptyStr) {
TclDecrRefCount(valuePtr);
}
result = TCL_ERROR;
goto checkForCatch;
}
}
valIndex++;
}
listTmpIndex++;
}
}
/*
* Code for the new [foreach] compiler, avoiding the
* pushing/popping/testing/elimination of a freshly created
* Tcl_Obj.
*/
TRACE(("%u => %d lists, iter %d, %s loop\n",
(unsigned) opnd, numLists, iterNum,
(continueLoop? "continue" : "exit")));
if (continueLoop) {
pc = infoPtr->restartPc;
NEXT_INST_F(0,0);
} else {
pc++;
NEXT_INST_F(0, 0);
}
}
case INST_BEGIN_CATCH:
/*
* Record the current stacktop and pc; the operand stores the offset to
* the corresponding INST_END_CATCH, and will be read if the catch
* fires (see code at the 'processCatch:' label below).
*/
catchItems++;
catchStackPtr[catchItems].stackTop = (tosPtr - eePtr->stackPtr);
catchStackPtr[catchItems].pc = pc;
TRACE(("%u catch => catchItems=%d, stackTop=%d, endCatch at %u\n",
(unsigned) (pc - codePtr->codeStart),catchItems,
(int) (tosPtr - eePtr->stackPtr),
(unsigned) (pc - codePtr->codeStart + opnd)));
pc++;
NEXT_INST_F(0, 0);
case INST_END_CATCH:
endCatch:
{
int realCode = result;
result = TCL_OK;
catchItems--;
TRACE(("=> catchItems=%d\n", catchItems));
if (opnd >= 0) {
/*
* Store the interp's result in the local variable at index opnd.
*/
Var *varPtr = (Var *) &(compiledLocals[opnd]);
char *part1 = varNames[opnd];
Tcl_Obj *valuePtr;
valuePtr = *tosPtr;
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
DECACHE_STACK_INFO();
valuePtr = TclPtrSetVar(interp, varPtr, NULL,
part1, NULL, *tosPtr,
TCL_LEAVE_ERR_MSG);
CACHE_STACK_INFO();
if (valuePtr == NULL) {
result = TCL_ERROR;
goto checkForCatch;
}
}
pc++;
#if ENABLE_PEEPHOLE
/*
* Peep-hole optimisation: if you're about to jump, do jump
* from here.
*/
TclVMGetInstAndOpAtPtr(pc, inst, opnd);
switch (inst) {
case INST_JUMP_FALSE:
pc += ((realCode)? 1 : opnd);
NEXT_INST_F(1, 0);
case INST_JUMP_TRUE:
pc += ((realCode)? opnd : 1);
NEXT_INST_F(1, 0);
}
#endif
TclNewLongObj(objResultPtr, realCode);
NEXT_INST_F(1, 1);
}
default:
Tcl_Panic("TclExecuteByteCode: unrecognized opCode %u", inst);
} /* end of switch on opCode */
/*
* Division by zero in an expression. Control only reaches this
* point by "goto divideByZero".
*/
|
| ︙ | ︙ | |||
4865 4866 4867 4868 4869 4870 4871 | * exception range enclosing the pc. Used * by various instructions and processCatch * to process break, continue, and * errors. */ Tcl_Obj *valuePtr; char *bytes; int length; | < < < | | < < < < < < < < < < < < < | | > > > > > > > > > < < < < | | | 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 |
* exception range enclosing the pc. Used
* by various instructions and processCatch
* to process break, continue, and
* errors. */
Tcl_Obj *valuePtr;
char *bytes;
int length;
/*
* An external evaluation (INST_INVOKE or INST_EVAL) returned
* something different from TCL_OK, or else INST_BREAK or
* INST_CONTINUE were called.
*/
processExceptionReturn:
#if TCL_COMPILE_DEBUG
switch (inst) {
case INST_INVOKE_STK:
case INST_EVAL_STK:
break;
default:
TRACE(("=> "));
}
#endif
if ((result == TCL_CONTINUE) || (result == TCL_BREAK)) {
rangePtr = GetExceptRangeForPc(pc, codePtr);
if (catchItems && ((rangePtr == NULL) ||
(codePtr->codeStart + rangePtr->codeOffset
<= catchStackPtr[catchItems].pc))) {
/*
* This is caught earlier by an active catch range!
*/
goto processCatch;
}
if (rangePtr == NULL) {
TRACE_APPEND(("no encl. loop or catch, returning %s\n",
StringForResultCode(result)));
goto abnormalReturn;
}
while (cleanup--) {
valuePtr = POP_OBJECT();
TclDecrRefCount(valuePtr);
}
if (result == TCL_BREAK) {
result = TCL_OK;
pc = (codePtr->codeStart + rangePtr->breakOffset);
TRACE_APPEND(("%s, range at %d, new pc %d\n",
StringForResultCode(result),
rangePtr->codeOffset, rangePtr->breakOffset));
NEXT_INST_F(0,0);
} else {
if (rangePtr->continueOffset == -1) {
TRACE_APPEND(("%s, loop w/o continue, checking for catch\n",
StringForResultCode(result)));
goto checkForCatch;
}
result = TCL_OK;
pc = (codePtr->codeStart + rangePtr->continueOffset);
TRACE_APPEND(("%s, range at %d, new pc %d\n",
StringForResultCode(result),
rangePtr->codeOffset, rangePtr->continueOffset));
NEXT_INST_F(0,0);
}
#if TCL_COMPILE_DEBUG
} else if (traceInstructions) {
if ((result != TCL_ERROR) && (result != TCL_RETURN)) {
Tcl_Obj *objPtr = Tcl_GetObjResult(interp);
TRACE_APPEND(("OTHER RETURN CODE %d, result= \"%s\"\n ",
result, O2S(objPtr)));
|
| ︙ | ︙ | |||
4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 |
checkForCatch:
if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) {
bytes = GetSrcInfoForPc(pc, codePtr, &length);
if (bytes != NULL) {
Tcl_LogCommandInfo(interp, codePtr->source, bytes, length);
}
}
iPtr->flags &= ~ERR_ALREADY_LOGGED;
/*
* Clear all expansions that may have started after the last
* INST_BEGIN_CATCH.
*/
| > | | < < < < < | < < < < | < < < < < | | | > > > > > > > > > > | | | | | | > > | > | > > > > > | | > > > > > > > > > > | > | 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 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 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 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 |
checkForCatch:
if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) {
bytes = GetSrcInfoForPc(pc, codePtr, &length);
if (bytes != NULL) {
Tcl_LogCommandInfo(interp, codePtr->source, bytes, length);
}
}
iPtr->flags &= ~ERR_ALREADY_LOGGED;
/*
* Clear all expansions that may have started after the last
* INST_BEGIN_CATCH.
*/
while ((expandNestList) && ((catchItems == 0) ||
((ptrdiff_t) catchStackPtr[catchItems].stackTop <=
(ptrdiff_t) expandNestList->internalRep.twoPtrValue.ptr1))) {
Tcl_Obj *objPtr = expandNestList->internalRep.twoPtrValue.ptr2;
TclDecrRefCount(expandNestList);
expandNestList = objPtr;
}
/*
* We must not catch an exceeded limit. Instead, it blows
* outwards until we either hit another interpreter (presumably
* where the limit is not exceeded) or we get to the top-level.
*/
if (Tcl_LimitExceeded(interp)) {
#ifdef TCL_COMPILE_DEBUG
if (traceInstructions) {
fprintf(stdout, " ... limit exceeded, returning %s\n",
StringForResultCode(result));
}
#endif
goto abnormalReturn;
}
if (catchItems == 0) {
#ifdef TCL_COMPILE_DEBUG
if (traceInstructions) {
fprintf(stdout, " ... no enclosing catch, returning %s\n",
StringForResultCode(result));
}
#endif
goto abnormalReturn;
}
/*
* A catch exception range (rangePtr) was found to handle an
* "exception". It was found either by checkForCatch just above or
* by an instruction during break, continue, or error processing.
* Jump to its INST_END_CATCH location after unwinding the operand
* stack to the depth it had when starting to execute the range's catch
* command.
*/
processCatch:
while (tosPtr > eePtr->stackPtr + catchStackPtr[catchItems].stackTop) {
valuePtr = POP_OBJECT();
TclDecrRefCount(valuePtr);
}
/*
* Read the data of the INST_BEGIN_CATCH
*/
pc = catchStackPtr[catchItems].pc;
TclVMGetInstAndOpAtPtr(pc, inst, opnd);
#ifdef TCL_COMPILE_DEBUG
if (inst != INST_BEGIN_CATCH) {
Tcl_Panic("Should have found an INST_BEGIN_CATCH instruction!");
}
if (traceInstructions) {
fprintf(stdout, " ... found catch at %d, catchItems=%d, unwound to %d, new pc %u\n",
(pc - codePtr->codeStart), catchItems,
(int) catchStackPtr[catchItems].stackTop,
(pc + opnd + 1 - codePtr->codeStart));
}
#endif
pc += opnd;
TclVMGetInstAndOpAtPtr(pc, inst, opnd);
#ifdef TCL_COMPILE_DEBUG
if (inst != INST_END_CATCH) {
Tcl_Panic("Should have found an INST_END_CATCH instruction!");
}
#endif
objResultPtr = Tcl_GetObjResult(interp);
PUSH_OBJECT(objResultPtr);
goto endCatch;
/*
* end of infinite loop dispatching on instructions.
*/
/*
* Abnormal return code. Restore the stack to state it had when starting
* to execute the ByteCode. Panic if the stack is below the initial level.
*/
abnormalReturn:
{
Tcl_Obj **initTosPtr = eePtr->stackPtr + initStackTop;
while (tosPtr > initTosPtr) {
Tcl_Obj *objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
}
/*
* Clear all expansions.
*/
while (expandNestList) {
Tcl_Obj *objPtr = expandNestList->internalRep.twoPtrValue.ptr2;
TclDecrRefCount(expandNestList);
expandNestList = objPtr;
}
if (tosPtr < initTosPtr) {
fprintf(stderr, "\nTclExecuteByteCode: abnormal return at pc %u: stack top %d < entry stack top %d\n",
(unsigned int)(pc - codePtr->codeStart),
(unsigned int) (tosPtr - eePtr->stackPtr),
(unsigned int) initStackTop);
Tcl_Panic("TclExecuteByteCode execution failure: end stack top < start stack top");
}
eePtr->tosPtr = eePtr->stackPtr + initCatch;
}
}
return result;
#undef iPtr
}
#ifdef TCL_COMPILE_DEBUG
|
| ︙ | ︙ | |||
5108 5109 5110 5111 5112 5113 5114 |
iPtr->compileEpoch);
fprintf(stdout, " Source: ");
TclPrintSource(stdout, codePtr->source, 60);
fprintf(stdout, "\n Cmds %d, src %d, inst %u, litObjs %u, aux %d, stkDepth %u, code/src %.2f\n",
codePtr->numCommands, codePtr->numSrcBytes,
| | | | 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 |
iPtr->compileEpoch);
fprintf(stdout, " Source: ");
TclPrintSource(stdout, codePtr->source, 60);
fprintf(stdout, "\n Cmds %d, src %d, inst %u, litObjs %u, aux %d, stkDepth %u, code/src %.2f\n",
codePtr->numCommands, codePtr->numSrcBytes,
codePtr->numCodeWords*sizeof(TclVMWord), codePtr->numLitObjects,
codePtr->numAuxDataItems, codePtr->maxStackDepth,
#ifdef TCL_COMPILE_STATS
(codePtr->numSrcBytes?
((float)codePtr->structureSize)/((float)codePtr->numSrcBytes) : 0.0));
#else
0.0);
#endif
#ifdef TCL_COMPILE_STATS
fprintf(stdout, " Code %d = header %d+inst %d+litObj %d+exc %d+aux %d+cmdMap %d\n",
codePtr->structureSize,
(sizeof(ByteCode) - (sizeof(size_t) + sizeof(Tcl_Time))),
codePtr->numCodeWords*sizeof(TclVMWord),
(codePtr->numLitObjects * sizeof(Tcl_Obj *)),
(codePtr->numExceptRanges * sizeof(ExceptionRange)),
(codePtr->numAuxDataItems * sizeof(AuxData)),
codePtr->numCmdLocBytes);
#endif /* TCL_COMPILE_STATS */
if (procPtr != NULL) {
fprintf(stdout,
|
| ︙ | ︙ | |||
5159 5160 5161 5162 5163 5164 5165 |
*/
#ifdef TCL_COMPILE_DEBUG
static void
ValidatePcAndStackTop(codePtr, pc, stackTop, stackLowerBound, checkStack)
register ByteCode *codePtr; /* The bytecode whose summary is printed
* to stdout. */
| | | | < | | | | | | | | | 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 |
*/
#ifdef TCL_COMPILE_DEBUG
static void
ValidatePcAndStackTop(codePtr, pc, stackTop, stackLowerBound, checkStack)
register ByteCode *codePtr; /* The bytecode whose summary is printed
* to stdout. */
TclVMWord *pc; /* Points to first byte of a bytecode
* instruction. The program counter. */
int stackTop; /* Current stack top. Must be between
* stackLowerBound and stackUpperBound
* (inclusive). */
int stackLowerBound; /* Smallest legal value for stackTop. */
int checkStack; /* 0 if the stack depth check should be
* skipped. */
{
int stackUpperBound = stackLowerBound + codePtr->maxStackDepth;
/* Greatest legal value for stackTop. */
ptrdiff_t relativePc = (ptrdiff_t) (pc - codePtr->codeStart);
TclVMWord *codeStart = codePtr->codeStart;
TclVMWord *codeEnd = (codePtr->codeStart + codePtr->numCodeWords);
unsigned int opCode = (unsigned int) TclVMGetInstAtPtr(pc);
if (( pc < codeStart) || (pc > codeEnd)) {
fprintf(stderr, "\nBad instruction pc %p in TclExecuteByteCode\n",
(VOID *) pc);
Tcl_Panic("TclExecuteByteCode execution failure: bad pc");
}
if (opCode > LAST_INST_OPCODE) {
fprintf(stderr, "\nBad opcode %d at pc %i in TclExecuteByteCode\n",
opCode, relativePc);
Tcl_Panic("TclExecuteByteCode execution failure: bad opcode");
}
if (checkStack &&
((stackTop < stackLowerBound) || (stackTop > stackUpperBound))) {
int numChars;
char *cmd = GetSrcInfoForPc(pc, codePtr, &numChars);
|
| ︙ | ︙ | |||
5230 5231 5232 5233 5234 5235 5236 |
*----------------------------------------------------------------------
*/
static void
IllegalExprOperandType(interp, pc, opndPtr)
Tcl_Interp *interp; /* Interpreter to which error information
* pertains. */
| | | | < < < | 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 |
*----------------------------------------------------------------------
*/
static void
IllegalExprOperandType(interp, pc, opndPtr)
Tcl_Interp *interp; /* Interpreter to which error information
* pertains. */
TclVMWord *pc; /* Points to the instruction being executed
* when the illegal type was found. */
Tcl_Obj *opndPtr; /* Points to the operand holding the value
* with the illegal type. */
{
int opCode = TclVMGetInstAtPtr(pc);
CONST char *operator = operatorStrings[opCode - FIRST_OPERATOR_INST ];
Tcl_SetObjResult(interp, Tcl_NewObj());
if ((opndPtr->bytes == NULL) || (opndPtr->length == 0)) {
Tcl_AppendResult(interp, "can't use empty string as operand of \"",
operator, "\"", (char *) NULL);
} else {
char *msg = "non-numeric string";
|
| ︙ | ︙ | |||
5373 5374 5375 5376 5377 5378 5379 | * None. * *---------------------------------------------------------------------- */ static char * GetSrcInfoForPc(pc, codePtr, lengthPtr) | | | | | 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 |
* None.
*
*----------------------------------------------------------------------
*/
static char *
GetSrcInfoForPc(pc, codePtr, lengthPtr)
TclVMWord *pc; /* The program counter value for which to
* return the closest command's source info.
* This points to a bytecode instruction
* in codePtr's code. */
ByteCode *codePtr; /* The bytecode sequence in which to look
* up the command source for the pc. */
int *lengthPtr; /* If non-NULL, the location where the
* length of the command's source should be
* stored. If NULL, no length is stored. */
{
register ptrdiff_t pcOffset = (pc - codePtr->codeStart);
int numCmds = codePtr->numCommands;
unsigned char *codeDeltaNext, *codeLengthNext;
unsigned char *srcDeltaNext, *srcLengthNext;
int codeOffset, codeLen, codeEnd, srcOffset, srcLen, delta, i;
int bestDist = INT_MAX; /* Distance of pc to best cmd's start pc. */
int bestSrcOffset = -1; /* Initialized to avoid compiler warning. */
int bestSrcLength = -1; /* Initialized to avoid compiler warning. */
if ((pcOffset < 0) || (pcOffset >= codePtr->numCodeWords)) {
return NULL;
}
/*
* Decode the code and source offset and length for each command. The
* closest enclosing command is the last one whose code started before
* pcOffset.
|
| ︙ | ︙ | |||
5417 5418 5419 5420 5421 5422 5423 |
delta = TclGetInt4AtPtr(codeDeltaNext);
codeDeltaNext += 4;
} else {
delta = TclGetInt1AtPtr(codeDeltaNext);
codeDeltaNext++;
}
codeOffset += delta;
| | | 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 |
delta = TclGetInt4AtPtr(codeDeltaNext);
codeDeltaNext += 4;
} else {
delta = TclGetInt1AtPtr(codeDeltaNext);
codeDeltaNext++;
}
codeOffset += delta;
if ((unsigned int) (*codeLengthNext) == (unsigned int) 0xFF) {
codeLengthNext++;
codeLen = TclGetInt4AtPtr(codeLengthNext);
codeLengthNext += 4;
} else {
codeLen = TclGetInt1AtPtr(codeLengthNext);
codeLengthNext++;
|
| ︙ | ︙ | |||
5458 5459 5460 5461 5462 5463 5464 |
if (dist <= bestDist) {
bestDist = dist;
bestSrcOffset = srcOffset;
bestSrcLength = srcLen;
}
}
}
| > > > | | 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 |
if (dist <= bestDist) {
bestDist = dist;
bestSrcOffset = srcOffset;
bestSrcLength = srcLen;
}
}
}
codeDeltaNext = codePtr->codeDeltaStart;
srcDeltaNext = codePtr->srcDeltaStart;
srcLengthNext = codePtr->srcLengthStart;
if (bestDist == INT_MAX) {
return NULL;
}
if (lengthPtr != NULL) {
*lengthPtr = bestSrcLength;
}
|
| ︙ | ︙ | |||
5495 5496 5497 5498 5499 5500 5501 | * Side effects: * None. * *---------------------------------------------------------------------- */ static ExceptionRange * | | | < < < < | | < < | < | 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 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 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static ExceptionRange *
GetExceptRangeForPc(pc, codePtr)
TclVMWord *pc; /* The program counter value for which to
* search for a closest enclosing exception
* range. This points to a bytecode
* instruction in codePtr's code. */
ByteCode* codePtr; /* Points to the ByteCode in which to search
* for the enclosing ExceptionRange. */
{
ExceptionRange *rangeArrayPtr;
int numRanges = codePtr->numExceptRanges;
register ExceptionRange *rangePtr;
ptrdiff_t pcOffset = (pc - codePtr->codeStart);
register int start;
if (numRanges == 0) {
return NULL;
}
/*
* This exploits peculiarities of our compiler: nested ranges
* are always *after* their containing ranges, so that by scanning
* backwards we are sure that the first matching range is indeed
* the deepest.
*/
rangeArrayPtr = codePtr->exceptArrayPtr;
rangePtr = rangeArrayPtr + numRanges;
while (--rangePtr >= rangeArrayPtr) {
start = rangePtr->codeOffset;
if ((start <= pcOffset) &&
(pcOffset < (start + rangePtr->numCodeWords))) {
return rangePtr;
}
}
return NULL;
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
5560 5561 5562 5563 5564 5565 5566 | * *---------------------------------------------------------------------- */ #ifdef TCL_COMPILE_DEBUG static char * GetOpcodeName(pc) | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 |
*
*----------------------------------------------------------------------
*/
#ifdef TCL_COMPILE_DEBUG
static char *
GetOpcodeName(pc)
TclVMWord *pc; /* Points to the instruction whose name
* should be returned. */
{
int opCode = (int) TclVMGetInstAtPtr(pc);
return tclInstructionTable[opCode].name;
}
#endif /* TCL_COMPILE_DEBUG */
/*
*----------------------------------------------------------------------
*
* TclExprFloatError --
*
* This procedure is called when an error occurs during a
|
| ︙ | ︙ | |||
6889 6890 6891 6892 6893 6894 6895 |
if (w2 < 0) {
return W0;
} else if (w2 == 0) {
return Tcl_LongAsWide(1);
}
} else if (w == -1) {
return (w2 & 1) ? Tcl_LongAsWide(-1) : Tcl_LongAsWide(1);
| | | 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 |
if (w2 < 0) {
return W0;
} else if (w2 == 0) {
return Tcl_LongAsWide(1);
}
} else if (w == -1) {
return (w2 & 1) ? Tcl_LongAsWide(-1) : Tcl_LongAsWide(1);
} else if ((w == 1) || (w2 == 0)) {
return Tcl_LongAsWide(1);
} else if (w>1 && w2<0) {
return W0;
}
/*
* The general case.
|
| ︙ | ︙ | |||
6959 6960 6961 6962 6963 6964 6965 |
if (i2 < 0) {
return 0L;
} else if (i2 == 0) {
return 1L;
}
} else if (i == -1) {
return (i2&1) ? -1L : 1L;
| | | 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 |
if (i2 < 0) {
return 0L;
} else if (i2 == 0) {
return 1L;
}
} else if (i == -1) {
return (i2&1) ? -1L : 1L;
} else if ((i == 1) || (i2 == 0)) {
return 1L;
} else if (i > 1 && i2 < 0) {
return 0L;
}
/*
* The general case
|
| ︙ | ︙ |
Changes to generic/tclFCmd.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclFCmd.c * * This file implements the generic portion of file manipulation * subcommands of the "file" command. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclFCmd.c * * This file implements the generic portion of file manipulation * subcommands of the "file" command. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclFCmd.c,v 1.31.2.1 2005/06/13 01:46:07 msofer Exp $ */ #include "tclInt.h" /* * Declarations for local procedures defined in this file: */ |
| ︙ | ︙ | |||
257 258 259 260 261 262 263 |
if (Tcl_FSStat(target, &statBuf) == 0) {
if (!S_ISDIR(statBuf.st_mode)) {
errno = EEXIST;
errfile = target;
goto done;
}
| | > > > > | > > > > > > > > > > > > > > | | | > > > > > > | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
if (Tcl_FSStat(target, &statBuf) == 0) {
if (!S_ISDIR(statBuf.st_mode)) {
errno = EEXIST;
errfile = target;
goto done;
}
} else if (errno != ENOENT) {
errfile = target;
goto done;
}
if (Tcl_FSCreateDirectory(target) != TCL_OK) {
/*
* Create might have failed because of being in a race
* condition with another process trying to create the
* same subdirectory.
*/
if (errno == EEXIST) {
if ((Tcl_FSStat(target, &statBuf) == 0)
&& S_ISDIR(statBuf.st_mode)) {
/*
* It is a directory that wasn't there before,
* so keep going without error.
*/
Tcl_ResetResult(interp);
} else {
errfile = target;
goto done;
}
} else {
errfile = target;
goto done;
}
}
/* Forget about this sub-path */
Tcl_DecrRefCount(target);
target = NULL;
}
Tcl_DecrRefCount(split);
split = NULL;
}
|
| ︙ | ︙ |
Changes to generic/tclFileName.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclFileName.c -- * * This file contains routines for converting file names betwen * native and network form. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclFileName.c -- * * This file contains routines for converting file names betwen * native and network form. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclFileName.c,v 1.63.2.1 2005/06/13 01:46:07 msofer Exp $ */ #include "tclInt.h" #include "tclRegexp.h" #include "tclFileSystem.h" /* For TclGetPathType() */ /* |
| ︙ | ︙ | |||
156 157 158 159 160 161 162 |
Tcl_DStringAppend(resultPtr, path, 2);
Tcl_DStringAppend(resultPtr, "/", 1);
return tail;
}
} else {
int abs = 0;
| | > > | | | > | > | | > | > | > | > | > | > | | 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 |
Tcl_DStringAppend(resultPtr, path, 2);
Tcl_DStringAppend(resultPtr, "/", 1);
return tail;
}
} else {
int abs = 0;
if ((path[0] == 'c' || path[0] == 'C')
&& (path[1] == 'o' || path[1] == 'O')) {
if ((path[2] == 'm' || path[2] == 'M')
&& path[3] >= '1' && path[3] <= '4') {
/* May have match for 'com[1-4]:?', which is a serial port */
if (path[4] == '\0') {
abs = 4;
} else if (path [4] == ':' && path[5] == '\0') {
abs = 5;
}
} else if ((path[2] == 'n' || path[2] == 'N') && path[3] == '\0') {
/* Have match for 'con' */
abs = 3;
}
} else if ((path[0] == 'l' || path[0] == 'L')
&& (path[1] == 'p' || path[1] == 'P')
&& (path[2] == 't' || path[2] == 'T')) {
if (path[3] >= '1' && path[3] <= '3') {
/* May have match for 'lpt[1-3]:?' */
if (path[4] == '\0') {
abs = 4;
} else if (path [4] == ':' && path[5] == '\0') {
abs = 5;
}
}
} else if ((path[0] == 'p' || path[0] == 'P')
&& (path[1] == 'r' || path[1] == 'R')
&& (path[2] == 'n' || path[2] == 'N')
&& path[3] == '\0') {
/* Have match for 'prn' */
abs = 3;
} else if ((path[0] == 'n' || path[0] == 'N')
&& (path[1] == 'u' || path[1] == 'U')
&& (path[2] == 'l' || path[2] == 'L')
&& path[3] == '\0') {
/* Have match for 'nul' */
abs = 3;
} else if ((path[0] == 'a' || path[0] == 'A')
&& (path[1] == 'u' || path[1] == 'U')
&& (path[2] == 'x' || path[2] == 'X')
&& path[3] == '\0') {
/* Have match for 'aux' */
abs = 3;
}
if (abs != 0) {
*typePtr = TCL_PATH_ABSOLUTE;
Tcl_DStringSetLength(resultPtr, offset);
Tcl_DStringAppend(resultPtr, path, abs);
|
| ︙ | ︙ | |||
2288 2289 2290 2291 2292 2293 2294 |
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, pattern[0]) == NULL) {
/*
* 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
| | | 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 |
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, pattern[0]) == NULL) {
/*
* 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.
*/
int len;
CONST char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
if (strchr(separators, joined[len-1]) == NULL) {
if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) {
|
| ︙ | ︙ |
Changes to generic/tclGet.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclGet.c -- * * This file contains procedures to convert strings into * other forms, like integers or floating-point numbers or * booleans, doing syntax checking along the way. * * Copyright (c) 1990-1993 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | < | | | | | < < < | < < < < < | < < < < < < < < < < | < < < < < < < < < < < | < < | | > | < < | < < < | < | < < < < < < | < < < < < < < < < | | | | | < < < | < < < < | < < < < | < < < < < < < < < < < | < < | | > | < < < < < < | < < < < < < < | < > < | | | | | | | | | | < < < < | | < < < < | < < < < < < | < > < | | | | | > | < < < < < < | < < < < < < < < < < < | | < < | < < < < < < < < < < < < < < < < < | < | | < | | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 |
/*
* tclGet.c --
*
* This file contains procedures to convert strings into
* other forms, like integers or floating-point numbers or
* booleans, doing syntax checking along the way.
*
* Copyright (c) 1990-1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclGet.c,v 1.9.4.1 2005/06/13 01:46:07 msofer Exp $
*/
#include "tclInt.h"
/*
*----------------------------------------------------------------------
*
* Tcl_GetInt --
*
* Given a string, produce the corresponding integer value.
*
* Results:
* The return value is normally TCL_OK; in this case *intPtr
* will be set to the integer value equivalent to src. If
* src is improperly formed then TCL_ERROR is returned and
* an error message will be left in the interp's result.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_GetInt(interp, src, intPtr)
Tcl_Interp *interp; /* Interpreter to use for error reporting. */
CONST char *src; /* String containing a (possibly signed)
* integer in a form acceptable to strtoul. */
int *intPtr; /* Place to store converted result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
obj.bytes = (char *) src;
obj.length = strlen(src);
obj.typePtr = NULL;
code = Tcl_GetIntFromObj(interp, &obj, intPtr);
if (obj.refCount > 1) {
Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
}
return code;
}
/*
*----------------------------------------------------------------------
*
* TclGetLong --
*
* Given a string, produce the corresponding long integer value.
* This routine is a version of Tcl_GetInt but returns a "long"
* instead of an "int".
*
* Results:
* The return value is normally TCL_OK; in this case *longPtr
* will be set to the long integer value equivalent to src. If
* src is improperly formed then TCL_ERROR is returned and
* an error message will be left in the interp's result if interp
* is non-NULL.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclGetLong(interp, src, longPtr)
Tcl_Interp *interp; /* Interpreter used for error reporting
* if not NULL. */
CONST char *src; /* String containing a (possibly signed)
* long integer in a form acceptable to
* strtoul. */
long *longPtr; /* Place to store converted long result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
obj.bytes = (char *) src;
obj.length = strlen(src);
obj.typePtr = NULL;
code = Tcl_GetLongFromObj(interp, &obj, longPtr);
if (obj.refCount > 1) {
Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
}
return code;
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetDouble --
*
* Given a string, produce the corresponding double-precision
* floating-point value.
*
* Results:
* The return value is normally TCL_OK; in this case *doublePtr
* will be set to the double-precision value equivalent to src.
* If src is improperly formed then TCL_ERROR is returned and
* an error message will be left in the interp's result.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_GetDouble(interp, src, doublePtr)
Tcl_Interp *interp; /* Interpreter used for error reporting. */
CONST char *src; /* String containing a floating-point number
* in a form acceptable to strtod. */
double *doublePtr; /* Place to store converted result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
obj.bytes = (char *) src;
obj.length = strlen(src);
obj.typePtr = NULL;
code = Tcl_GetDoubleFromObj(interp, &obj, doublePtr);
if (obj.refCount > 1) {
Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
}
return code;
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetBoolean --
*
* Given a string, return a 0/1 boolean value corresponding
* to the string.
*
* Results:
* The return value is normally TCL_OK; in this case *boolPtr
* will be set to the 0/1 value equivalent to src. If
* src is improperly formed then TCL_ERROR is returned and
* an error message will be left in the interp's result.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_GetBoolean(interp, src, boolPtr)
Tcl_Interp *interp; /* Interpreter used for error reporting. */
CONST char *src; /* String containing a boolean number
* specified either as 1/0 or true/false or
* yes/no. */
int *boolPtr; /* Place to store converted result, which
* will be 0 or 1. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
obj.bytes = (char *) src;
obj.length = strlen(src);
obj.typePtr = NULL;
code = Tcl_ConvertToType(interp, &obj, &tclBooleanType);
if (obj.refCount > 1) {
Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
}
if (code == TCL_OK) {
*boolPtr = obj.internalRep.longValue;
}
return code;
}
|
Changes to generic/tclGetDate.y.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclGetDate.y -- * * Contains yacc grammar for parsing date and time strings. * The output of this file should be the file tclDate.c which * is used directly in the Tcl sources. * * Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans. * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
/*
* tclGetDate.y --
*
* Contains yacc grammar for parsing date and time strings.
* The output of this file should be the file tclDate.c which
* is used directly in the Tcl sources.
*
* Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans.
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclGetDate.y,v 1.26.2.1 2005/06/13 01:46:07 msofer Exp $
*/
%{
/*
* tclDate.c --
*
* This file is generated from a yacc grammar defined in
|
| ︙ | ︙ |
Changes to generic/tclIO.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclIO.c -- * * This file provides the generic portions (those that are the same on * all platforms and for all channel types) of Tcl's IO facilities. * * Copyright (c) 1998-2000 Ajuba Solutions * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclIO.c -- * * This file provides the generic portions (those that are the same on * all platforms and for all channel types) of Tcl's IO facilities. * * Copyright (c) 1998-2000 Ajuba Solutions * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclIO.c,v 1.82.2.1 2005/06/13 01:46:07 msofer Exp $ */ #include "tclInt.h" #include "tclIO.h" #include <assert.h> |
| ︙ | ︙ | |||
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 |
Tcl_Panic("Tcl_CreateChannel: NULL channel name");
}
statePtr->flags = mask;
/*
* Set the channel to system default encoding.
*/
statePtr->encoding = NULL;
name = Tcl_GetEncodingName(NULL);
if (strcmp(name, "binary") != 0) {
statePtr->encoding = Tcl_GetEncoding(NULL, name);
}
| > > > > > > > | 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 |
Tcl_Panic("Tcl_CreateChannel: NULL channel name");
}
statePtr->flags = mask;
/*
* Set the channel to system default encoding.
*
* Note the strange bit of protection taking place here.
* If the system encoding name is reported back as "binary",
* something weird is happening. Tcl provides no "binary"
* encoding, so someone else has provided one. We ignore it
* so as not to interfere with the "magic" interpretation
* that Tcl_Channels give to the "-encoding binary" option.
*/
statePtr->encoding = NULL;
name = Tcl_GetEncodingName(NULL);
if (strcmp(name, "binary") != 0) {
statePtr->encoding = Tcl_GetEncoding(NULL, name);
}
|
| ︙ | ︙ | |||
5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 |
wResult = Tcl_Tell(chan);
return (int)Tcl_WideAsLong(wResult);
}
/*
*---------------------------------------------------------------------------
*
* CheckChannelErrors --
*
* See if the channel is in an ready state and can perform the
* desired operation.
*
* Results:
* The return value is 0 if the channel is OK, otherwise the
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 |
wResult = Tcl_Tell(chan);
return (int)Tcl_WideAsLong(wResult);
}
/*
*---------------------------------------------------------------------------
*
* Tcl_TruncateChannel --
*
* Truncate a channel to the given length.
*
* Results:
* TCL_OK on success, TCL_ERROR if the operation failed (e.g. is
* not supported by the type of channel, or the underlying OS
* operation failed in some way).
*
* Side effects:
* Seeks the channel to the current location. Sets errno on OS
* error.
*
*---------------------------------------------------------------------------
*/
int
Tcl_TruncateChannel(chan, length)
Tcl_Channel chan;
Tcl_WideInt length;
{
Channel *chanPtr = (Channel *) chan;
Tcl_DriverTruncateProc *truncateProc =
Tcl_ChannelTruncateProc(chanPtr->typePtr);
int result;
if (truncateProc == NULL) {
/*
* Feature not supported and it's not emulatable. Pretend it's
* returned an EINVAL, a very generic error!
*/
Tcl_SetErrno(EINVAL);
return TCL_ERROR;
}
if (!(chanPtr->state->flags & TCL_WRITABLE)) {
/*
* We require that the file was opened of writing. Do that
* check now so that we only flush if we think we're going to
* succeed.
*/
Tcl_SetErrno(EINVAL);
return TCL_ERROR;
}
/*
* Seek first to force a total flush of all pending buffers and
* ditch any pre-read input data.
*/
if (Tcl_Seek(chan, 0, SEEK_CUR) == Tcl_LongAsWide(-1)) {
return TCL_ERROR;
}
/*
* We're all flushed to disk now and we also don't have any
* unfortunate input baggage around either; can truncate with
* impunity.
*/
result = truncateProc(chanPtr->instanceData, length);
if (result != 0) {
Tcl_SetErrno(result);
return TCL_ERROR;
}
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* CheckChannelErrors --
*
* See if the channel is in an ready state and can perform the
* desired operation.
*
* Results:
* The return value is 0 if the channel is OK, otherwise the
|
| ︙ | ︙ | |||
6034 6035 6036 6037 6038 6039 6040 | /* *---------------------------------------------------------------------- * * Tcl_SetChannelBufferSize -- * * Sets the size of buffers to allocate to store input or output | | | | | 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 |
/*
*----------------------------------------------------------------------
*
* Tcl_SetChannelBufferSize --
*
* Sets the size of buffers to allocate to store input or output
* in the channel. The size must be between 1 byte and 1 MByte.
*
* Results:
* None.
*
* Side effects:
* Sets the size of buffers subsequently allocated for this channel.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetChannelBufferSize(chan, sz)
Tcl_Channel chan; /* The channel whose buffer size
* to set. */
int sz; /* The size to set. */
{
ChannelState *statePtr; /* State of real channel structure. */
/*
* If the buffer size is smaller than 1 byte or larger than one MByte,
* do not accept the requested size and leave the current buffer size.
*/
if (sz < 1) {
return;
}
if (sz > (1024 * 1024)) {
return;
}
statePtr = ((Channel *) chan)->state;
|
| ︙ | ︙ | |||
8755 8756 8757 8758 8759 8760 8761 |
/*
* Get the channel table that stores the channels registered
* for this interpreter.
*/
hTblPtr = GetChannelTable(interp);
TclNewObj(resultPtr);
| > > > > > > > | > > | 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 |
/*
* Get the channel table that stores the channels registered
* for this interpreter.
*/
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,
Tcl_NewStringObj(pattern, -1)) != TCL_OK)) {
goto error;
}
goto done;
}
for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch);
hPtr != (Tcl_HashEntry *) NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
statePtr = ((Channel *) Tcl_GetHashValue(hPtr))->state;
if (statePtr->topChanPtr == (Channel *) tsdPtr->stdinChannel) {
name = "stdin";
|
| ︙ | ︙ | |||
8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 |
name = statePtr->channelName;
}
if (((pattern == NULL) || Tcl_StringMatch(name, pattern)) &&
(Tcl_ListObjAppendElement(interp, resultPtr,
Tcl_NewStringObj(name, -1)) != TCL_OK)) {
TclDecrRefCount(resultPtr);
return TCL_ERROR;
}
}
Tcl_SetObjResult(interp, resultPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
| > > | 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 |
name = statePtr->channelName;
}
if (((pattern == NULL) || Tcl_StringMatch(name, pattern)) &&
(Tcl_ListObjAppendElement(interp, resultPtr,
Tcl_NewStringObj(name, -1)) != TCL_OK)) {
error:
TclDecrRefCount(resultPtr);
return TCL_ERROR;
}
}
done:
Tcl_SetObjResult(interp, resultPtr);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 |
{
if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_4)) {
return chanTypePtr->threadActionProc;
} else {
return NULL;
}
}
#if 0
/*
* For future debugging work, a simple function to print the flags of
* a channel in semi-readable form.
*/
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 |
{
if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_4)) {
return chanTypePtr->threadActionProc;
} else {
return NULL;
}
}
/*
*----------------------------------------------------------------------
*
* Tcl_ChannelTruncateProc --
*
* TIP #208 (subsection relating to truncation, based on TIP #206).
* Return the Tcl_DriverTruncateProc of the channel type.
*
* Results:
* A pointer to the proc.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
Tcl_DriverTruncateProc *
Tcl_ChannelTruncateProc(chanTypePtr)
Tcl_ChannelType *chanTypePtr; /* Pointer to channel type. */
{
if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_4)) {
return chanTypePtr->truncateProc;
} else {
return NULL;
}
}
#if 0
/*
* For future debugging work, a simple function to print the flags of
* a channel in semi-readable form.
*/
|
| ︙ | ︙ |
Changes to generic/tclIOCmd.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclIOCmd.c -- * * Contains the definitions of most of the Tcl commands relating to IO. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclIOCmd.c -- * * Contains the definitions of most of the Tcl commands relating to IO. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclIOCmd.c,v 1.22.4.1 2005/06/13 01:46:09 msofer Exp $ */ #include "tclInt.h" /* * Callback structure for accept callback in a TCP server. */ |
| ︙ | ︙ | |||
301 302 303 304 305 306 307 |
int toRead; /* How many bytes to read? */
int charactersRead; /* How many characters were read? */
int mode; /* Mode in which channel is opened. */
char *name;
Tcl_Obj *resultPtr;
if ((objc != 2) && (objc != 3)) {
| > > | > < > > > > > | > | 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 |
int toRead; /* How many bytes to read? */
int charactersRead; /* How many characters were read? */
int mode; /* Mode in which channel is opened. */
char *name;
Tcl_Obj *resultPtr;
if ((objc != 2) && (objc != 3)) {
Interp *iPtr;
argerror:
iPtr = (Interp *) interp;
Tcl_WrongNumArgs(interp, 1, objv, "channelId ?numChars?");
/*
* Do not append directly; that makes ensembles using this
* command as a subcommand produce the wrong message.
*/
iPtr->flags |= INTERP_ALTERNATE_WRONG_ARGS;
Tcl_WrongNumArgs(interp, 1, objv, "?-nonewline? channelId");
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
return TCL_ERROR;
}
i = 1;
newline = 0;
if (strcmp(Tcl_GetString(objv[1]), "-nonewline") == 0) {
newline = 1;
|
| ︙ | ︙ | |||
956 957 958 959 960 961 962 |
/*
* Open the file or create a process pipeline.
*/
if (!pipeline) {
chan = Tcl_FSOpenFileChannel(interp, objv[1], modeString, prot);
} else {
| | | > > > | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
/*
* Open the file or create a process pipeline.
*/
if (!pipeline) {
chan = Tcl_FSOpenFileChannel(interp, objv[1], modeString, prot);
} else {
int mode, seekFlag, cmdObjc, binary;
CONST char **cmdArgv;
if (Tcl_SplitList(interp, what+1, &cmdObjc, &cmdArgv) != TCL_OK) {
return TCL_ERROR;
}
mode = TclGetOpenModeEx(interp, modeString, &seekFlag, &binary);
if (mode == -1) {
chan = NULL;
} else {
int flags = TCL_STDERR | TCL_ENFORCE_MODE;
switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) {
case O_RDONLY:
flags |= TCL_STDOUT;
break;
case O_WRONLY:
flags |= TCL_STDIN;
break;
case O_RDWR:
flags |= (TCL_STDIN | TCL_STDOUT);
break;
default:
Tcl_Panic("Tcl_OpenCmd: invalid mode value");
break;
}
chan = Tcl_OpenCommandChannel(interp, cmdObjc, cmdArgv, flags);
if (binary) {
Tcl_SetChannelOption(interp, chan, "-translation", "binary");
}
}
ckfree((char *) cmdArgv);
}
if (chan == (Tcl_Channel) NULL) {
return TCL_ERROR;
}
Tcl_RegisterChannel(interp, chan);
|
| ︙ | ︙ | |||
1531 1532 1533 1534 1535 1536 1537 |
cmdPtr = objv[i+1];
break;
}
}
return TclCopyChannel(interp, inChan, outChan, toRead, cmdPtr);
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
cmdPtr = objv[i+1];
break;
}
}
return TclCopyChannel(interp, inChan, outChan, toRead, cmdPtr);
}
/*
*----------------------------------------------------------------------
*
* Tcl_ChanTruncateObjCmd --
*
* This procedure is invoked to process the "chan truncate" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* Truncates a channel (or rather a file underlying a channel).
*
*----------------------------------------------------------------------
*/
int
TclChanTruncateObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
Tcl_Channel chan;
int mode;
Tcl_WideInt length;
char *chanName;
if ((objc < 2) || (objc > 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId ?length?");
return TCL_ERROR;
}
chanName = TclGetString(objv[1]);
chan = Tcl_GetChannel(interp, chanName, &mode);
if (chan == NULL) {
return TCL_ERROR;
}
if (objc == 3) {
/*
* User is supplying an explicit length.
*/
if (Tcl_GetWideIntFromObj(interp, objv[2], &length) != TCL_OK) {
return TCL_ERROR;
}
if (length < 0) {
Tcl_AppendResult(interp,
"cannot truncate to negative length of file", NULL);
return TCL_ERROR;
}
} else {
/*
* User wants to truncate to the current file position.
*/
length = Tcl_Tell(chan);
if (length == Tcl_WideAsLong(-1)) {
Tcl_AppendResult(interp,
"could not determine current location in \"", chanName,
"\": ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
}
if (Tcl_TruncateChannel(chan, length) != TCL_OK) {
Tcl_AppendResult(interp, "error during truncate on \"", chanName,
"\": ", Tcl_PosixError(interp), (char *) NULL);
return TCL_ERROR;
}
return TCL_OK;
}
|
Changes to generic/tclIOUtil.c.
| ︙ | ︙ | |||
13 14 15 16 17 18 19 | * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclIOUtil.c,v 1.115.2.1 2005/06/13 01:46:09 msofer Exp $ */ #include "tclInt.h" #ifdef __WIN32__ #include "tclWinInt.h" #endif #include "tclFileSystem.h" |
| ︙ | ︙ | |||
1407 1408 1409 1410 1411 1412 1413 1414 1415 | } /* *--------------------------------------------------------------------------- * * TclGetOpenMode -- * * Description: * Computes a POSIX mode mask for opening a file, from a given string, | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > > < | | > > > > | | | > > | > > > > > > | | | > > | > > | > | | | | 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 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 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 |
}
/*
*---------------------------------------------------------------------------
*
* TclGetOpenMode --
*
* Description:
* This routine is an obsolete, limited version of
* TclGetOpenModeEx() below. It exists only to satisfy any
* extensions imprudently using it via Tcl's internal stubs table.
*
* Results:
* Same as TclGetOpenModeEx().
*
* Side effects:
* Same as TclGetOpenModeEx().
*
*---------------------------------------------------------------------------
*/
int
TclGetOpenMode(interp, modeString, seekFlagPtr)
Tcl_Interp *interp; /* Interpreter to use for error
* reporting - may be NULL. */
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 binary = 0;
return TclGetOpenModeEx(interp, modeString, seekFlagPtr, &binary);
}
/*
*---------------------------------------------------------------------------
*
* TclGetOpenModeEx --
*
* Description:
* Computes a POSIX mode mask for opening a file, from a given string,
* and also sets flags to indicate whether the caller should seek to
* EOF after opening the file, and whether the caller should
* configure the channel for binary data.
*
* Results:
* On success, returns mode to pass to "open". If an error occurs, the
* return value is -1 and if interp is not NULL, sets interp's result
* object to an error message.
*
* Side effects:
* Sets the integer referenced by seekFlagPtr to 1 to tell the caller
* to seek to EOF after opening the file, or to 0 otherwise. Sets the
* integer referenced by binaryPtr to 1 to tell the caller to seek to
* configure the channel for binary data, or to 0 otherwise.
*
* Special note:
* This code is based on a prototype implementation contributed
* by Mark Diekhans.
*
*---------------------------------------------------------------------------
*/
int
TclGetOpenModeEx(interp, modeString, seekFlagPtr, binaryPtr)
Tcl_Interp *interp; /* Interpreter to use for error
* reporting - may be NULL. */
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 */
{
int mode, modeArgc, c, i, gotRW;
CONST char **modeArgv, *flag;
#define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR)
/*
* Check for the simpler fopen-like access modes (e.g. "r"). They
* are distinguished from the POSIX access modes by the presence
* of a lower-case first letter.
*/
*seekFlagPtr = 0;
*binaryPtr = 0;
mode = 0;
/*
* Guard against international characters before using byte oriented
* routines.
*/
if (!(modeString[0] & 0x80)
&& islower(UCHAR(modeString[0]))) { /* INTL: ISO only. */
switch (modeString[0]) {
case 'r':
mode = O_RDONLY;
break;
case 'w':
mode = O_WRONLY|O_CREAT|O_TRUNC;
break;
case 'a':
mode = O_WRONLY|O_CREAT;
*seekFlagPtr = 1;
break;
default:
error:
*seekFlagPtr = 0;
*binaryPtr = 0;
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp,
"illegal access mode \"", modeString, "\"",
(char *) NULL);
}
return -1;
}
i=1;
while (i<3 && modeString[i]) {
if (modeString[i] == modeString[i-1]) {
goto error;
}
switch (modeString[i++]) {
case '+':
mode &= ~(O_RDONLY|O_WRONLY);
mode |= O_RDWR;
break;
case 'b':
*binaryPtr = 1;
break;
default:
goto error;
}
}
if (modeString[i] != 0) {
goto error;
}
return mode;
}
/*
* The access modes are specified using a list of POSIX modes
* such as O_CREAT.
*
* IMPORTANT NOTE: We rely on Tcl_SplitList working correctly when
* a NULL interpreter is passed in.
*/
if (Tcl_SplitList(interp, modeString, &modeArgc, &modeArgv) != TCL_OK) {
if (interp != (Tcl_Interp *) NULL) {
Tcl_AddErrorInfo(interp,
"\n while processing open access modes \"");
Tcl_AddErrorInfo(interp, modeString);
Tcl_AddErrorInfo(interp, "\"");
}
return -1;
}
gotRW = 0;
for (i = 0; i < modeArgc; i++) {
|
| ︙ | ︙ | |||
1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 |
"\" not supported by this system", (char *) NULL);
}
ckfree((char *) modeArgv);
return -1;
#endif
} else if ((c == 'T') && (strcmp(flag, "TRUNC") == 0)) {
mode |= O_TRUNC;
} else {
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "invalid access mode \"", flag,
| > > | | > | 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 |
"\" not supported by this system", (char *) NULL);
}
ckfree((char *) modeArgv);
return -1;
#endif
} else if ((c == 'T') && (strcmp(flag, "TRUNC") == 0)) {
mode |= O_TRUNC;
} else if ((c == 'B') && (strcmp(flag, "BINARY") == 0)) {
*binaryPtr = 1;
} else {
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "invalid access mode \"", flag,
"\": must be RDONLY, WRONLY, RDWR, APPEND, BINARY, "
"CREAT, EXCL, NOCTTY, NONBLOCK, or TRUNC",
(char *) NULL);
}
ckfree((char *) modeArgv);
return -1;
}
}
ckfree((char *) modeArgv);
if (!gotRW) {
|
| ︙ | ︙ | |||
2082 2083 2084 2085 2086 2087 2088 |
return NULL;
}
fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSOpenFileChannelProc *proc = fsPtr->openFileChannelProc;
if (proc != NULL) {
| | | > > > > | 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 |
return NULL;
}
fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSOpenFileChannelProc *proc = fsPtr->openFileChannelProc;
if (proc != NULL) {
int mode, seekFlag, binary;
mode = TclGetOpenModeEx(interp, modeString, &seekFlag, &binary);
if (mode == -1) {
return NULL;
}
retVal = (*proc)(interp, pathPtr, mode, permissions);
if (retVal != NULL) {
if (seekFlag) {
if (Tcl_Seek(retVal, (Tcl_WideInt)0,
SEEK_END) < (Tcl_WideInt)0) {
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp,
"could not seek to end of file while opening \"",
Tcl_GetString(pathPtr), "\": ",
Tcl_PosixError(interp), (char *) NULL);
}
Tcl_Close(NULL, retVal);
return NULL;
}
}
if (binary) {
Tcl_SetChannelOption(interp, retVal,
"-translation", "binary");
}
}
return retVal;
}
}
/* File doesn't belong to any filesystem that can open it */
Tcl_SetErrno(ENOENT);
if (interp != NULL) {
|
| ︙ | ︙ | |||
2982 2983 2984 2985 2986 2987 2988 |
if (symbols[i] != NULL) {
*procPtrs[i] = TclpFindSymbol(interp, *handlePtr,
symbols[i]);
}
}
/* Copy this across, since both are equal for the native fs */
*clientDataPtr = (ClientData)*handlePtr;
| > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | | 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 |
if (symbols[i] != NULL) {
*procPtrs[i] = TclpFindSymbol(interp, *handlePtr,
symbols[i]);
}
}
/* Copy this across, since both are equal for the native fs */
*clientDataPtr = (ClientData)*handlePtr;
Tcl_ResetResult(interp);
return TCL_OK;
}
if (Tcl_GetErrno() != EXDEV) {
return retVal;
}
}
/*
* The filesystem doesn't support 'load', so we fall back on
* the following technique:
*/
/* First check if it is readable -- and exists! */
if (Tcl_FSAccess(pathPtr, R_OK) != 0) {
Tcl_AppendResult(interp, "couldn't load library \"",
Tcl_GetString(pathPtr), "\": ",
Tcl_PosixError(interp), (char *) NULL);
return TCL_ERROR;
}
#ifdef TCL_LOAD_FROM_MEMORY
/*
* The platform supports loading code from memory, so ask for a
* buffer of the appropriate size, read the file into it and
* load the code from the buffer:
*/
do {
int ret, size;
void *buffer;
Tcl_StatBuf statBuf;
Tcl_Channel data;
ret = Tcl_FSStat(pathPtr, &statBuf);
if (ret < 0) {
break;
}
size = (int) statBuf.st_size;
/* Tcl_Read takes an int: check that file size isn't wide */
if (size != (Tcl_WideInt)statBuf.st_size) {
break;
}
data = Tcl_FSOpenFileChannel(interp, pathPtr, "r", 0666);
if (!data) {
break;
}
buffer = TclpLoadMemoryGetBuffer(interp, size);
if (!buffer) {
Tcl_Close(interp, data);
break;
}
Tcl_SetChannelOption(interp, data, "-translation", "binary");
ret = Tcl_Read(data, buffer, size);
Tcl_Close(interp, data);
ret = TclpLoadMemory(interp, buffer, size, ret, handlePtr, unloadProcPtr);
if (ret == TCL_OK) {
int i;
if (*handlePtr == NULL) {
break;
}
for (i = 0;i < symc;i++) {
if (symbols[i] != NULL) {
*procPtrs[i] = TclpFindSymbol(interp, *handlePtr,
symbols[i]);
}
}
*clientDataPtr = (ClientData)*handlePtr;
return TCL_OK;
}
} while (0);
Tcl_ResetResult(interp);
#endif
/*
* Get a temporary filename to use, first to
* copy the file into, and then to load.
*/
copyToPtr = TclpTempFileName();
if (copyToPtr == NULL) {
Tcl_AppendResult(interp, "couldn't create temporary file: ",
Tcl_PosixError(interp), (char *) NULL);
return TCL_ERROR;
}
Tcl_IncrRefCount(copyToPtr);
copyFsPtr = Tcl_FSGetFileSystemForPath(copyToPtr);
if ((copyFsPtr == NULL) || (copyFsPtr == fsPtr)) {
/*
* We already know we can't use Tcl_FSLoadFile from
* this filesystem, 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_AppendResult(interp, "couldn't load from current filesystem",
(char *) NULL);
return TCL_ERROR;
}
if (TclCrossFilesystemCopy(interp, pathPtr, copyToPtr) == TCL_OK) {
Tcl_LoadHandle newLoadHandle = NULL;
ClientData newClientData = NULL;
Tcl_FSUnloadFileProc *newUnloadProcPtr = NULL;
FsDivertLoad *tvdlPtr;
|
| ︙ | ︙ | |||
3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 | * by 'load' will store the original (vfs) * path alongside the temporary load handle * and unload proc ptr. */ (*handlePtr) = newLoadHandle; (*clientDataPtr) = newClientData; (*unloadProcPtr) = newUnloadProcPtr; return TCL_OK; } /* * When we unload this file, we need to divert the * unloading so we can unload and cleanup the * temporary file correctly. */ | > | 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 | * by 'load' will store the original (vfs) * path alongside the temporary load handle * and unload proc ptr. */ (*handlePtr) = newLoadHandle; (*clientDataPtr) = newClientData; (*unloadProcPtr) = newUnloadProcPtr; Tcl_ResetResult(interp); return TCL_OK; } /* * When we unload this file, we need to divert the * unloading so we can unload and cleanup the * temporary file correctly. */ |
| ︙ | ︙ | |||
3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 |
Tcl_DecrRefCount(copyToPtr);
}
copyToPtr = NULL;
(*handlePtr) = newLoadHandle;
(*clientDataPtr) = (ClientData)tvdlPtr;
(*unloadProcPtr) = &FSUnloadTempFile;
return retVal;
} else {
/* Cross-platform copy failed */
Tcl_FSDeleteFile(copyToPtr);
Tcl_DecrRefCount(copyToPtr);
return TCL_ERROR;
}
}
Tcl_SetErrno(ENOENT);
| > | | 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 |
Tcl_DecrRefCount(copyToPtr);
}
copyToPtr = NULL;
(*handlePtr) = newLoadHandle;
(*clientDataPtr) = (ClientData)tvdlPtr;
(*unloadProcPtr) = &FSUnloadTempFile;
Tcl_ResetResult(interp);
return retVal;
} else {
/* Cross-platform copy failed */
Tcl_FSDeleteFile(copyToPtr);
Tcl_DecrRefCount(copyToPtr);
return TCL_ERROR;
}
}
Tcl_SetErrno(ENOENT);
return TCL_ERROR;
}
/*
* This function used to be in the platform specific directories, but it
* has now been made to work cross-platform
*/
int
TclpLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
|
| ︙ | ︙ |
Changes to generic/tclIndexObj.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclIndexObj.c -- * * This file implements objects of type "index". This object type * is used to lookup a keyword in a table of valid values and cache * the index of the matching entry. * * Copyright (c) 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
/*
* tclIndexObj.c --
*
* This file implements objects of type "index". This object type
* is used to lookup a keyword in a table of valid values and cache
* the index of the matching entry.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclIndexObj.c,v 1.22.4.1 2005/06/13 01:46:09 msofer Exp $
*/
#include "tclInt.h"
/*
* Prototypes for procedures defined later in this file:
*/
static int SetIndexFromAny _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
static void UpdateStringOfIndex _ANSI_ARGS_((Tcl_Obj *objPtr));
static void DupIndex _ANSI_ARGS_((Tcl_Obj *srcPtr,
Tcl_Obj *dupPtr));
static void FreeIndex _ANSI_ARGS_((Tcl_Obj *objPtr));
/*
* The structure below defines the index Tcl object type by means of
* procedures that can be invoked by generic object code.
*/
static Tcl_ObjType indexType = {
"index", /* name */
FreeIndex, /* freeIntRepProc */
DupIndex, /* dupIntRepProc */
UpdateStringOfIndex, /* updateStringProc */
SetIndexFromAny /* setFromAnyProc */
};
|
| ︙ | ︙ | |||
106 107 108 109 110 111 112 |
/*
* See if there is a valid cached result from a previous lookup
* (doing the check here saves the overhead of calling
* Tcl_GetIndexFromObjStruct in the common case where the result
* is cached).
*/
| | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
/*
* See if there is a valid cached result from a previous lookup
* (doing the check here saves the overhead of calling
* Tcl_GetIndexFromObjStruct in the common case where the result
* is cached).
*/
if (objPtr->typePtr == &indexType) {
IndexRep *indexRep = (IndexRep *) objPtr->internalRep.otherValuePtr;
/*
* Here's hoping we don't get hit by unfortunate packing
* constraints on odd platforms like a Cray PVP...
*/
if (indexRep->tablePtr == (VOID *)tablePtr &&
indexRep->offset == sizeof(char *)) {
|
| ︙ | ︙ | |||
177 178 179 180 181 182 183 |
Tcl_Obj *resultPtr;
IndexRep *indexRep;
/*
* See if there is a valid cached result from a previous lookup.
*/
| | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
Tcl_Obj *resultPtr;
IndexRep *indexRep;
/*
* See if there is a valid cached result from a previous lookup.
*/
if (objPtr->typePtr == &indexType) {
indexRep = (IndexRep *) objPtr->internalRep.otherValuePtr;
if (indexRep->tablePtr==tablePtr && indexRep->offset==offset) {
*indexPtr = indexRep->index;
return TCL_OK;
}
}
|
| ︙ | ︙ | |||
242 243 244 245 246 247 248 |
done:
/*
* Cache the found representation. Note that we want to avoid
* allocating a new internal-rep if at all possible since that is
* potentially a slow operation.
*/
| | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
done:
/*
* Cache the found representation. Note that we want to avoid
* allocating a new internal-rep if at all possible since that is
* potentially a slow operation.
*/
if (objPtr->typePtr == &indexType) {
indexRep = (IndexRep *) objPtr->internalRep.otherValuePtr;
} else {
TclFreeIntRep(objPtr);
indexRep = (IndexRep *) ckalloc(sizeof(IndexRep));
objPtr->internalRep.otherValuePtr = (VOID *) indexRep;
objPtr->typePtr = &indexType;
}
indexRep->tablePtr = (VOID*) tablePtr;
indexRep->offset = offset;
indexRep->index = index;
*indexPtr = index;
return TCL_OK;
|
| ︙ | ︙ | |||
377 378 379 380 381 382 383 |
Tcl_Obj *srcPtr, *dupPtr;
{
IndexRep *srcIndexRep = (IndexRep *) srcPtr->internalRep.otherValuePtr;
IndexRep *dupIndexRep = (IndexRep *) ckalloc(sizeof(IndexRep));
memcpy(dupIndexRep, srcIndexRep, sizeof(IndexRep));
dupPtr->internalRep.otherValuePtr = (VOID *) dupIndexRep;
| | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
Tcl_Obj *srcPtr, *dupPtr;
{
IndexRep *srcIndexRep = (IndexRep *) srcPtr->internalRep.otherValuePtr;
IndexRep *dupIndexRep = (IndexRep *) ckalloc(sizeof(IndexRep));
memcpy(dupIndexRep, srcIndexRep, sizeof(IndexRep));
dupPtr->internalRep.otherValuePtr = (VOID *) dupIndexRep;
dupPtr->typePtr = &indexType;
}
/*
*----------------------------------------------------------------------
*
* FreeIndex --
*
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 |
* [Bug 1066837] */
#define MAY_QUOTE_WORD (!isFirst)
#else /* !AVOID_HACKS_FOR_ITCL */
#define MAY_QUOTE_WORD 1
#endif /* AVOID_HACKS_FOR_ITCL */
TclNewObj(objPtr);
| > > > > | > | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
* [Bug 1066837] */
#define MAY_QUOTE_WORD (!isFirst)
#else /* !AVOID_HACKS_FOR_ITCL */
#define MAY_QUOTE_WORD 1
#endif /* AVOID_HACKS_FOR_ITCL */
TclNewObj(objPtr);
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
Tcl_AppendObjToObj(objPtr, Tcl_GetObjResult(interp));
Tcl_AppendToObj(objPtr, " or \"", -1);
} else {
Tcl_AppendToObj(objPtr, "wrong # args: should be \"", -1);
}
/*
* Check to see if we are processing an ensemble implementation,
* and if so rewrite the results in terms of how the ensemble was
* invoked.
*/
|
| ︙ | ︙ | |||
525 526 527 528 529 530 531 |
for (i = 0; i < objc; i++) {
/*
* If the object is an index type use the index table which allows
* for the correct error message even if the subcommand was
* abbreviated. Otherwise, just use the string rep.
*/
| | | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 |
for (i = 0; i < objc; i++) {
/*
* If the object is an index type use the index table which allows
* for the correct error message even if the subcommand was
* abbreviated. Otherwise, just use the string rep.
*/
if (objv[i]->typePtr == &indexType) {
indexRep = (IndexRep *) objv[i]->internalRep.otherValuePtr;
Tcl_AppendStringsToObj(objPtr, EXPAND_OF(indexRep), (char *) NULL);
} else {
/*
* Quote the argument if it contains spaces (Bug 942757).
*/
|
| ︙ | ︙ |
Changes to generic/tclInt.decls.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: tclInt.decls,v 1.85.2.2 2005/06/13 01:46:10 msofer Exp $ library tcl # Define the unsupported generic interfaces. interface tclInt |
| ︙ | ︙ | |||
730 731 732 733 734 735 736 737 |
declare 178 generic {
void Tcl_SetStartupScript(Tcl_Obj *pathPtr, CONST char* encodingName)
}
declare 179 generic {
Tcl_Obj *Tcl_GetStartupScript(CONST char **encodingNamePtr)
}
# Allocate lists without copying arrays
| > | | < > | | | < > | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 |
declare 178 generic {
void Tcl_SetStartupScript(Tcl_Obj *pathPtr, CONST char* encodingName)
}
declare 179 generic {
Tcl_Obj *Tcl_GetStartupScript(CONST char **encodingNamePtr)
}
# REMOVED
# Allocate lists without copying arrays
# declare 180 generic {
# Tcl_Obj *TclNewListObjDirect(int objc, Tcl_Obj **objv)
# }
#declare 181 generic {
# Tcl_Obj *TclDbNewListObjDirect(int objc, Tcl_Obj **objv,
# CONST char *file, int line)
#}
# TclpGmtime and TclpLocaltime promoted to the generic interface from unix
declare 182 generic {
struct tm *TclpLocaltime(CONST time_t *clock)
}
declare 183 generic {
|
| ︙ | ︙ | |||
802 803 804 805 806 807 808 |
}
declare 198 generic {
int TclObjGetFrame(Tcl_Interp *interp, Tcl_Obj *objPtr,
CallFrame **framePtrPtr)
}
| | | < > | 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
}
declare 198 generic {
int TclObjGetFrame(Tcl_Interp *interp, Tcl_Obj *objPtr,
CallFrame **framePtrPtr)
}
#declare 199 generic {
# int TclMatchIsTrivial(CONST char *pattern)
#}
# 200-208 exported for use by the test suite [Bug 1054748]
declare 200 generic {
int TclpObjRemoveDirectory (Tcl_Obj *pathPtr, int recursive,
Tcl_Obj **errorPtr)
}
declare 201 generic {
|
| ︙ | ︙ | |||
869 870 871 872 873 874 875 876 877 878 879 880 881 882 |
int TclPushStackFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr,
Tcl_Namespace *namespacePtr, int isProcCallFrame )
}
declare 218 generic {
void TclPopStackFrame(Tcl_Interp *interp)
}
##############################################################################
# Define the platform specific internal Tcl interface. These functions are
# only available on the designated platform.
interface tclIntPlat
| > > > > > > > > > > > > > > > > > > > > > | 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 |
int TclPushStackFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr,
Tcl_Namespace *namespacePtr, int isProcCallFrame )
}
declare 218 generic {
void TclPopStackFrame(Tcl_Interp *interp)
}
# Entries in tommath needed only by tcltest
declare 219 generic {
int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d)
}
declare 220 generic {
int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *c)
}
declare 221 generic {
void TclBN_mp_clear(mp_int *a)
}
declare 222 generic {
int TclBN_mp_init(mp_int *a)
}
declare 223 generic {
int TclBN_mp_read_radix(mp_int *a, const char *str, int radix)
}
# for use in tclTest.c
declare 224 generic {
TclPlatformType *TclGetPlatform(void)
}
##############################################################################
# Define the platform specific internal Tcl interface. These functions are
# only available on the designated platform.
interface tclIntPlat
|
| ︙ | ︙ | |||
971 972 973 974 975 976 977 |
}
declare 23 win {
char *TclpGetTZName(int isdst)
}
declare 24 win {
char *TclWinNoBackslash(char *path)
}
| > | | < > | 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 |
}
declare 23 win {
char *TclpGetTZName(int isdst)
}
declare 24 win {
char *TclWinNoBackslash(char *path)
}
# replaced by generic TclGetPlatform
#declare 25 win {
# TclPlatformType *TclWinGetPlatform(void)
#}
declare 26 win {
void TclWinSetInterfaces(int wide)
}
# Added in Tcl 8.3.3 / 8.4
declare 27 win {
|
| ︙ | ︙ |
Changes to generic/tclInt.h.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 1998-19/99 by Scriptics Corporation. * Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 1998-19/99 by Scriptics Corporation. * Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclInt.h,v 1.214.2.11 2005/10/09 13:56:36 msofer Exp $ */ #ifndef _TCLINT #define _TCLINT /* * Common include files needed by most of the Tcl source files are |
| ︙ | ︙ | |||
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | /* *---------------------------------------------------------------- * Data structures related to namespaces. *---------------------------------------------------------------- */ typedef struct Tcl_Ensemble Tcl_Ensemble; /* * The structure below defines a namespace. * Note: the first five fields must match exactly the fields in a * Tcl_Namespace structure (see tcl.h). If you change one, be sure to * change the other. */ | > > > > > > > > > > > > > > > > > > > | 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 |
/*
*----------------------------------------------------------------
* Data structures related to namespaces.
*----------------------------------------------------------------
*/
typedef struct Tcl_Ensemble Tcl_Ensemble;
typedef struct NamespacePathEntry NamespacePathEntry;
/*
* The hash tables that store the namespace variables have an extra field for
* nsPtr so that we can recover the namespace from its hash table. This is
* used to avoid having to store an nsPtr in every variable. Note that all
* fields (with the exception of the last) must correspond exactly to the
* fields of Tcl_HashTable in tcl.h. Instead of copying the Tcl_HashTable
* struct from tcl.h (and introducing a possible source of future problems if
* they ever get out of sync), we chose to define it in a manner that requires
* a cast to Tcl_HashTable type before each usage.
*/
typedef struct TclNSVarHashTable {
Tcl_HashTable hashTable;
struct Namespace *nsPtr; /* Points to the namespace that uses
* this table to store variables. */
} TclNSVarHashTable;
/*
* The structure below defines a namespace.
* Note: the first five fields must match exactly the fields in a
* Tcl_Namespace structure (see tcl.h). If you change one, be sure to
* change the other.
*/
|
| ︙ | ︙ | |||
175 176 177 178 179 180 181 | * registered in the namespace. Indexed by * strings; values have type (Command *). * Commands imported by Tcl_Import have * Command structures that point (via an * ImportedCmdRef structure) to the * Command structure in the source * namespace's command table. */ | | | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
* registered in the namespace. Indexed by
* strings; values have type (Command *).
* Commands imported by Tcl_Import have
* Command structures that point (via an
* ImportedCmdRef structure) to the
* Command structure in the source
* namespace's command table. */
TclNSVarHashTable varTable; /* Contains all the (global) variables
* currently in this namespace. Indexed
* by strings; values have type (Var *). */
char **exportArrayPtr; /* Points to an array of string patterns
* specifying which commands are exported.
* A pattern may include "string match"
* style wildcard characters to specify
* multiple commands; however, no namespace
|
| ︙ | ︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
* a namespace, removed from a namespace or
* the exports of a namespace are changed.
* Allows TIP#112-driven command lists to be
* validated efficiently. */
Tcl_Ensemble *ensembles; /* List of structures that contain the details
* of the ensembles that are implemented on
* top of this namespace. */
} Namespace;
/*
* Flags used to represent the status of a namespace:
*
* NS_DYING - 1 means Tcl_DeleteNamespace has been called to delete the
* namespace but there are still active call frames on the Tcl
* stack that refer to the namespace. When the last call frame
| > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
* a namespace, removed from a namespace or
* the exports of a namespace are changed.
* Allows TIP#112-driven command lists to be
* validated efficiently. */
Tcl_Ensemble *ensembles; /* List of structures that contain the details
* of the ensembles that are implemented on
* top of this namespace. */
int commandPathLength; /* The length of the explicit path. */
NamespacePathEntry *commandPathArray;
/* The explicit path of the namespace as an
* array. */
NamespacePathEntry *commandPathSourceList;
/* Linked list of path entries that point to
* this namespace. */
} Namespace;
/*
* An entry on a namespace's command resolution path.
*/
struct NamespacePathEntry {
Namespace *nsPtr; /* What does this path entry point to? If it
*is NULL, this path entry points is redundant
* and should be skipped. */
Namespace *creatorNsPtr; /* Where does this path entry point from? This
* allows for efficient invalidation of
* references when the path entry's target
* updates its current list of defined
* commands. */
NamespacePathEntry *prevPtr, *nextPtr;
/* Linked list pointers or NULL at either end
* of the list that hangs off Namespace's
* commandPathSourceList field. */
};
/*
* Flags used to represent the status of a namespace:
*
* NS_DYING - 1 means Tcl_DeleteNamespace has been called to delete the
* namespace but there are still active call frames on the Tcl
* stack that refer to the namespace. When the last call frame
|
| ︙ | ︙ | |||
377 378 379 380 381 382 383 |
* to get value to return. */
struct ArraySearch *nextPtr;/* Next in list of all active searches
* for this variable, or NULL if this is
* the last one. */
} ArraySearch;
/*
| | > > > > > > > > | < < < < < < < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | > | > > > < < < < < < < < < < < < < > > > > | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 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 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 |
* to get value to return. */
struct ArraySearch *nextPtr;/* Next in list of all active searches
* for this variable, or NULL if this is
* the last one. */
} ArraySearch;
/*
* The structures below defines a variable, which associates a string name
* with a Tcl_Obj value. These structures are kept in procedure call frames
* (for local variables recognized by the compiler) or in the heap (for
* global variables and any variable not known to the compiler). For each
* Var structure in the heap, a hash table entry holds the variable name and
* a pointer to the Var structure.
*
* NOTE: the quantity and type of the elements of Var have been designed to
* allow the use of a Tcl_Obj to store a variable - so that we can profit from
* the optimised allocator for Tcl_Objs. Any change to this will require
* changing the memory management in tclVar.c - especially in NewVar and
* CleanupVar.
*/
typedef struct Var {
int flags; /* Miscellaneous bits of information about
* variable. See below for definitions. */
union {
Tcl_Obj *objPtr; /* The variable's object value. Used for
* scalar variables and array elements. */
Tcl_HashTable *tablePtr;/* For array variables, this points to
* information about the hash table used
* to implement the associative array.
* Points to malloc-ed data. */
struct Var *linkPtr; /* If this is a global variable being
* referred to in a procedure, or a variable
* created by "upvar", this field points to
* the referenced variable's Var struct. */
} value;
union {
Tcl_HashEntry *hPtr; /* If variable is in a hashtable, either the
* hash table entry that refers to this
* variable or NULL if the variable has been
* detached from its hash table (e.g. an
* array is deleted, but some of its
* elements are still referred to in
* upvars). NULL if the variable is not in a
* hashtable. This is used to delete an
* variable from its hashtable if it is no
* longer needed. */
struct Var *shortPtr; /* Used for extensions, to point to the
* original short variable. */
} id;
int refCount; /* Counts number of active uses of this
* variable, not including its entry in the
* call frame or the hash table: 1 for each
* additional variable whose linkPtr points
* here, 1 for each nested trace active on
* variable, and 1 if the variable is a
* namespace variable. This record can't be
* deleted until refCount becomes 0. */
VarTrace *tracePtr; /* First in list of all traces set for this
* variable. */
ArraySearch *searchPtr; /* First in list of all searches active
* for this variable, or NULL if none. */
} Var;
/*
* The struct ShortVar is only used within the compiler/TEBC: compiledlocal
* variables are defined with the minimal required fields, and will be linked
* to full Var structs whenever the variable is traced or searched. The link
* remains valid until the corresponding function returns, even if the traces
* are removed or the search is finished.
* The definition of ShortVar must coincide exactly with the beginning of Var.
*/
typedef struct ShortVar {
int flags; /* Miscellaneous bits of information about
* variable. See below for definitions. */
union {
Tcl_Obj *objPtr; /* The variable's object value. Used for
* scalar variables and array elements. */
Tcl_HashTable *tablePtr;/* For array variables, this points to
* information about the hash table used
* to implement the associative array.
* Points to malloc-ed data. */
struct Var *linkPtr; /* If this is a global variable being
* referred to in a procedure, or a variable
* created by "upvar", this field points to
* the referenced variable's Var struct. */
} value;
} ShortVar;
/*
* Flag bits for variables. The first two (VAR_ARRAY and VAR_LINK) are
* mutually exclusive and give the "type" of the variable; a scalar is
* neither an array nor a link.
* A variable with a NULL value is undefined: this means that the variable is
* in the process of being deleted. An undefined variable logically does not
* exist and survives only while it has a trace, or if it is a global variable
* currently being used by some procedure.
*
* VAR_LINK - 1 means this Var structure contains a
* pointer to another Var structure that
* either has the real value or is itself
* another VAR_LINK pointer. Variables like
* this come about through "upvar" and "global"
* commands, or through references to variables
* in enclosing namespaces.
* VAR_IN_HASHTABLE - 1 means this variable is in a hashtable and
* the Var structure is malloced. 0 if it is
* a local variable that was assigned a slot
* in a procedure frame by the compiler so the
* Var storage is part of the call frame.
* VAR_SHORT 1 indicates that this is a ShortVar struct, 0
* that it is a full Var struct with all fields.
* VAR_EXTENSION 1 indicates that this is an extension to a
* short var.
* VAR_TRACE_ACTIVE - 1 means that trace processing is currently
* underway for a read or write access, so
* new read or write accesses should not cause
* trace procedures to be called and the
* variable can't be deleted.
* VAR_ARRAY_ELEMENT - 1 means that this variable is an array
* element, so it is not legal for it to be
|
| ︙ | ︙ | |||
492 493 494 495 496 497 498 499 500 | * VAR_ARGUMENT - 1 means that this variable holds a procedure * argument. * VAR_TEMPORARY - 1 if the local variable is an anonymous * temporary variable. Temporaries have a NULL * name. * VAR_RESOLVED - 1 if name resolution has been done for this * variable. */ | > > > > > > > > > > > > > > > > > < | > > > > > > > > > > | | > | > < | < | | 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 640 641 642 643 |
* VAR_ARGUMENT - 1 means that this variable holds a procedure
* argument.
* VAR_TEMPORARY - 1 if the local variable is an anonymous
* temporary variable. Temporaries have a NULL
* name.
* VAR_RESOLVED - 1 if name resolution has been done for this
* variable.
*
* The following additional flags are used to speed up variable access by
* the bytecode engine. The information contained is already present in the
* other flag values and/or the fields of the Var structure. There is special
* code to maintain these flag values in synch with the rest.
*
* VAR_DIRECT_READABLE 1 means that TEBC can read this variable
* directly:
* - VAR_SCALAR is set
* - VAR_UNDEFINED is not set
* - tracePtr is NULL.
* VAR_DIRECT_WRITABLE 1 means that TEBC can write this variable
* directly:
* - one of {VAR_SCALAR,VAR_UNDEFINED} is set
* - tracePtr is NULL
* - VAR_IN_HASHTABLE is not set, or else hPtr
* is not NULL.
*/
#define VAR_ARRAY 0x2
#define VAR_LINK 0x4
#define VAR_IN_HASHTABLE 0x10
#define VAR_TRACE_ACTIVE 0x20
#define VAR_ARRAY_ELEMENT 0x40
#define VAR_NAMESPACE_VAR 0x80
#define VAR_ARGUMENT 0x100
#define VAR_TEMPORARY 0x200
#define VAR_RESOLVED 0x400
#define VAR_IS_ARGS 0x800
#define VAR_SHORT 0x1000
#define VAR_EXTENSION 0x2000
#define VAR_DIRECT_READABLE 0x4000
#define VAR_DIRECT_WRITABLE 0x8000
/*
* Macros to ensure that various flag bits are set properly for variables.
* The ANSI C "prototypes" for these macros are:
*
* MODULE_SCOPE void TclSetVarScalar _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE void TclSetVarArray _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE void TclSetVarLink _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE void TclSetVarArrayElement _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE void TclSetVarUndefined _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE void TclClearVarUndefined _ANSI_ARGS_((Var *varPtr));
*/
#define TclSetVarDirectScalar(varPtr) \
(varPtr)->flags = ((varPtr->flags) & ~(VAR_ARRAY|VAR_LINK)) \
| (VAR_DIRECT_WRITABLE|VAR_DIRECT_READABLE)
#define TclSetVarScalar(varPtr) \
(varPtr)->flags &= ~(VAR_ARRAY|VAR_LINK)
#define TclSetVarArray(varPtr) \
(varPtr)->flags = ((varPtr)->flags | VAR_ARRAY) \
& ~(VAR_LINK|VAR_DIRECT_WRITABLE|VAR_DIRECT_READABLE)
#define TclSetVarLink(varPtr) \
(varPtr)->flags = ((varPtr)->flags | VAR_LINK)\
& ~(VAR_ARRAY|VAR_DIRECT_WRITABLE|VAR_DIRECT_READABLE)
#define TclSetVarArrayElement(varPtr) \
(varPtr)->flags = ((varPtr)->flags & ~VAR_ARRAY) | VAR_ARRAY_ELEMENT
#define TclSetVarUndefined(varPtr) \
(varPtr)->value.objPtr = NULL; \
(varPtr)->flags &= ~(VAR_ARRAY|VAR_LINK|VAR_DIRECT_READABLE)
#define TclSetVarTraceActive(varPtr) \
(varPtr)->flags |= VAR_TRACE_ACTIVE
#define TclClearVarTraceActive(varPtr) \
(varPtr)->flags &= ~VAR_TRACE_ACTIVE
|
| ︙ | ︙ | |||
565 566 567 568 569 570 571 |
* MODULE_SCOPE int TclIsVarArrayElement _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE int TclIsVarTemporary _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE int TclIsVarArgument _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE int TclIsVarResolved _ANSI_ARGS_((Var *varPtr));
*/
#define TclIsVarScalar(varPtr) \
| | | > > > | > > > | > > > | < < | < < < < | 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 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 |
* MODULE_SCOPE int TclIsVarArrayElement _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE int TclIsVarTemporary _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE int TclIsVarArgument _ANSI_ARGS_((Var *varPtr));
* MODULE_SCOPE int TclIsVarResolved _ANSI_ARGS_((Var *varPtr));
*/
#define TclIsVarScalar(varPtr) \
!((varPtr)->flags & (VAR_ARRAY|VAR_LINK))
#define TclIsVarLink(varPtr) \
((varPtr)->flags & VAR_LINK)
#define TclIsVarArray(varPtr) \
((varPtr)->flags & VAR_ARRAY)
#define TclIsVarShort(varPtr) \
((varPtr)->flags & VAR_SHORT)
#define TclIsVarExtension(varPtr) \
((varPtr)->flags & VAR_EXTENSION)
#define TclIsVarUndefined(varPtr) \
((varPtr)->value.objPtr == NULL)
#define TclIsVarArrayElement(varPtr) \
((varPtr)->flags & VAR_ARRAY_ELEMENT)
#define TclIsVarNamespaceVar(varPtr) \
((varPtr)->flags & VAR_NAMESPACE_VAR)
#define TclIsVarTemporary(varPtr) \
((varPtr)->flags & VAR_TEMPORARY)
#define TclIsVarArgument(varPtr) \
((varPtr)->flags & VAR_ARGUMENT)
#define TclIsVarResolved(varPtr) \
((varPtr)->flags & VAR_RESOLVED)
#define TclIsVarTraceActive(varPtr) \
((varPtr)->flags & VAR_TRACE_ACTIVE)
#define TclIsVarUntraced(varPtr) \
(TclIsVarShort(varPtr) || !(varPtr)->tracePtr)
#define TclIsVarTraced(varPtr) \
(!TclIsVarShort(varPtr) && (varPtr)->tracePtr)
/*
* Macros for direct variable access by TEBC
*/
#define TclIsVarDirectReadable(varPtr) \
((varPtr)->flags & VAR_DIRECT_READABLE)
#define TclIsVarDirectWritable(varPtr) \
((varPtr)->flags & VAR_DIRECT_WRITABLE)
/*
*----------------------------------------------------------------
* Data structures related to procedures. These are used primarily
* in tclProc.c, tclCompile.c, and tclExecute.c.
*----------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
742 743 744 745 746 747 748 749 750 751 752 753 754 755 |
* if no more. */
Trace *nextTracePtr; /* Next trace to check after current
* trace procedure returns; if this
* trace gets deleted, must update pointer
* to avoid using free'd memory. */
} ActiveInterpTrace;
/*
* The structure below defines an entry in the assocData hash table which
* is associated with an interpreter. The entry contains a pointer to a
* function to call when the interpreter is deleted, and a pointer to
* a user-defined piece of data.
*/
| > > > > > > > > > > > > > > > | 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 |
* if no more. */
Trace *nextTracePtr; /* Next trace to check after current
* trace procedure returns; if this
* trace gets deleted, must update pointer
* to avoid using free'd memory. */
} ActiveInterpTrace;
/*
* Flag values designating types of execution traces.
* See tclTrace.c for related flag values.
*
* TCL_TRACE_ENTER_EXEC - triggers enter/enterstep traces.
* - passed to Tcl_CreateObjTrace to set up
* "enterstep" traces.
* TCL_TRACE_LEAVE_EXEC - triggets leave/leavestep traces.
* - passed to Tcl_CreateObjTrace to set up
* "leavestep" traces.
*
*/
#define TCL_TRACE_ENTER_EXEC 1
#define TCL_TRACE_LEAVE_EXEC 2
/*
* The structure below defines an entry in the assocData hash table which
* is associated with an interpreter. The entry contains a pointer to a
* function to call when the interpreter is deleted, and a pointer to
* a user-defined piece of data.
*/
|
| ︙ | ︙ | |||
808 809 810 811 812 813 814 |
* array below). */
Tcl_HashTable *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. */
int numCompiledLocals; /* Count of local variables recognized by
* the compiler including arguments. */
| | | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 |
* array below). */
Tcl_HashTable *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. */
int numCompiledLocals; /* Count of local variables recognized by
* the compiler including arguments. */
ShortVar* compiledLocals; /* Points to the array of local variables
* recognized by the compiler. The compiler
* emits code that refers to these variables
* using an index into this array. */
} CallFrame;
#define FRAME_IS_PROC 0x1
|
| ︙ | ︙ | |||
897 898 899 900 901 902 903 | /* * The type of procedures called by the Tcl bytecode compiler to compile * commands. Pointers to these procedures are kept in the Command structure * describing each command. The integer value returned by a CompileProc * must be one of the following: * * TCL_OK Compilation completed normally. | | | > | > > | | 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 | /* * The type of procedures called by the Tcl bytecode compiler to compile * commands. Pointers to these procedures are kept in the Command structure * describing each command. The integer value returned by a CompileProc * must be one of the following: * * TCL_OK Compilation completed normally. * TCL_ERROR Compilation could not be completed. This can * be just a judgment by the CompileProc that the * command is too complex to compile effectively, * or it can indicate that in the current state of * the interp, the command would raise an error. * The bytecode compiler will not do any error reporting * at compiler time. Error reporting is deferred * until the actual runtime, because by then changes * in the interp state may allow the command to be * successfully evaluated. * TCL_OUT_LINE_COMPILE A source-compatible alias for TCL_ERROR, kept * for the sake of old code only. */ #define TCL_OUT_LINE_COMPILE TCL_ERROR typedef int (CompileProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Parse *parsePtr, struct CompileEnv *compEnvPtr)); /* * The type of procedure called from the compilation hook point in * SetByteCodeFromAny. |
| ︙ | ︙ | |||
937 938 939 940 941 942 943 944 945 946 947 948 949 950 |
typedef struct ExecEnv {
Tcl_Obj **stackPtr; /* Points to the first item in the
* evaluation stack on the heap. */
Tcl_Obj **tosPtr; /* Points to current top of stack;
* (stackPtr-1) when the stack is empty. */
Tcl_Obj **endPtr; /* Points to last usable item in stack. */
} ExecEnv;
/*
* The definitions for the LiteralTable and LiteralEntry structures. Each
* interpreter contains a LiteralTable. It is used to reduce the storage
* needed for all the Tcl objects that hold the literals of scripts compiled
* by the interpreter. A literal's object is shared by all the ByteCodes
| > | 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 |
typedef struct ExecEnv {
Tcl_Obj **stackPtr; /* Points to the first item in the
* evaluation stack on the heap. */
Tcl_Obj **tosPtr; /* Points to current top of stack;
* (stackPtr-1) when the stack is empty. */
Tcl_Obj **endPtr; /* Points to last usable item in stack. */
Tcl_Obj *constants[2]; /* Pointers to constant "0" and "1" objs. */
} ExecEnv;
/*
* The definitions for the LiteralTable and LiteralEntry structures. Each
* interpreter contains a LiteralTable. It is used to reduce the storage
* needed for all the Tcl objects that hold the literals of scripts compiled
* by the interpreter. A literal's object is shared by all the ByteCodes
|
| ︙ | ︙ | |||
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 | * when we first use the rand() or srand() functions. * SAFE_INTERP: Non zero means that the current interp is a * safe interp (ie it has only the safe commands * installed, less priviledge than a regular interp). * INTERP_TRACE_IN_PROGRESS: Non-zero means that an interp trace is currently * active; so no further trace callbacks should be * invoked. * * WARNING: For the sake of some extensions that have made use of former * internal values, do not re-use the flag values 2 (formerly ERR_IN_PROGRESS) * or 8 (formerly ERROR_CODE_SET). */ #define DELETED 1 #define ERR_ALREADY_LOGGED 4 #define DONT_COMPILE_CMDS_INLINE 0x20 #define RAND_SEED_INITIALIZED 0x40 #define SAFE_INTERP 0x80 #define INTERP_TRACE_IN_PROGRESS 0x200 /* * Maximum number of levels of nesting permitted in Tcl commands (used * to catch infinite recursion). */ #define MAX_NESTING_DEPTH 1000 | > > > > > | 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 | * when we first use the rand() or srand() functions. * SAFE_INTERP: Non zero means that the current interp is a * safe interp (ie it has only the safe commands * installed, less priviledge than a regular interp). * INTERP_TRACE_IN_PROGRESS: Non-zero means that an interp trace is currently * active; so no further trace callbacks should be * invoked. * INTERP_ALTERNATE_WRONG_ARGS: Used for listing second and subsequent forms * of the wrong-num-args string in Tcl_WrongNumArgs. * Makes it append instead of replacing and uses * different intermediate text. * * WARNING: For the sake of some extensions that have made use of former * internal values, do not re-use the flag values 2 (formerly ERR_IN_PROGRESS) * or 8 (formerly ERROR_CODE_SET). */ #define DELETED 1 #define ERR_ALREADY_LOGGED 4 #define DONT_COMPILE_CMDS_INLINE 0x20 #define RAND_SEED_INITIALIZED 0x40 #define SAFE_INTERP 0x80 #define INTERP_TRACE_IN_PROGRESS 0x200 #define INTERP_ALTERNATE_WRONG_ARGS 0x400 /* * Maximum number of levels of nesting permitted in Tcl commands (used * to catch infinite recursion). */ #define MAX_NESTING_DEPTH 1000 |
| ︙ | ︙ | |||
1598 1599 1600 1601 1602 1603 1604 | #define TCL_INVOKE_HIDDEN (1<<0) #define TCL_INVOKE_NO_UNKNOWN (1<<1) #define TCL_INVOKE_NO_TRACEBACK (1<<2) /* * The structure used as the internal representation of Tcl list | < | | | | > | > > > > > > > > > > > > > > | 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 |
#define TCL_INVOKE_HIDDEN (1<<0)
#define TCL_INVOKE_NO_UNKNOWN (1<<1)
#define TCL_INVOKE_NO_TRACEBACK (1<<2)
/*
* The structure used as the internal representation of Tcl list
* objects. This struct is grown (reallocated and copied) as necessary to hold
* all the 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;
int maxElemCount; /* Total number of element array slots. */
int elemCount; /* Current number of list elements. */
Tcl_Obj *elements; /* First list element; the struct is grown to
* accomodate all elements. */
} List;
/*
* Macro used to get the elements of a list object - do NOT forget to verify
* that it is of list type before using!
*/
#define TclListObjGetElements(listPtr, objc, objv) \
{ \
List *listRepPtr = \
(List *) (listPtr)->internalRep.twoPtrValue.ptr1;\
(objc) = listRepPtr->elemCount;\
(objv) = &listRepPtr->elements;\
}
/*
*----------------------------------------------------------------
* Data structures related to the filesystem internals
*----------------------------------------------------------------
*/
|
| ︙ | ︙ | |||
1761 1762 1763 1764 1765 1766 1767 | MODULE_SCOPE Tcl_ObjType tclEndOffsetType; MODULE_SCOPE Tcl_ObjType tclIntType; MODULE_SCOPE Tcl_ObjType tclListType; MODULE_SCOPE Tcl_ObjType tclDictType; MODULE_SCOPE Tcl_ObjType tclProcBodyType; MODULE_SCOPE Tcl_ObjType tclStringType; MODULE_SCOPE Tcl_ObjType tclArraySearchType; | < < < < | 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 | MODULE_SCOPE Tcl_ObjType tclEndOffsetType; MODULE_SCOPE Tcl_ObjType tclIntType; MODULE_SCOPE Tcl_ObjType tclListType; MODULE_SCOPE Tcl_ObjType tclDictType; MODULE_SCOPE Tcl_ObjType tclProcBodyType; MODULE_SCOPE Tcl_ObjType tclStringType; MODULE_SCOPE Tcl_ObjType tclArraySearchType; MODULE_SCOPE Tcl_ObjType tclNsNameType; MODULE_SCOPE Tcl_ObjType tclWideIntType; MODULE_SCOPE Tcl_ObjType tclRegexpType; /* * Variables denoting the hash key types defined in the core. */ MODULE_SCOPE Tcl_HashKeyType tclArrayHashKeyType; MODULE_SCOPE Tcl_HashKeyType tclOneWordHashKeyType; |
| ︙ | ︙ | |||
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 | MODULE_SCOPE void TclAppendLimitedToObj _ANSI_ARGS_((Tcl_Obj *objPtr, CONST char *bytes, int length, int limit, CONST char *ellipsis)); MODULE_SCOPE void TclAppendObjToErrorInfo _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_Obj *objPtr)); MODULE_SCOPE int TclArraySet _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj)); MODULE_SCOPE int TclCheckBadOctal _ANSI_ARGS_((Tcl_Interp *interp, CONST char *value)); MODULE_SCOPE void TclCleanupLiteralTable _ANSI_ARGS_(( Tcl_Interp* interp, LiteralTable* tablePtr)); MODULE_SCOPE void TclExpandTokenArray _ANSI_ARGS_(( Tcl_Parse *parsePtr)); MODULE_SCOPE int TclFileAttrsCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclFileCopyCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])) ; MODULE_SCOPE int TclFileDeleteCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclFileMakeDirsCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])) ; MODULE_SCOPE int TclFileRenameCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])) ; MODULE_SCOPE void TclFinalizeAllocSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeCompExecEnv _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeCompilation _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeEncodingSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeEnvironment _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeExecution _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeIOSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeFilesystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclResetFilesystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeLoad _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeMemorySubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeNotifier _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeAsync _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeSynchronization _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeLock _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeThreadData _ANSI_ARGS_((void)); MODULE_SCOPE int TclFSFileAttrIndex _ANSI_ARGS_((Tcl_Obj *pathPtr, CONST char *attributeName, int *indexPtr)); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler _ANSI_ARGS_((Tcl_Interp *interp)); MODULE_SCOPE int TclGetNamespaceFromObj _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr)); | > > > > > > > > > | > > > > | 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 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 | MODULE_SCOPE void TclAppendLimitedToObj _ANSI_ARGS_((Tcl_Obj *objPtr, CONST char *bytes, int length, int limit, CONST char *ellipsis)); MODULE_SCOPE void TclAppendObjToErrorInfo _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_Obj *objPtr)); MODULE_SCOPE int TclArraySet _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj)); MODULE_SCOPE double TclBignumToDouble _ANSI_ARGS_((mp_int* bignum)); MODULE_SCOPE int TclCheckBadOctal _ANSI_ARGS_((Tcl_Interp *interp, CONST char *value)); MODULE_SCOPE void TclCleanupLiteralTable _ANSI_ARGS_(( Tcl_Interp* interp, LiteralTable* tablePtr)); MODULE_SCOPE int TclDoubleDigits _ANSI_ARGS_((char* buf, double value, int* signum)); MODULE_SCOPE void TclExpandTokenArray _ANSI_ARGS_(( Tcl_Parse *parsePtr)); MODULE_SCOPE Var * TclExtendVar _ANSI_ARGS_((Var *oldPtr)); MODULE_SCOPE int TclFileAttrsCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclFileCopyCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])) ; MODULE_SCOPE int TclFileDeleteCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclFileMakeDirsCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])) ; MODULE_SCOPE int TclFileRenameCmd _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])) ; MODULE_SCOPE void TclFinalizeAllocSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeCompExecEnv _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeCompilation _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeDoubleConversion _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeEncodingSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeEnvironment _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeExecution _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeIOSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeFilesystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclResetFilesystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeLoad _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeMemorySubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeNotifier _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeAsync _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeSynchronization _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeLock _ANSI_ARGS_((void)); MODULE_SCOPE void TclFinalizeThreadData _ANSI_ARGS_((void)); MODULE_SCOPE void TclFormatNaN _ANSI_ARGS_((double value, char* buffer)); MODULE_SCOPE int TclFSFileAttrIndex _ANSI_ARGS_((Tcl_Obj *pathPtr, CONST char *attributeName, int *indexPtr)); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler _ANSI_ARGS_((Tcl_Interp *interp)); MODULE_SCOPE int TclGetEncodingFromObj _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Encoding *encodingPtr)); MODULE_SCOPE int TclGetNamespaceFromObj _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr)); MODULE_SCOPE int TclGetOpenModeEx _ANSI_ARGS_((Tcl_Interp *interp, CONST char *modeString, int *seekFlagPtr, int *binaryPtr)); MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue _ANSI_ARGS_ (( ProcessGlobalValue *pgvPtr)); MODULE_SCOPE int TclGlob _ANSI_ARGS_((Tcl_Interp *interp, char *pattern, Tcl_Obj *unquotedPrefix, int globFlags, Tcl_GlobTypeData* types)); MODULE_SCOPE void TclInitAlloc _ANSI_ARGS_((void)); MODULE_SCOPE void TclInitDbCkalloc _ANSI_ARGS_((void)); MODULE_SCOPE void TclInitDoubleConversion _ANSI_ARGS_((void)); MODULE_SCOPE void TclInitEmbeddedConfigurationInformation _ANSI_ARGS_((Tcl_Interp *interp)); MODULE_SCOPE void TclInitEncodingSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclInitIOSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclInitLimitSupport _ANSI_ARGS_((Tcl_Interp *interp)); MODULE_SCOPE void TclInitNamespaceSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclInitNotifier _ANSI_ARGS_((void)); MODULE_SCOPE void TclInitObjSubsystem _ANSI_ARGS_((void)); MODULE_SCOPE void TclInitSubsystems (); MODULE_SCOPE int TclInterpReady _ANSI_ARGS_((Tcl_Interp *interp)); MODULE_SCOPE int TclIsLocalScalar _ANSI_ARGS_((CONST char *src, int len)); MODULE_SCOPE int TclJoinThread _ANSI_ARGS_((Tcl_ThreadId id, int* result)); MODULE_SCOPE void TclLimitRemoveAllHandlers _ANSI_ARGS_(( Tcl_Interp *interp)); MODULE_SCOPE Tcl_Obj * TclLindexList _ANSI_ARGS_((Tcl_Interp* interp, |
| ︙ | ︙ | |||
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 | MODULE_SCOPE void TclSetBgErrorHandler _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *cmdPrefix)); MODULE_SCOPE void TclSetProcessGlobalValue _ANSI_ARGS_ (( ProcessGlobalValue *pgvPtr, Tcl_Obj *newValue, Tcl_Encoding encoding)); MODULE_SCOPE VOID TclSignalExitThread _ANSI_ARGS_((Tcl_ThreadId id, int result)); MODULE_SCOPE int TclSubstTokens _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, int *tokensLeftPtr)); MODULE_SCOPE void TclTransferResult _ANSI_ARGS_(( Tcl_Interp *sourceInterp, int result, Tcl_Interp *targetInterp)); MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized _ANSI_ARGS_(( ClientData clientData)); MODULE_SCOPE Tcl_Obj * TclpFilesystemPathType _ANSI_ARGS_(( Tcl_Obj* pathPtr)); MODULE_SCOPE Tcl_PackageInitProc* TclpFindSymbol _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_LoadHandle loadHandle, CONST char *symbol)); MODULE_SCOPE int TclpDlopen _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_LoadHandle *loadHandle, Tcl_FSUnloadFileProc **unloadProcPtr)); MODULE_SCOPE int TclpUtime _ANSI_ARGS_((Tcl_Obj *pathPtr, struct utimbuf *tval)); /* *---------------------------------------------------------------- * Command procedures in the generic core: *---------------------------------------------------------------- */ | > > > > > > > > > > | 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 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 | MODULE_SCOPE void TclSetBgErrorHandler _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *cmdPrefix)); MODULE_SCOPE void TclSetProcessGlobalValue _ANSI_ARGS_ (( ProcessGlobalValue *pgvPtr, Tcl_Obj *newValue, Tcl_Encoding encoding)); MODULE_SCOPE VOID TclSignalExitThread _ANSI_ARGS_((Tcl_ThreadId id, int result)); MODULE_SCOPE double TclStrToD _ANSI_ARGS_((CONST char* string, CONST char** endPtr)); MODULE_SCOPE int TclSubstTokens _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, int *tokensLeftPtr)); MODULE_SCOPE void TclTransferResult _ANSI_ARGS_(( Tcl_Interp *sourceInterp, int result, Tcl_Interp *targetInterp)); MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized _ANSI_ARGS_(( ClientData clientData)); MODULE_SCOPE Tcl_Obj * TclpFilesystemPathType _ANSI_ARGS_(( Tcl_Obj* pathPtr)); MODULE_SCOPE Tcl_PackageInitProc* TclpFindSymbol _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_LoadHandle loadHandle, CONST char *symbol)); MODULE_SCOPE int TclpDlopen _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_LoadHandle *loadHandle, Tcl_FSUnloadFileProc **unloadProcPtr)); MODULE_SCOPE int TclpUtime _ANSI_ARGS_((Tcl_Obj *pathPtr, struct utimbuf *tval)); #ifdef TCL_LOAD_FROM_MEMORY MODULE_SCOPE void* TclpLoadMemoryGetBuffer _ANSI_ARGS_(( Tcl_Interp *interp, int size)); MODULE_SCOPE int TclpLoadMemory _ANSI_ARGS_((Tcl_Interp *interp, void *buffer, int size, int codeSize, Tcl_LoadHandle *loadHandle, Tcl_FSUnloadFileProc **unloadProcPtr)); #endif /* *---------------------------------------------------------------- * Command procedures in the generic core: *---------------------------------------------------------------- */ |
| ︙ | ︙ | |||
2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 | Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_CatchObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_CdObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclClockClicksObjCmd _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclClockGetenvObjCmd _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclClockMicrosecondsObjCmd _ANSI_ARGS_(( | > > > | 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 | Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_CatchObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_CdObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclChanTruncateObjCmd _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclClockClicksObjCmd _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclClockGetenvObjCmd _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclClockMicrosecondsObjCmd _ANSI_ARGS_(( |
| ︙ | ︙ | |||
2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 | int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_DictObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_EncodingObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_EofObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_ErrorObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_EvalObjCmd _ANSI_ARGS_((ClientData clientData, | > > > | 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 | int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_DictObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_EncodingObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int TclEncodingDirsObjCmd _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_EofObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_ErrorObjCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); MODULE_SCOPE int Tcl_EvalObjCmd _ANSI_ARGS_((ClientData clientData, |
| ︙ | ︙ | |||
2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 | MODULE_SCOPE Tcl_Obj * TclPtrIncrVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, CONST char *part1, CONST char *part2, CONST long i, CONST int flags)); MODULE_SCOPE Tcl_Obj * TclPtrIncrWideVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, CONST char *part1, CONST char *part2, CONST Tcl_WideInt i, CONST int flags)); /* *---------------------------------------------------------------- * Macros used by the Tcl core to create and release Tcl objects. * TclNewObj(objPtr) creates a new object denoting an empty string. * TclDecrRefCount(objPtr) decrements the object's reference count, * and frees the object if its reference count is zero. | > | 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 | MODULE_SCOPE Tcl_Obj * TclPtrIncrVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, CONST char *part1, CONST char *part2, CONST long i, CONST int flags)); MODULE_SCOPE Tcl_Obj * TclPtrIncrWideVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, CONST char *part1, CONST char *part2, CONST Tcl_WideInt i, CONST int flags)); MODULE_SCOPE void TclInvalidateNsPath _ANSI_ARGS_((Namespace *nsPtr)); /* *---------------------------------------------------------------- * Macros used by the Tcl core to create and release Tcl objects. * TclNewObj(objPtr) creates a new object denoting an empty string. * TclDecrRefCount(objPtr) decrements the object's reference count, * and frees the object if its reference count is zero. |
| ︙ | ︙ | |||
2413 2414 2415 2416 2417 2418 2419 |
# define TclIncrObjsFreed() \
tclObjsFreed++
#else
# define TclIncrObjsAllocated()
# define TclIncrObjsFreed()
#endif /* TCL_COMPILE_STATS */
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | < < < < < < < < < < < < < < < < < < < < < < < | | | | | | < < < < < < < < < < < | > | 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 |
# define TclIncrObjsFreed() \
tclObjsFreed++
#else
# define TclIncrObjsAllocated()
# define TclIncrObjsFreed()
#endif /* TCL_COMPILE_STATS */
#ifndef TCL_MEM_DEBUG
# define TclNewObj(objPtr) \
TclIncrObjsAllocated(); \
TclAllocObjStorage(objPtr); \
(objPtr)->refCount = 0; \
(objPtr)->bytes = tclEmptyStringRep; \
(objPtr)->length = 0; \
(objPtr)->typePtr = NULL
# define TclDecrRefCount(objPtr) \
if (--(objPtr)->refCount <= 0) { \
if ((objPtr)->typePtr && (objPtr)->typePtr->freeIntRepProc) { \
TclFreeObj(objPtr); \
} else { \
if ((objPtr)->bytes \
&& ((objPtr)->bytes != tclEmptyStringRep)) { \
ckfree((char *) (objPtr)->bytes); \
} \
TclFreeObjStorage(objPtr); \
TclIncrObjsFreed(); \
} \
}
#if defined(PURIFY)
/*
* The PURIFY mode is like the regular mode, but instead of doing block
* Tcl_Obj allocation and keeping a freed list for efficiency, it always
* allocates and frees a single Tcl_Obj so that tools like Purify can
* better track memory leaks
|
| ︙ | ︙ | |||
2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 | * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's * from per-thread caches. */ MODULE_SCOPE Tcl_Obj * TclThreadAllocObj _ANSI_ARGS_((void)); MODULE_SCOPE void TclThreadFreeObj _ANSI_ARGS_((Tcl_Obj *)); MODULE_SCOPE Tcl_Mutex *TclpNewAllocMutex _ANSI_ARGS_((void)); MODULE_SCOPE void * TclpGetAllocCache _ANSI_ARGS_((void)); MODULE_SCOPE void TclpSetAllocCache _ANSI_ARGS_((void *)); MODULE_SCOPE void TclFinalizeThreadAlloc _ANSI_ARGS_((void)); MODULE_SCOPE void TclpFreeAllocMutex _ANSI_ARGS_((Tcl_Mutex* mutex)); # define TclAllocObjStorage(objPtr) \ (objPtr) = TclThreadAllocObj() # define TclFreeObjStorage(objPtr) \ TclThreadFreeObj((objPtr)) | > > | 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 | * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's * from per-thread caches. */ MODULE_SCOPE Tcl_Obj * TclThreadAllocObj _ANSI_ARGS_((void)); MODULE_SCOPE void TclThreadFreeObj _ANSI_ARGS_((Tcl_Obj *)); MODULE_SCOPE Tcl_Mutex *TclpNewAllocMutex _ANSI_ARGS_((void)); MODULE_SCOPE void TclFreeAllocCache _ANSI_ARGS_((void *)); MODULE_SCOPE void * TclpGetAllocCache _ANSI_ARGS_((void)); MODULE_SCOPE void TclpSetAllocCache _ANSI_ARGS_((void *)); MODULE_SCOPE void TclFinalizeThreadAlloc _ANSI_ARGS_((void)); MODULE_SCOPE void TclpFreeAllocMutex _ANSI_ARGS_((Tcl_Mutex* mutex)); MODULE_SCOPE void TclpFreeAllocCache _ANSI_ARGS_((void *)); # define TclAllocObjStorage(objPtr) \ (objPtr) = TclThreadAllocObj() # define TclFreeObjStorage(objPtr) \ TclThreadFreeObj((objPtr)) |
| ︙ | ︙ | |||
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 |
TclDbNewObj(objPtr, __FILE__, __LINE__);
# define TclDecrRefCount(objPtr) \
Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)
# define TclNewListObjDirect(objc, objv) \
TclDbNewListObjDirect(objc, objv, __FILE__, __LINE__)
#undef USE_THREAD_ALLOC
#endif /* TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------
* 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:
*
* MODULE_SCOPE void TclInitStringRep _ANSI_ARGS_((
* Tcl_Obj *objPtr, char *bytePtr, int len));
*----------------------------------------------------------------
*/
#define TclInitStringRep(objPtr, bytePtr, len) \
if ((len) == 0) { \
(objPtr)->bytes = tclEmptyStringRep; \
(objPtr)->length = 0; \
| > > > > > > > > > > > > > > > > | 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 |
TclDbNewObj(objPtr, __FILE__, __LINE__);
# define TclDecrRefCount(objPtr) \
Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)
# define TclNewListObjDirect(objc, objv) \
TclDbNewListObjDirect(objc, objv, __FILE__, __LINE__)
#define TclAllocObjStorage(objPtr) \
TclNewObj(objPtr)
#define TclFreeObjStorage(anyPtr) \
{\
Tcl_Obj *objPtr = (Tcl_Obj *) (anyPtr);\
objPtr->refCount = 1;\
objPtr->bytes = tclEmptyStringRep;\
objPtr->length = 0;\
objPtr->typePtr = NULL;\
TclDecrRefCount(objPtr);\
}
#undef USE_THREAD_ALLOC
#endif /* TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------
* 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:
*
* MODULE_SCOPE void TclInitStringRep _ANSI_ARGS_((
* Tcl_Obj *objPtr, char *bytePtr, int len));
*
* This macro should only be called on an unshared objPtr where
* objPtr->typePtr->freeIntRepProc == NULL
*----------------------------------------------------------------
*/
#define TclInitStringRep(objPtr, bytePtr, len) \
if ((len) == 0) { \
(objPtr)->bytes = tclEmptyStringRep; \
(objPtr)->length = 0; \
|
| ︙ | ︙ | |||
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 |
*/
#define TclFreeIntRep(objPtr) \
if ((objPtr)->typePtr != NULL && \
(objPtr)->typePtr->freeIntRepProc != NULL) { \
(objPtr)->typePtr->freeIntRepProc(objPtr); \
}
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to get a Tcl_WideInt value out of
* a Tcl_Obj of the "wideInt" type. Different implementation on
* different platforms depending whether TCL_WIDE_INT_IS_LONG.
*----------------------------------------------------------------
| > > > > > > > > > > > > > > > > > > | 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 |
*/
#define TclFreeIntRep(objPtr) \
if ((objPtr)->typePtr != NULL && \
(objPtr)->typePtr->freeIntRepProc != NULL) { \
(objPtr)->typePtr->freeIntRepProc(objPtr); \
}
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to clean out an object's string
* representation. The ANSI C "prototype" for this macro is:
*
* MODULE_SCOPE void TclInvalidateStringRep _ANSI_ARGS_((Tcl_Obj *objPtr));
*----------------------------------------------------------------
*/
#define TclInvalidateStringRep(objPtr) \
if (objPtr->bytes != NULL) { \
if (objPtr->bytes != tclEmptyStringRep) {\
ckfree((char *) objPtr->bytes);\
}\
objPtr->bytes = NULL;\
}\
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to get a Tcl_WideInt value out of
* a Tcl_Obj of the "wideInt" type. Different implementation on
* different platforms depending whether TCL_WIDE_INT_IS_LONG.
*----------------------------------------------------------------
|
| ︙ | ︙ | |||
2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 |
*/
#define TclInvalidateNsCmdLookup(nsPtr) \
if ((nsPtr)->numExportPatterns) { \
(nsPtr)->exportLookupEpoch++; \
}
#include "tclPort.h"
#include "tclIntDecls.h"
#include "tclIntPlatDecls.h"
#endif /* _TCLINT */
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 |
*/
#define TclInvalidateNsCmdLookup(nsPtr) \
if ((nsPtr)->numExportPatterns) { \
(nsPtr)->exportLookupEpoch++; \
}
/*
*----------------------------------------------------------------------
*
* Core procedures added to libtommath for bignum manipulation.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE void* TclBNAlloc( size_t nBytes );
MODULE_SCOPE void* TclBNRealloc( void* oldBlock, size_t newNBytes );
MODULE_SCOPE void TclBNFree( void* block );
MODULE_SCOPE void TclBNInitBignumFromLong( mp_int* bignum, long initVal );
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to check whether a pattern has
* any characters special to [string match].
* The ANSI C "prototype" for this macro is:
*
* MODULE_SCOPE int TclMatchIsTrivial _ANSI_ARGS_((
* CONST char *pattern));
*----------------------------------------------------------------
*/
#define TclMatchIsTrivial(pattern) strpbrk((pattern), "*[]]?\\") == NULL
/*
*----------------------------------------------------------------
* Macros used by the Tcl core to set a Tcl_Obj's numeric representation
* avoiding the corresponding function calls in time critical parts of the
* core. They should only be called on unshared objects. The ANSI C
* "prototypes" for these macros are:
*
* MODULE_SCOPE void TclSetIntObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* int intValue));
* MODULE_SCOPE void TclSetLongObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* long longValue));
* MODULE_SCOPE void TclSetBooleanObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* long boolValue));
* MODULE_SCOPE void TclSetWideIntObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* Tcl_WideInt w));
* MODULE_SCOPE void TclSetDoubleObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* double d));
*
*----------------------------------------------------------------
*/
#define TclSetIntObj(objPtr, i) \
TclInvalidateStringRep(objPtr);\
TclFreeIntRep(objPtr); \
(objPtr)->internalRep.longValue = (long)(i); \
(objPtr)->typePtr = &tclIntType
#define TclSetLongObj(objPtr, l) \
TclSetIntObj((objPtr), (l))
/*
* NOTE: There is to be no such thing as a "pure" boolean.
* Boolean values set programmatically go straight to being
* "int" Tcl_Obj's, with value 0 or 1. The only "boolean"
* Tcl_Obj's shall be those holding the cached boolean value
* of strings like: "yes", "no", "true", "false", "on", "off".
*/
#define TclSetBooleanObj(objPtr, b) \
TclSetIntObj((objPtr), ((b)? 1 : 0));
#define TclSetWideIntObj(objPtr, w) \
TclInvalidateStringRep(objPtr);\
TclFreeIntRep(objPtr); \
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(w); \
(objPtr)->typePtr = &tclWideIntType
#define TclSetDoubleObj(objPtr, d) \
TclInvalidateStringRep(objPtr);\
TclFreeIntRep(objPtr); \
(objPtr)->internalRep.doubleValue = (double)(d); \
(objPtr)->typePtr = &tclDoubleType
/*
*----------------------------------------------------------------
* Macros used by the Tcl core to create and initialise objects of
* standard types, avoiding the corresponding function calls in time
* critical parts of the core. The ANSI C "prototypes" for these
* macros are:
*
* MODULE_SCOPE void TclNewIntObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* int i));
* MODULE_SCOPE void TclNewLongObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* long l));
* MODULE_SCOPE void TclNewBooleanObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* int b));
* MODULE_SCOPE void TclNewWideObj _ANSI_ARGS_((Tcl_Obj *objPtr,
* Tcl_WideInt w));
* MODULE_SCOPE void TclNewDoubleObj _ANSI_ARGS_((Tcl_Obj *objPtr),
* double d);
* MODULE_SCOPE void TclNewStringObj _ANSI_ARGS_((Tcl_Obj *objPtr)
* char *s, int len);
*
*----------------------------------------------------------------
*/
#ifndef TCL_MEM_DEBUG
#define TclNewIntObj(objPtr, i) \
TclIncrObjsAllocated(); \
TclAllocObjStorage(objPtr); \
(objPtr)->refCount = 0; \
(objPtr)->bytes = NULL; \
(objPtr)->internalRep.longValue = (long)(i); \
(objPtr)->typePtr = &tclIntType
#define TclNewLongObj(objPtr, l) \
TclNewIntObj((objPtr), (l))
/*
* NOTE: There is to be no such thing as a "pure" boolean.
* See comment above TclSetBooleanObj macro above.
*/
#define TclNewBooleanObj(objPtr, b) \
TclNewIntObj((objPtr), ((b)? 1 : 0))
#define TclNewWideIntObj(objPtr, w) \
TclIncrObjsAllocated(); \
TclAllocObjStorage(objPtr); \
(objPtr)->refCount = 0; \
(objPtr)->bytes = NULL; \
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(w); \
(objPtr)->typePtr = &tclWideIntType
#define TclNewDoubleObj(objPtr, d) \
TclIncrObjsAllocated(); \
TclAllocObjStorage(objPtr); \
(objPtr)->refCount = 0; \
(objPtr)->bytes = NULL; \
(objPtr)->internalRep.doubleValue = (double)(d); \
(objPtr)->typePtr = &tclDoubleType
#define TclNewStringObj(objPtr, s, len) \
TclNewObj(objPtr); \
TclInitStringRep((objPtr), (s), (len))
#else /* TCL_MEM_DEBUG */
#define TclNewIntObj(objPtr, i) \
(objPtr) = Tcl_NewIntObj(i)
#define TclNewLongObj(objPtr, l) \
(objPtr) = Tcl_NewLongObj(l)
#define TclNewBooleanObj(objPtr, b) \
(objPtr) = Tcl_NewBooleanObj(b)
#define TclNewWideIntObj(objPtr, w)\
(objPtr) = Tcl_NewWideIntObj(w)
#define TclNewDoubleObj(objPtr, d) \
(objPtr) = Tcl_NewDoubleObj(d)
#define TclNewStringObj(objPtr, s, len) \
(objPtr) = Tcl_NewStringObj((s), (len))
#endif /* TCL_MEM_DEBUG */
#include "tclPort.h"
#include "tclIntDecls.h"
#include "tclIntPlatDecls.h"
#endif /* _TCLINT */
|
Changes to generic/tclIntDecls.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclIntDecls.h -- * * This file contains the declarations for all unsupported * functions that are exported by the Tcl library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclIntDecls.h -- * * This file contains the declarations for all unsupported * functions that are exported by the Tcl library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclIntDecls.h,v 1.76.2.2 2005/06/13 01:46:10 msofer Exp $ */ #ifndef _TCLINTDECLS #define _TCLINTDECLS #include "tclPort.h" |
| ︙ | ︙ | |||
913 914 915 916 917 918 919 | #endif #ifndef Tcl_GetStartupScript_TCL_DECLARED #define Tcl_GetStartupScript_TCL_DECLARED /* 179 */ EXTERN Tcl_Obj * Tcl_GetStartupScript _ANSI_ARGS_(( CONST char ** encodingNamePtr)); #endif | < < | < < < < < | < < < | 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 | #endif #ifndef Tcl_GetStartupScript_TCL_DECLARED #define Tcl_GetStartupScript_TCL_DECLARED /* 179 */ EXTERN Tcl_Obj * Tcl_GetStartupScript _ANSI_ARGS_(( CONST char ** encodingNamePtr)); #endif /* Slot 180 is reserved */ /* Slot 181 is reserved */ #ifndef TclpLocaltime_TCL_DECLARED #define TclpLocaltime_TCL_DECLARED /* 182 */ EXTERN struct tm * TclpLocaltime _ANSI_ARGS_((CONST time_t * clock)); #endif #ifndef TclpGmtime_TCL_DECLARED #define TclpGmtime_TCL_DECLARED |
| ︙ | ︙ | |||
1021 1022 1023 1024 1025 1026 1027 | #endif #ifndef TclObjGetFrame_TCL_DECLARED #define TclObjGetFrame_TCL_DECLARED /* 198 */ EXTERN int TclObjGetFrame _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CallFrame ** framePtrPtr)); #endif | < < | < < | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 | #endif #ifndef TclObjGetFrame_TCL_DECLARED #define TclObjGetFrame_TCL_DECLARED /* 198 */ EXTERN int TclObjGetFrame _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CallFrame ** framePtrPtr)); #endif /* Slot 199 is reserved */ #ifndef TclpObjRemoveDirectory_TCL_DECLARED #define TclpObjRemoveDirectory_TCL_DECLARED /* 200 */ EXTERN int TclpObjRemoveDirectory _ANSI_ARGS_(( Tcl_Obj * pathPtr, int recursive, Tcl_Obj ** errorPtr)); #endif |
| ︙ | ︙ | |||
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 |
int isProcCallFrame));
#endif
#ifndef TclPopStackFrame_TCL_DECLARED
#define TclPopStackFrame_TCL_DECLARED
/* 218 */
EXTERN void TclPopStackFrame _ANSI_ARGS_((Tcl_Interp * interp));
#endif
typedef struct TclIntStubs {
int magic;
struct TclIntStubHooks *hooks;
void *reserved0;
int (*tclAccessDeleteProc) _ANSI_ARGS_((TclAccessProc_ * proc)); /* 1 */
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
int isProcCallFrame));
#endif
#ifndef TclPopStackFrame_TCL_DECLARED
#define TclPopStackFrame_TCL_DECLARED
/* 218 */
EXTERN void TclPopStackFrame _ANSI_ARGS_((Tcl_Interp * interp));
#endif
#ifndef TclBN_mp_div_d_TCL_DECLARED
#define TclBN_mp_div_d_TCL_DECLARED
/* 219 */
EXTERN int TclBN_mp_div_d _ANSI_ARGS_((mp_int * a, mp_digit b,
mp_int * c, mp_digit * d));
#endif
#ifndef TclBN_mp_mul_d_TCL_DECLARED
#define TclBN_mp_mul_d_TCL_DECLARED
/* 220 */
EXTERN int TclBN_mp_mul_d _ANSI_ARGS_((mp_int * a, mp_digit b,
mp_int * c));
#endif
#ifndef TclBN_mp_clear_TCL_DECLARED
#define TclBN_mp_clear_TCL_DECLARED
/* 221 */
EXTERN void TclBN_mp_clear _ANSI_ARGS_((mp_int * a));
#endif
#ifndef TclBN_mp_init_TCL_DECLARED
#define TclBN_mp_init_TCL_DECLARED
/* 222 */
EXTERN int TclBN_mp_init _ANSI_ARGS_((mp_int * a));
#endif
#ifndef TclBN_mp_read_radix_TCL_DECLARED
#define TclBN_mp_read_radix_TCL_DECLARED
/* 223 */
EXTERN int TclBN_mp_read_radix _ANSI_ARGS_((mp_int * a,
const char * str, int radix));
#endif
#ifndef TclGetPlatform_TCL_DECLARED
#define TclGetPlatform_TCL_DECLARED
/* 224 */
EXTERN TclPlatformType * TclGetPlatform _ANSI_ARGS_((void));
#endif
typedef struct TclIntStubs {
int magic;
struct TclIntStubHooks *hooks;
void *reserved0;
int (*tclAccessDeleteProc) _ANSI_ARGS_((TclAccessProc_ * proc)); /* 1 */
|
| ︙ | ︙ | |||
1338 1339 1340 1341 1342 1343 1344 |
int (*tclUniCharMatch) _ANSI_ARGS_((CONST Tcl_UniChar * string, int strLen, CONST Tcl_UniChar * pattern, int ptnLen, int nocase)); /* 173 */
Tcl_Obj * (*tclIncrWideVar2) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, Tcl_WideInt wideIncrAmount, int part1NotParsed)); /* 174 */
int (*tclCallVarTraces) _ANSI_ARGS_((Interp * iPtr, Var * arrayPtr, Var * varPtr, CONST char * part1, CONST char * part2, int flags, int leaveErrMsg)); /* 175 */
void (*tclCleanupVar) _ANSI_ARGS_((Var * varPtr, Var * arrayPtr)); /* 176 */
void (*tclVarErrMsg) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * part1, CONST char * part2, CONST char * operation, CONST char * reason)); /* 177 */
void (*tcl_SetStartupScript) _ANSI_ARGS_((Tcl_Obj * pathPtr, CONST char* encodingName)); /* 178 */
Tcl_Obj * (*tcl_GetStartupScript) _ANSI_ARGS_((CONST char ** encodingNamePtr)); /* 179 */
| | | | > > > > > > | 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 |
int (*tclUniCharMatch) _ANSI_ARGS_((CONST Tcl_UniChar * string, int strLen, CONST Tcl_UniChar * pattern, int ptnLen, int nocase)); /* 173 */
Tcl_Obj * (*tclIncrWideVar2) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, Tcl_WideInt wideIncrAmount, int part1NotParsed)); /* 174 */
int (*tclCallVarTraces) _ANSI_ARGS_((Interp * iPtr, Var * arrayPtr, Var * varPtr, CONST char * part1, CONST char * part2, int flags, int leaveErrMsg)); /* 175 */
void (*tclCleanupVar) _ANSI_ARGS_((Var * varPtr, Var * arrayPtr)); /* 176 */
void (*tclVarErrMsg) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * part1, CONST char * part2, CONST char * operation, CONST char * reason)); /* 177 */
void (*tcl_SetStartupScript) _ANSI_ARGS_((Tcl_Obj * pathPtr, CONST char* encodingName)); /* 178 */
Tcl_Obj * (*tcl_GetStartupScript) _ANSI_ARGS_((CONST char ** encodingNamePtr)); /* 179 */
void *reserved180;
void *reserved181;
struct tm * (*tclpLocaltime) _ANSI_ARGS_((CONST time_t * clock)); /* 182 */
struct tm * (*tclpGmtime) _ANSI_ARGS_((CONST time_t * clock)); /* 183 */
void (*tclThreadStorageLockInit) _ANSI_ARGS_((void)); /* 184 */
void (*tclThreadStorageLock) _ANSI_ARGS_((void)); /* 185 */
void (*tclThreadStorageUnlock) _ANSI_ARGS_((void)); /* 186 */
void (*tclThreadStoragePrint) _ANSI_ARGS_((FILE * outFile, int flags)); /* 187 */
Tcl_HashTable * (*tclThreadStorageGetHashTable) _ANSI_ARGS_((Tcl_ThreadId id)); /* 188 */
Tcl_HashTable * (*tclThreadStorageInit) _ANSI_ARGS_((Tcl_ThreadId id, void * reserved)); /* 189 */
void (*tclThreadStorageDataKeyInit) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr)); /* 190 */
void * (*tclThreadStorageDataKeyGet) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr)); /* 191 */
void (*tclThreadStorageDataKeySet) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr, void * data)); /* 192 */
void (*tclFinalizeThreadStorageThread) _ANSI_ARGS_((Tcl_ThreadId id)); /* 193 */
void (*tclFinalizeThreadStorage) _ANSI_ARGS_((void)); /* 194 */
void (*tclFinalizeThreadStorageData) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr)); /* 195 */
void (*tclFinalizeThreadStorageDataKey) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr)); /* 196 */
int (*tclCompEvalObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 197 */
int (*tclObjGetFrame) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CallFrame ** framePtrPtr)); /* 198 */
void *reserved199;
int (*tclpObjRemoveDirectory) _ANSI_ARGS_((Tcl_Obj * pathPtr, int recursive, Tcl_Obj ** errorPtr)); /* 200 */
int (*tclpObjCopyDirectory) _ANSI_ARGS_((Tcl_Obj * srcPathPtr, Tcl_Obj * destPathPtr, Tcl_Obj ** errorPtr)); /* 201 */
int (*tclpObjCreateDirectory) _ANSI_ARGS_((Tcl_Obj * pathPtr)); /* 202 */
int (*tclpObjDeleteFile) _ANSI_ARGS_((Tcl_Obj * pathPtr)); /* 203 */
int (*tclpObjCopyFile) _ANSI_ARGS_((Tcl_Obj * srcPathPtr, Tcl_Obj * destPathPtr)); /* 204 */
int (*tclpObjRenameFile) _ANSI_ARGS_((Tcl_Obj * srcPathPtr, Tcl_Obj * destPathPtr)); /* 205 */
int (*tclpObjStat) _ANSI_ARGS_((Tcl_Obj * pathPtr, Tcl_StatBuf * buf)); /* 206 */
int (*tclpObjAccess) _ANSI_ARGS_((Tcl_Obj * pathPtr, int mode)); /* 207 */
Tcl_Channel (*tclpOpenFileChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * pathPtr, int mode, int permissions)); /* 208 */
Tcl_Obj * (*tclGetEncodingSearchPath) _ANSI_ARGS_((void)); /* 209 */
int (*tclSetEncodingSearchPath) _ANSI_ARGS_((Tcl_Obj * searchPath)); /* 210 */
CONST char * (*tclpGetEncodingNameFromEnvironment) _ANSI_ARGS_((Tcl_DString * bufPtr)); /* 211 */
void (*tclpFindExecutable) _ANSI_ARGS_((CONST char * argv0)); /* 212 */
Tcl_Obj * (*tclGetObjNameOfExecutable) _ANSI_ARGS_((void)); /* 213 */
void (*tclSetObjNameOfExecutable) _ANSI_ARGS_((Tcl_Obj * name, Tcl_Encoding encoding)); /* 214 */
char * (*tclStackAlloc) _ANSI_ARGS_((Tcl_Interp * interp, int numBytes)); /* 215 */
void (*tclStackFree) _ANSI_ARGS_((Tcl_Interp * interp)); /* 216 */
int (*tclPushStackFrame) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_CallFrame ** framePtrPtr, Tcl_Namespace * namespacePtr, int isProcCallFrame)); /* 217 */
void (*tclPopStackFrame) _ANSI_ARGS_((Tcl_Interp * interp)); /* 218 */
int (*tclBN_mp_div_d) _ANSI_ARGS_((mp_int * a, mp_digit b, mp_int * c, mp_digit * d)); /* 219 */
int (*tclBN_mp_mul_d) _ANSI_ARGS_((mp_int * a, mp_digit b, mp_int * c)); /* 220 */
void (*tclBN_mp_clear) _ANSI_ARGS_((mp_int * a)); /* 221 */
int (*tclBN_mp_init) _ANSI_ARGS_((mp_int * a)); /* 222 */
int (*tclBN_mp_read_radix) _ANSI_ARGS_((mp_int * a, const char * str, int radix)); /* 223 */
TclPlatformType * (*tclGetPlatform) _ANSI_ARGS_((void)); /* 224 */
} TclIntStubs;
#ifdef __cplusplus
extern "C" {
#endif
extern TclIntStubs *tclIntStubsPtr;
#ifdef __cplusplus
|
| ︙ | ︙ | |||
1984 1985 1986 1987 1988 1989 1990 | #define Tcl_SetStartupScript \ (tclIntStubsPtr->tcl_SetStartupScript) /* 178 */ #endif #ifndef Tcl_GetStartupScript #define Tcl_GetStartupScript \ (tclIntStubsPtr->tcl_GetStartupScript) /* 179 */ #endif | < < | < < < | < | 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | #define Tcl_SetStartupScript \ (tclIntStubsPtr->tcl_SetStartupScript) /* 178 */ #endif #ifndef Tcl_GetStartupScript #define Tcl_GetStartupScript \ (tclIntStubsPtr->tcl_GetStartupScript) /* 179 */ #endif /* Slot 180 is reserved */ /* Slot 181 is reserved */ #ifndef TclpLocaltime #define TclpLocaltime \ (tclIntStubsPtr->tclpLocaltime) /* 182 */ #endif #ifndef TclpGmtime #define TclpGmtime \ (tclIntStubsPtr->tclpGmtime) /* 183 */ |
| ︙ | ︙ | |||
2060 2061 2062 2063 2064 2065 2066 | #define TclCompEvalObj \ (tclIntStubsPtr->tclCompEvalObj) /* 197 */ #endif #ifndef TclObjGetFrame #define TclObjGetFrame \ (tclIntStubsPtr->tclObjGetFrame) /* 198 */ #endif | < < | < | 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 | #define TclCompEvalObj \ (tclIntStubsPtr->tclCompEvalObj) /* 197 */ #endif #ifndef TclObjGetFrame #define TclObjGetFrame \ (tclIntStubsPtr->tclObjGetFrame) /* 198 */ #endif /* Slot 199 is reserved */ #ifndef TclpObjRemoveDirectory #define TclpObjRemoveDirectory \ (tclIntStubsPtr->tclpObjRemoveDirectory) /* 200 */ #endif #ifndef TclpObjCopyDirectory #define TclpObjCopyDirectory \ (tclIntStubsPtr->tclpObjCopyDirectory) /* 201 */ |
| ︙ | ︙ | |||
2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 | #define TclPushStackFrame \ (tclIntStubsPtr->tclPushStackFrame) /* 217 */ #endif #ifndef TclPopStackFrame #define TclPopStackFrame \ (tclIntStubsPtr->tclPopStackFrame) /* 218 */ #endif #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TCLINTDECLS */ | > > > > > > > > > > > > > > > > > > > > > > > > | 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 | #define TclPushStackFrame \ (tclIntStubsPtr->tclPushStackFrame) /* 217 */ #endif #ifndef TclPopStackFrame #define TclPopStackFrame \ (tclIntStubsPtr->tclPopStackFrame) /* 218 */ #endif #ifndef TclBN_mp_div_d #define TclBN_mp_div_d \ (tclIntStubsPtr->tclBN_mp_div_d) /* 219 */ #endif #ifndef TclBN_mp_mul_d #define TclBN_mp_mul_d \ (tclIntStubsPtr->tclBN_mp_mul_d) /* 220 */ #endif #ifndef TclBN_mp_clear #define TclBN_mp_clear \ (tclIntStubsPtr->tclBN_mp_clear) /* 221 */ #endif #ifndef TclBN_mp_init #define TclBN_mp_init \ (tclIntStubsPtr->tclBN_mp_init) /* 222 */ #endif #ifndef TclBN_mp_read_radix #define TclBN_mp_read_radix \ (tclIntStubsPtr->tclBN_mp_read_radix) /* 223 */ #endif #ifndef TclGetPlatform #define TclGetPlatform \ (tclIntStubsPtr->tclGetPlatform) /* 224 */ #endif #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TCLINTDECLS */ |
Changes to generic/tclIntPlatDecls.h.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclIntPlatDecls.h -- * * This file contains the declarations for all platform dependent * unsupported functions that are exported by the Tcl library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclIntPlatDecls.h -- * * This file contains the declarations for all platform dependent * unsupported functions that are exported by the Tcl library. These * interfaces are not guaranteed to remain the same between * versions. Use at your own risk. * * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.26.4.1 2005/06/13 01:46:12 msofer Exp $ */ #ifndef _TCLINTPLATDECLS #define _TCLINTPLATDECLS #undef TCL_STORAGE_CLASS #ifdef BUILD_tcl |
| ︙ | ︙ | |||
245 246 247 248 249 250 251 | EXTERN char * TclpGetTZName _ANSI_ARGS_((int isdst)); #endif #ifndef TclWinNoBackslash_TCL_DECLARED #define TclWinNoBackslash_TCL_DECLARED /* 24 */ EXTERN char * TclWinNoBackslash _ANSI_ARGS_((char * path)); #endif | < < | < < | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | EXTERN char * TclpGetTZName _ANSI_ARGS_((int isdst)); #endif #ifndef TclWinNoBackslash_TCL_DECLARED #define TclWinNoBackslash_TCL_DECLARED /* 24 */ EXTERN char * TclWinNoBackslash _ANSI_ARGS_((char * path)); #endif /* Slot 25 is reserved */ #ifndef TclWinSetInterfaces_TCL_DECLARED #define TclWinSetInterfaces_TCL_DECLARED /* 26 */ EXTERN void TclWinSetInterfaces _ANSI_ARGS_((int wide)); #endif #ifndef TclWinFlushDirtyChannels_TCL_DECLARED #define TclWinFlushDirtyChannels_TCL_DECLARED |
| ︙ | ︙ | |||
344 345 346 347 348 349 350 |
TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 18 */
TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char * fname, int mode)); /* 19 */
void (*tclWinAddProcess) _ANSI_ARGS_((HANDLE hProcess, DWORD id)); /* 20 */
void *reserved21;
TclFile (*tclpCreateTempFile) _ANSI_ARGS_((CONST char * contents)); /* 22 */
char * (*tclpGetTZName) _ANSI_ARGS_((int isdst)); /* 23 */
char * (*tclWinNoBackslash) _ANSI_ARGS_((char * path)); /* 24 */
| | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 18 */
TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char * fname, int mode)); /* 19 */
void (*tclWinAddProcess) _ANSI_ARGS_((HANDLE hProcess, DWORD id)); /* 20 */
void *reserved21;
TclFile (*tclpCreateTempFile) _ANSI_ARGS_((CONST char * contents)); /* 22 */
char * (*tclpGetTZName) _ANSI_ARGS_((int isdst)); /* 23 */
char * (*tclWinNoBackslash) _ANSI_ARGS_((char * path)); /* 24 */
void *reserved25;
void (*tclWinSetInterfaces) _ANSI_ARGS_((int wide)); /* 26 */
void (*tclWinFlushDirtyChannels) _ANSI_ARGS_((void)); /* 27 */
void (*tclWinResetInterfaces) _ANSI_ARGS_((void)); /* 28 */
int (*tclWinCPUID) _ANSI_ARGS_((unsigned int index, unsigned int * regs)); /* 29 */
#endif /* __WIN32__ */
#ifdef MAC_OSX_TCL
int (*tclMacOSXGetFileAttribute) _ANSI_ARGS_((Tcl_Interp * interp, int objIndex, Tcl_Obj * fileName, Tcl_Obj ** attributePtrPtr)); /* 15 */
|
| ︙ | ︙ | |||
516 517 518 519 520 521 522 | #define TclpGetTZName \ (tclIntPlatStubsPtr->tclpGetTZName) /* 23 */ #endif #ifndef TclWinNoBackslash #define TclWinNoBackslash \ (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ #endif | | < < < | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | #define TclpGetTZName \ (tclIntPlatStubsPtr->tclpGetTZName) /* 23 */ #endif #ifndef TclWinNoBackslash #define TclWinNoBackslash \ (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ #endif /* Slot 25 is reserved */ #ifndef TclWinSetInterfaces #define TclWinSetInterfaces \ (tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */ #endif #ifndef TclWinFlushDirtyChannels #define TclWinFlushDirtyChannels \ (tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */ |
| ︙ | ︙ |
Changes to generic/tclInterp.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclInterp.c -- * * This file implements the "interp" command which allows creation * and manipulation of Tcl interpreters from within Tcl scripts. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 2004 Donal K. Fellows * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclInterp.c -- * * This file implements the "interp" command which allows creation * and manipulation of Tcl interpreters from within Tcl scripts. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 2004 Donal K. Fellows * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclInterp.c,v 1.55.2.1 2005/06/13 01:46:12 msofer Exp $ */ #include "tclInt.h" /* * A pointer to a string that holds an initialization script that if non-NULL * is evaluated in Tcl_Init() prior to the built-in initialization script |
| ︙ | ︙ | |||
294 295 296 297 298 299 300 |
*----------------------------------------------------------------------
*/
int
Tcl_Init(interp)
Tcl_Interp *interp; /* Interpreter to initialize. */
{
| < < < < | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
*----------------------------------------------------------------------
*/
int
Tcl_Init(interp)
Tcl_Interp *interp; /* Interpreter to initialize. */
{
if (tclPreInitScript != NULL) {
if (Tcl_Eval(interp, tclPreInitScript) == TCL_ERROR) {
return (TCL_ERROR);
};
}
/*
* In order to find init.tcl during initialization, the following script
|
| ︙ | ︙ | |||
343 344 345 346 347 348 349 | * * The first directory on this path that contains a valid init.tcl script * will be set as the value of tcl_library. * * Note that this entire search mechanism can be bypassed by defining an * alternate tclInit procedure before calling Tcl_Init(). */ | | | < < < < < | > | < | | | | < | < < < < < | | | | | | | | | | | | | | | | > | > > > | > | | | < < > > > > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
*
* The first directory on this path that contains a valid init.tcl script
* will be set as the value of tcl_library.
*
* Note that this entire search mechanism can be bypassed by defining an
* alternate tclInit procedure before calling Tcl_Init().
*/
return Tcl_Eval(interp,
"if {[info proc tclInit]==\"\"} {\n"
" proc tclInit {} {\n"
" global tcl_libPath tcl_library env tclDefaultLibrary\n"
" rename tclInit {}\n"
" if {[info exists tcl_library]} {\n"
" set scripts {{set tcl_library}}\n"
" } else {\n"
" set scripts {}\n"
" if {[info exists env(TCL_LIBRARY)] && ($env(TCL_LIBRARY) ne {})} {\n"
" lappend scripts {set env(TCL_LIBRARY)}\n"
" lappend scripts {\n"
"if {[regexp ^tcl(.*)$ [file tail $env(TCL_LIBRARY)] -> tail] == 0} continue\n"
"if {$tail eq [info tclversion]} continue\n"
"file join [file dirname $env(TCL_LIBRARY)] tcl[info tclversion]}\n"
" }\n"
" if {[info exists tclDefaultLibrary]} {\n"
" lappend scripts {set tclDefaultLibrary}\n"
" } else {\n"
" lappend scripts {::tcl::pkgconfig get scriptdir,runtime}\n"
" }\n"
" lappend scripts {\n"
"set parentDir [file dirname [file dirname [info nameofexecutable]]]\n"
"set grandParentDir [file dirname $parentDir]\n"
"file join $parentDir lib tcl[info tclversion]} \\\n"
" {file join $grandParentDir lib tcl[info tclversion]} \\\n"
" {file join $parentDir library} \\\n"
" {file join $grandParentDir library} \\\n"
" {file join $grandParentDir tcl[info patchlevel] library} \\\n"
" {\n"
"file join [file dirname $grandParentDir] tcl[info patchlevel] library}\n"
" if {[info exists tcl_libPath]\n"
" && [catch {llength $tcl_libPath} len] == 0} {\n"
" for {set i 0} {$i < $len} {incr i} {\n"
" lappend scripts [list lindex \\$tcl_libPath $i]\n"
" }\n"
" }\n"
" }\n"
" set dirs {}\n"
" set errors {}\n"
" foreach script $scripts {\n"
" lappend dirs [eval $script]\n"
" set tcl_library [lindex $dirs end]\n"
" set tclfile [file join $tcl_library init.tcl]\n"
" if {[file exists $tclfile]} {\n"
" if {[catch {uplevel #0 [list source $tclfile]} msg opts]} {\n"
" append errors \"$tclfile: $msg\n\"\n"
" append errors \"[dict get $opts -errorinfo]\n\"\n"
" continue\n"
" }\n"
" unset -nocomplain tclDefaultLibrary\n"
" return\n"
" }\n"
" }\n"
" unset -nocomplain tclDefaultLibrary\n"
" set msg \"Can't find a usable init.tcl in the following directories: \n\"\n"
" append msg \" $dirs\n\n\"\n"
" append msg \"$errors\n\n\"\n"
" append msg \"This probably means that Tcl wasn't installed properly.\n\"\n"
" error $msg\n"
" }\n"
"}\n"
"tclInit");
}
/*
*---------------------------------------------------------------------------
*
* TclInterpInit --
*
|
| ︙ | ︙ |
Changes to generic/tclListObj.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclListObj.c -- * * This file contains procedures that implement the Tcl list object * type. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /* * tclListObj.c -- * * This file contains procedures that implement the Tcl list object * type. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclListObj.c,v 1.20.4.3 2005/06/13 01:46:13 msofer Exp $ */ #include "tclInt.h" /* * Prototypes for procedures defined later in this file: */ static List* NewListIntRep _ANSI_ARGS_((int objc, Tcl_Obj *CONST objv[])); static void DupListInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr, Tcl_Obj *copyPtr)); static void FreeListInternalRep _ANSI_ARGS_((Tcl_Obj *listPtr)); static int SetListFromAny _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr)); static void UpdateStringOfList _ANSI_ARGS_((Tcl_Obj *listPtr)); |
| ︙ | ︙ | |||
42 43 44 45 46 47 48 |
*/
Tcl_ObjType tclListType = {
"list", /* name */
FreeListInternalRep, /* freeIntRepProc */
DupListInternalRep, /* dupIntRepProc */
UpdateStringOfList, /* updateStringProc */
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 |
*/
Tcl_ObjType tclListType = {
"list", /* name */
FreeListInternalRep, /* freeIntRepProc */
DupListInternalRep, /* dupIntRepProc */
UpdateStringOfList, /* updateStringProc */
NULL /* setFromAnyProc */
};
/*
*----------------------------------------------------------------------
*
* NewListIntRep --
*
* If objc>0 and objv!=NULL, this procedure creates a list internal rep
* with objc elements given in the array objv.
* If objc>0 and objv==NULL it creates the list internal rep of a list
* with 0 elements, where enough space has been preallocated to store
* objc elements.
* If objc<=0, it returns NULL.
*
* Results:
* A new List struct is returned. If objc<=0 or if the allocation fails
* for lack of memory, NULL is returned.
* The list returned has refCount 0.
*
* Side effects:
* The ref counts of the elements in objv are incremented since the
* resulting list now refers to them.
*
*----------------------------------------------------------------------
*/
List*
NewListIntRep(objc, objv)
int objc;
Tcl_Obj *CONST objv[];
{
Tcl_Obj **elemPtrs;
List *listRepPtr;
int i;
if (objc <= 0) {
return NULL;
}
/* First check to see if we'd overflow and try to allocate an
* object larger than our memory allocator allows. Note that this
* is actually a fairly small value when you're on a serious
* 64-bit machine, but that requires API changes to fix.
*/
if (objc > INT_MAX/sizeof(Tcl_Obj *)) {
return NULL;
}
listRepPtr = (List *) attemptckalloc(sizeof(List) +
((objc-1) * sizeof(Tcl_Obj *)));
if (listRepPtr == NULL) {
return NULL;
}
listRepPtr->refCount = 0;
listRepPtr->maxElemCount = objc;
if (objv) {
listRepPtr->elemCount = objc;
elemPtrs = &listRepPtr->elements;
for (i = 0; i < objc; i++) {
elemPtrs[i] = objv[i];
Tcl_IncrRefCount(elemPtrs[i]);
}
} else {
listRepPtr->elemCount = 0;
}
return listRepPtr;
}
/*
*----------------------------------------------------------------------
*
* Tcl_NewListObj --
*
* This procedure is normally called when not debugging: i.e., when
|
| ︙ | ︙ | |||
89 90 91 92 93 94 95 |
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_NewListObj(objc, objv)
int objc; /* Count of objects referenced by objv. */
Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
{
| < < | < > | | | | > > > | | | | | < > | < < > | > | | | > | | 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 |
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_NewListObj(objc, objv)
int objc; /* Count of objects referenced by objv. */
Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
{
List *listRepPtr;
Tcl_Obj *listPtr;
TclNewObj(listPtr);
if (objc <= 0) {
return listPtr;
}
/*
* Create the internal rep.
*/
listRepPtr = NewListIntRep(objc, objv);
if (!listRepPtr) {
Tcl_Panic("Not enough memory to create the list\n");
}
/*
* Now create the object.
*/
Tcl_InvalidateStringRep(listPtr);
listPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
listPtr->internalRep.twoPtrValue.ptr2 = NULL;
listPtr->typePtr = &tclListType;
listRepPtr->refCount++;
return listPtr;
}
#endif /* if TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
159 160 161 162 163 164 165 |
int objc; /* Count of objects referenced by objv. */
Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
CONST char *file; /* The name of the source file calling this
* procedure; used for debugging. */
int line; /* Line number in the source file; used
* for debugging. */
{
| | < | < | | | | > > > | | | | | < > | < < > | > | | | > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 |
int objc; /* Count of objects referenced by objv. */
Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
CONST char *file; /* The name of the source file calling this
* procedure; used for debugging. */
int line; /* Line number in the source file; used
* for debugging. */
{
Tcl_Obj *listPtr;
List *listRepPtr;
TclDbNewObj(listPtr, file, line);
if (objc <= 0) {
return listPtr;
}
/*
* Create the internal rep.
*/
listRepPtr = NewListIntRep(objc, objv);
if (!listRepPtr) {
Tcl_Panic("Not enough memory to create the list\n");
}
/*
* Now create the object.
*/
Tcl_InvalidateStringRep(listPtr);
listPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
listPtr->internalRep.twoPtrValue.ptr2 = NULL;
listPtr->typePtr = &tclListType;
listRepPtr->refCount++;
return listPtr;
}
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_DbNewListObj(objc, objv, file, line)
int objc; /* Count of objects referenced by objv. */
Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
CONST char *file; /* The name of the source file calling this
* procedure; used for debugging. */
int line; /* Line number in the source file; used
* for debugging. */
{
return Tcl_NewListObj(objc, objv);
}
#endif /* TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
*
* Tcl_SetListObj --
*
|
| ︙ | ︙ | |||
345 346 347 348 349 350 351 |
void
Tcl_SetListObj(objPtr, objc, objv)
Tcl_Obj *objPtr; /* Object whose internal rep to init. */
int objc; /* Count of objects referenced by objv. */
Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
{
| < | < < < < < < < | < | < < > | > | 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 |
void
Tcl_SetListObj(objPtr, objc, objv)
Tcl_Obj *objPtr; /* Object whose internal rep to init. */
int objc; /* Count of objects referenced by objv. */
Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
{
List *listRepPtr;
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetListObj called with shared object");
}
/*
* Free any old string rep and any internal rep for the old type.
*/
TclFreeIntRep(objPtr);
objPtr->typePtr = NULL;
Tcl_InvalidateStringRep(objPtr);
/*
* Set the object's type to "list" and initialize the internal rep.
* However, if there are no elements to put in the list, just give
* the object an empty string rep and a NULL type.
*/
if (objc > 0) {
listRepPtr = NewListIntRep(objc, objv);
if (!listRepPtr) {
Tcl_Panic("Cannot allocate enough memory for Tcl_SetListObj");
}
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
objPtr->internalRep.twoPtrValue.ptr2 = NULL;
objPtr->typePtr = &tclListType;
listRepPtr->refCount++;
} else {
objPtr->bytes = tclEmptyStringRep;
objPtr->length = 0;
}
}
/*
|
| ︙ | ︙ | |||
432 433 434 435 436 437 438 |
* referenced by objv. */
Tcl_Obj ***objvPtr; /* Where to store the pointer to an array
* of pointers to the list's objects. */
{
register List *listRepPtr;
if (listPtr->typePtr != &tclListType) {
| > > > > > > > > > | | | 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 |
* referenced by objv. */
Tcl_Obj ***objvPtr; /* Where to store the pointer to an array
* of pointers to the list's objects. */
{
register List *listRepPtr;
if (listPtr->typePtr != &tclListType) {
int result, length;
(void) Tcl_GetStringFromObj(listPtr, &length);
if (!length) {
*objcPtr = 0;
*objvPtr = NULL;
return TCL_OK;
}
result = SetListFromAny(interp, listPtr);
if (result != TCL_OK) {
return result;
}
}
listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
*objcPtr = listRepPtr->elemCount;
*objvPtr = &listRepPtr->elements;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_ListObjAppendList --
|
| ︙ | ︙ | |||
475 476 477 478 479 480 481 |
int
Tcl_ListObjAppendList(interp, listPtr, elemListPtr)
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. */
{
| < | | | | | < < < | 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 |
int
Tcl_ListObjAppendList(interp, listPtr, elemListPtr)
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. */
{
int listLen, objc, result;
Tcl_Obj **objv;
if (Tcl_IsShared(listPtr)) {
Tcl_Panic("Tcl_ListObjAppendList called with shared object");
}
result = Tcl_ListObjLength(interp, listPtr, &listLen);
if (result != TCL_OK) {
return result;
}
result = Tcl_ListObjGetElements(interp, elemListPtr, &objc, &objv);
if (result != TCL_OK) {
return result;
}
/*
|
| ︙ | ︙ | |||
539 540 541 542 543 544 545 |
Tcl_ListObjAppendElement(interp, listPtr, objPtr)
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;
register Tcl_Obj **elemPtrs;
| | > > > > > > > > | < | > | | > > > > > > > > | | > > > | > | | > > | > | | > > | | > > | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
Tcl_ListObjAppendElement(interp, listPtr, objPtr)
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;
register Tcl_Obj **elemPtrs;
int numElems, numRequired, newMax, newSize, i;
if (Tcl_IsShared(listPtr)) {
Tcl_Panic("Tcl_ListObjAppendElement called with shared object");
}
if (listPtr->typePtr != &tclListType) {
int result, length;
(void) Tcl_GetStringFromObj(listPtr, &length);
if (!length) {
Tcl_SetListObj(listPtr, 1, &objPtr);
return TCL_OK;
}
result = SetListFromAny(interp, listPtr);
if (result != TCL_OK) {
return result;
}
}
listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
numElems = listRepPtr->elemCount;
numRequired = numElems + 1 ;
/*
* If there is no room in the current array of element pointers,
* allocate a new, larger array and copy the pointers to it. If the
* List struct is shared, allocate a new one.
*/
if (numRequired > listRepPtr->maxElemCount){
newMax = (2 * numRequired);
newSize = sizeof(List)+((newMax-1)*sizeof(Tcl_Obj*));
} else {
newMax = listRepPtr->maxElemCount;
newSize = 0;
}
if (listRepPtr->refCount > 1) {
List *oldListRepPtr = listRepPtr;
Tcl_Obj **oldElems;
listRepPtr = NewListIntRep(newMax, NULL);
if (!listRepPtr) {
Tcl_Panic("Not enough memory to allocate list");
}
oldElems = &oldListRepPtr->elements;
elemPtrs = &listRepPtr->elements;
for (i=0; i<numElems; i++) {
elemPtrs[i] = oldElems[i];
Tcl_IncrRefCount(elemPtrs[i]);
}
listRepPtr->elemCount = numElems;
listRepPtr->refCount++;
oldListRepPtr->refCount--;
listPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
} else if (newSize) {
listRepPtr = (List *) ckrealloc((char *)listRepPtr, newSize);
listRepPtr->maxElemCount = newMax;
listPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
}
/*
* Add objPtr to the end of listPtr's array of element
* pointers. Increment the ref count for the (now shared) objPtr.
*/
elemPtrs = &listRepPtr->elements;
elemPtrs[numElems] = objPtr;
Tcl_IncrRefCount(objPtr);
listRepPtr->elemCount++;
/*
* Invalidate any old string representation since the list's internal
* representation has changed.
|
| ︙ | ︙ | |||
629 630 631 632 633 634 635 |
register Tcl_Obj *listPtr; /* List object to index into. */
register int index; /* Index of element to return. */
Tcl_Obj **objPtrPtr; /* The resulting Tcl_Obj* is stored here. */
{
register List *listRepPtr;
if (listPtr->typePtr != &tclListType) {
| > > > > > > > > | | | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
register Tcl_Obj *listPtr; /* List object to index into. */
register int index; /* Index of element to return. */
Tcl_Obj **objPtrPtr; /* The resulting Tcl_Obj* is stored here. */
{
register List *listRepPtr;
if (listPtr->typePtr != &tclListType) {
int result, length;
(void) Tcl_GetStringFromObj(listPtr, &length);
if (!length) {
*objPtrPtr = NULL;
return TCL_OK;
}
result = SetListFromAny(interp, listPtr);
if (result != TCL_OK) {
return result;
}
}
listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
if ((index < 0) || (index >= listRepPtr->elemCount)) {
*objPtrPtr = NULL;
} else {
*objPtrPtr = (&listRepPtr->elements)[index];
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
676 677 678 679 680 681 682 |
Tcl_Interp *interp; /* Used to report errors if not NULL. */
register Tcl_Obj *listPtr; /* List object whose #elements to return. */
register int *intPtr; /* The resulting int is stored here. */
{
register List *listRepPtr;
if (listPtr->typePtr != &tclListType) {
| > > > > > > > > | | 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
Tcl_Interp *interp; /* Used to report errors if not NULL. */
register Tcl_Obj *listPtr; /* List object whose #elements to return. */
register int *intPtr; /* The resulting int is stored here. */
{
register List *listRepPtr;
if (listPtr->typePtr != &tclListType) {
int result, length;
(void) Tcl_GetStringFromObj(listPtr, &length);
if (!length) {
*intPtr = 0;
return TCL_OK;
}
result = SetListFromAny(interp, listPtr);
if (result != TCL_OK) {
return result;
}
}
listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
*intPtr = listRepPtr->elemCount;
|
| ︙ | ︙ | |||
736 737 738 739 740 741 742 |
int first; /* Index of first element to replace. */
int count; /* Number of elements to replace. */
int objc; /* Number of objects to insert. */
Tcl_Obj *CONST objv[]; /* An array of objc pointers to Tcl objects
* to insert. */
{
List *listRepPtr;
| | > | > > > > > > > > > > | | | | | > > | > > > > | > | | < < < < < < < < < < < < < < < | | > > > > | > > > | > > > > | > > > > > | > > > | > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > | | < | | | | | | | < < > | < > | > | | 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 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 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 |
int first; /* Index of first element to replace. */
int count; /* Number of elements to replace. */
int objc; /* Number of objects to insert. */
Tcl_Obj *CONST objv[]; /* An array of objc pointers to Tcl objects
* to insert. */
{
List *listRepPtr;
register Tcl_Obj **elemPtrs;
Tcl_Obj *victimPtr;
int numElems, numRequired, numAfterLast;
int start, shift, newMax, i, j, result;
int isShared;
if (Tcl_IsShared(listPtr)) {
Tcl_Panic("Tcl_ListObjReplace called with shared object");
}
if (listPtr->typePtr != &tclListType) {
int length;
(void) Tcl_GetStringFromObj(listPtr, &length);
if (!length) {
if (objc) {
Tcl_SetListObj(listPtr, objc, NULL);
} else {
return TCL_OK;
}
} else {
result = SetListFromAny(interp, listPtr);
if (result != TCL_OK) {
return result;
}
}
}
listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
elemPtrs = &listRepPtr->elements;
numElems = listRepPtr->elemCount;
if (first < 0) {
first = 0;
}
if (first >= numElems) {
first = numElems; /* so we'll insert after last element */
}
if (count < 0) {
count = 0;
} else if (numElems < first+count) {
count = numElems - first;
}
isShared = (listRepPtr->refCount > 1);
numRequired = (numElems - count + objc);
if ((numRequired <= listRepPtr->maxElemCount)
&& !isShared) {
/*
* Can use the current List struct. First "delete" count
* elements starting at first.
*/
for (j = first; j < first + count; j++) {
victimPtr = elemPtrs[j];
TclDecrRefCount(victimPtr);
}
/*
* Shift the elements after the last one removed to their
* new locations.
*/
start = (first + count);
numAfterLast = (numElems - start);
shift = (objc - count); /* numNewElems - numDeleted */
if ((numAfterLast > 0) && (shift != 0)) {
Tcl_Obj **src, **dst;
src = elemPtrs + start; dst = src + shift;
memmove((VOID*) dst, (VOID*) src,
(size_t) (numAfterLast * sizeof(Tcl_Obj*)));
}
} else {
/*
* Cannot use the current List struct - it is shared, too small,
* or both. Allocate a new struct and insert elements into it.
*/
List *oldListRepPtr = listRepPtr;
Tcl_Obj **oldPtrs = elemPtrs;
if (numRequired > listRepPtr->maxElemCount){
newMax = (2 * numRequired);
} else {
newMax = listRepPtr->maxElemCount;
}
listRepPtr = NewListIntRep(newMax, NULL);
if (!listRepPtr) {
Tcl_Panic("Not enough memory to allocate list");
}
listPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
listRepPtr->refCount++;
elemPtrs = &listRepPtr->elements;
if (isShared) {
/*
* The old struct will remain in place; need new refCounts for the
* new List struct references. Copy over only the surviving elements.
*/
for (i=0; i < first; i++) {
elemPtrs[i] = oldPtrs[i];
Tcl_IncrRefCount(elemPtrs[i]);
}
for (i= first + count, j = first + objc;
j < numRequired; i++, j++) {
elemPtrs[j] = oldPtrs[i];
Tcl_IncrRefCount(elemPtrs[j]);
}
oldListRepPtr->refCount--;
} else {
/*
* The old struct will be removed; use its inherited refCounts.
*/
if (first > 0) {
memcpy((VOID *) elemPtrs, (VOID *) oldPtrs,
(size_t) (first * sizeof(Tcl_Obj *)));
}
/*
* "Delete" count elements starting at first.
*/
for (j = first; j < first + count; j++) {
victimPtr = oldPtrs[j];
TclDecrRefCount(victimPtr);
}
/*
* Copy the elements after the last one removed, shifted to
* their new locations.
*/
start = (first + count);
numAfterLast = (numElems - start);
if (numAfterLast > 0) {
memcpy((VOID *) &(elemPtrs[first + objc]),
(VOID *) &(oldPtrs[start]),
(size_t) (numAfterLast * sizeof(Tcl_Obj *)));
}
ckfree((char *) oldListRepPtr);
}
}
/*
* Insert the new elements into elemPtrs before "first".
*/
for (i=0,j=first ; i<objc ; i++,j++) {
elemPtrs[j] = objv[i];
Tcl_IncrRefCount(objv[i]);
}
/*
* Update the count of elements.
*/
listRepPtr->elemCount = numRequired;
/*
* Invalidate and free any old string representation since it no longer
* reflects the list's internal representation.
*/
Tcl_InvalidateStringRep(listPtr);
return TCL_OK;
|
| ︙ | ︙ | |||
928 929 930 931 932 933 934 |
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' */
{
int indexCount; /* Number of indices in the index list */
Tcl_Obj** indices; /* Vector of indices in the index list*/
| < < < < < < < < > | | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 |
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' */
{
int indexCount; /* Number of indices in the index list */
Tcl_Obj** indices; /* Vector of indices in the index list*/
Tcl_Obj* retValuePtr; /* Pointer to the list to be returned */
int index; /* Current index in the list - discarded */
int i;
List *indexListRepPtr;
/*
* Determine whether the index arg designates a list or a single
* index. We have to be careful about the order of the checks to
* avoid repeated shimmering; see TIP #22 and #23 for details.
*/
if (indexArgPtr->typePtr != &tclListType
|
| ︙ | ︙ | |||
967 968 969 970 971 972 973 |
return TclLsetFlat(interp, listPtr, 1, &indexArgPtr, valuePtr);
}
/*
* At this point, we know that argPtr designates a well formed list,
* and the 'else if' above has parsed it into indexCount and indices.
| | | > | < < < | < < < | < < < < < < | < < < < < < < < < | < < < < | < < < < | < < < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | < < < < | < < | | < < < < < < < < < < < < < < | < < < < | < < < | < < < | < < | | < < | < | < < < < < < < < < < < < | < < < < < < < < | 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 |
return TclLsetFlat(interp, listPtr, 1, &indexArgPtr, valuePtr);
}
/*
* At this point, we know that argPtr designates a well formed list,
* and the 'else if' above has parsed it into indexCount and indices.
* Increase the reference count of the internal rep of indexArgPtr,
* in order to insure the validity of pointers even if indexArgPtr
* shimmers to another type.
*/
if (indexCount) {
indexListRepPtr = (List *) indexArgPtr->internalRep.twoPtrValue.ptr1;
indexListRepPtr->refCount++;
} else {
indexListRepPtr = NULL; /* avoid compiler warning*/
}
/*
* Let TclLsetFlat handle the actual lset'ting.
*/
retValuePtr = TclLsetFlat(interp, listPtr, indexCount, indices, valuePtr);
/*
* If we are the only users of indexListRepPtr, we free it before
* returning.
*/
if (indexCount) {
if (--indexListRepPtr->refCount <= 0) {
for (i=0; i<indexCount; i++) {
Tcl_DecrRefCount(indices[i]);
}
ckfree((char *) indexListRepPtr);
}
}
return retValuePtr;
}
/*
*----------------------------------------------------------------------
*
* TclLsetFlat --
*
|
| ︙ | ︙ | |||
1196 1197 1198 1199 1200 1201 1202 |
Tcl_Obj* subListPtr; /* Pointer to the current sublist */
int index; /* Index of the element to replace in the
* current sublist */
Tcl_Obj* chainPtr; /* Pointer to the enclosing list of
* the current sublist. */
int result; /* Status return from library calls */
int i;
| | | 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 |
Tcl_Obj* subListPtr; /* Pointer to the current sublist */
int index; /* Index of the element to replace in the
* current sublist */
Tcl_Obj* chainPtr; /* Pointer to the enclosing list of
* the current sublist. */
int result; /* Status return from library calls */
int i;
/*
* If there are no indices, then simply return the new value,
* counting the returned pointer as a reference
*/
if (indexCount == 0) {
Tcl_IncrRefCount(valuePtr);
|
| ︙ | ︙ | |||
1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 |
/*
* Take the sublist apart.
*/
result = Tcl_ListObjGetElements(interp, listPtr, &elemCount, &elemPtrs);
if (result != TCL_OK) {
break;
}
listPtr->internalRep.twoPtrValue.ptr2 = (VOID *) chainPtr;
/*
* Determine the index of the requested element.
*/
| > > > > > > | 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 |
/*
* Take the sublist apart.
*/
result = Tcl_ListObjGetElements(interp, listPtr, &elemCount, &elemPtrs);
if (result != TCL_OK) {
break;
}
if (elemCount == 0) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("list index out of range", -1));
result = TCL_ERROR;
break;
}
listPtr->internalRep.twoPtrValue.ptr2 = (VOID *) chainPtr;
/*
* Determine the index of the requested element.
*/
|
| ︙ | ︙ | |||
1354 1355 1356 1357 1358 1359 1360 | * listLength is the count of elements in the list object designated * by listPtr, TCL_ERROR is returned and an error message is left * in the interpreter result. * * Side effects: * * Tcl_Panic if listPtr designates a shared object. Otherwise, | | | | | | 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | * listLength is the count of elements in the list object designated * by listPtr, TCL_ERROR is returned and an error message is left * in the interpreter result. * * Side effects: * * Tcl_Panic if listPtr designates a shared object. Otherwise, * attempts to convert it to a list with a non-shared internal rep. * Decrements the ref count of the object at the specified index within * the list, replaces with the object designated by valuePtr, and * increments the ref count of the replacement object. * * It is the caller's responsibility to invalidate the string * representation of the object. * *---------------------------------------------------------------------- */ |
| ︙ | ︙ | |||
1380 1381 1382 1383 1384 1385 1386 |
* list element */
{
int result; /* Return value from this function */
List* listRepPtr; /* Internal representation of the list
* being modified */
Tcl_Obj** elemPtrs; /* Pointers to elements of the list */
int elemCount; /* Number of elements in the list */
| > | > > > > > > > > > < > | > > > > > > > > > > > > > > > > > > > > | 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 |
* list element */
{
int result; /* Return value from this function */
List* listRepPtr; /* Internal representation of the list
* being modified */
Tcl_Obj** elemPtrs; /* Pointers to elements of the list */
int elemCount; /* Number of elements in the list */
int i;
/* Ensure that the listPtr parameter designates an unshared list */
if (Tcl_IsShared(listPtr)) {
Tcl_Panic("Tcl_ListObjSetElement called with shared object");
}
if (listPtr->typePtr != &tclListType) {
int length;
(void) Tcl_GetStringFromObj(listPtr, &length);
if (!length) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("list index out of range", -1));
return TCL_ERROR;
}
result = SetListFromAny(interp, listPtr);
if (result != TCL_OK) {
return result;
}
}
listRepPtr = (List*) listPtr->internalRep.twoPtrValue.ptr1;
elemCount = listRepPtr->elemCount;
elemPtrs = &listRepPtr->elements;
/* Ensure that the index is in bounds. */
if (index<0 || index>=elemCount) {
if (interp != NULL) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("list index out of range", -1));
return TCL_ERROR;
}
}
/*
* If the internal rep is shared, replace it with an unshared copy.
*/
if (listRepPtr->refCount > 1) {
List *oldListRepPtr = listRepPtr;
Tcl_Obj **oldElemPtrs = elemPtrs;
listRepPtr = NewListIntRep(listRepPtr->maxElemCount, NULL);
elemPtrs = &listRepPtr->elements;
for (i=0; i < elemCount; i++) {
elemPtrs[i] = oldElemPtrs[i];
Tcl_IncrRefCount(elemPtrs[i]);
}
listRepPtr->refCount++;
listRepPtr->elemCount = elemCount;
listPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
oldListRepPtr->refCount--;
}
/* Add a reference to the new list element */
Tcl_IncrRefCount(valuePtr);
/* Remove a reference from the old list element */
|
| ︙ | ︙ | |||
1445 1446 1447 1448 1449 1450 1451 |
*/
static void
FreeListInternalRep(listPtr)
Tcl_Obj *listPtr; /* List object with internal rep to free. */
{
register List *listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
| | > | | | | < | | > | | | < < < < < | < < < < < < < < < < < < < < < < < < < < | < < < | | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 |
*/
static void
FreeListInternalRep(listPtr)
Tcl_Obj *listPtr; /* List object with internal rep to free. */
{
register List *listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
register Tcl_Obj **elemPtrs = &listRepPtr->elements;
register Tcl_Obj *objPtr;
int numElems = listRepPtr->elemCount;
int i;
if (--listRepPtr->refCount <= 0) {
for (i = 0; i < numElems; i++) {
objPtr = elemPtrs[i];
Tcl_DecrRefCount(objPtr);
}
ckfree((char *) listRepPtr);
}
listPtr->internalRep.twoPtrValue.ptr1 = NULL;
listPtr->internalRep.twoPtrValue.ptr2 = NULL;
}
/*
*----------------------------------------------------------------------
*
* DupListInternalRep --
*
* Initialize the internal representation of a list Tcl_Obj to share
* the internal representation of an existing list object.
*
* Results:
* None.
*
* Side effects:
* The reference count of the List internal rep is incremented.
*
*----------------------------------------------------------------------
*/
static void
DupListInternalRep(srcPtr, copyPtr)
Tcl_Obj *srcPtr; /* Object with internal rep to copy. */
Tcl_Obj *copyPtr; /* Object with internal rep to set. */
{
List *listRepPtr = (List *) srcPtr->internalRep.twoPtrValue.ptr1;
listRepPtr->refCount++;
copyPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
copyPtr->internalRep.twoPtrValue.ptr2 = NULL;
copyPtr->typePtr = &tclListType;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1583 1584 1585 1586 1587 1588 1589 |
/*
* Allocate a new List structure with enough room for "estCount"
* elements. Each element is a pointer to a Tcl_Obj with the appropriate
* string rep. The initial "estCount" elements are set using the
* corresponding "argv" strings.
*/
| > > > > > > | | | | 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 1525 1526 1527 1528 1529 1530 1531 |
/*
* Allocate a new List structure with enough room for "estCount"
* elements. Each element is a pointer to a Tcl_Obj with the appropriate
* string rep. The initial "estCount" elements are set using the
* corresponding "argv" strings.
*/
listRepPtr = NewListIntRep(estCount, NULL);
if(!listRepPtr) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("Not enough memory to allocate the list internal rep",-1));
return TCL_ERROR;
}
elemPtrs = &listRepPtr->elements;
for (p = string, lenRemain = length, i = 0;
lenRemain > 0;
p = nextElem, lenRemain = (limit - nextElem), i++) {
result = TclFindElement(interp, p, lenRemain, &elemStart, &nextElem,
&elemSize, &hasBrace);
if (result != TCL_OK) {
for (j = 0; j < i; j++) {
elemPtr = elemPtrs[j];
Tcl_DecrRefCount(elemPtr);
}
ckfree((char *) listRepPtr);
return result;
}
if (elemStart >= limit) {
break;
}
if (i > estCount) {
Tcl_Panic("SetListFromAny: bad size estimate for list");
|
| ︙ | ︙ | |||
1625 1626 1627 1628 1629 1630 1631 |
TclNewObj(elemPtr);
elemPtr->bytes = s;
elemPtr->length = elemSize;
elemPtrs[i] = elemPtr;
Tcl_IncrRefCount(elemPtr); /* since list now holds ref to it */
}
| < < < > | 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 |
TclNewObj(elemPtr);
elemPtr->bytes = s;
elemPtr->length = elemSize;
elemPtrs[i] = elemPtr;
Tcl_IncrRefCount(elemPtr); /* since list now holds ref to it */
}
listRepPtr->elemCount = i;
/*
* Free the old internalRep before setting the new one. We do this as
* late as possible to allow the conversion code, in particular
* Tcl_GetStringFromObj, to use that old internalRep.
*/
listRepPtr->refCount++;
TclFreeIntRep(objPtr);
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
objPtr->internalRep.twoPtrValue.ptr2 = NULL;
objPtr->typePtr = &tclListType;
return TCL_OK;
}
|
| ︙ | ︙ | |||
1675 1676 1677 1678 1679 1680 1681 |
# define LOCAL_SIZE 20
int localFlags[LOCAL_SIZE], *flagPtr;
List *listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
int numElems = listRepPtr->elemCount;
register int i;
char *elem, *dst;
int length;
| > | > | | | 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 |
# define LOCAL_SIZE 20
int localFlags[LOCAL_SIZE], *flagPtr;
List *listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
int numElems = listRepPtr->elemCount;
register int i;
char *elem, *dst;
int length;
Tcl_Obj **elemPtrs;
/*
* Convert each element of the list to string form and then convert it
* to proper list element form, adding it to the result buffer.
*/
/*
* Pass 1: estimate space, gather flags.
*/
if (numElems <= LOCAL_SIZE) {
flagPtr = localFlags;
} else {
flagPtr = (int *) ckalloc((unsigned) numElems*sizeof(int));
}
listPtr->length = 1;
elemPtrs = &listRepPtr->elements;
for (i = 0; i < numElems; i++) {
elem = Tcl_GetStringFromObj(elemPtrs[i], &length);
listPtr->length += Tcl_ScanCountedElement(elem, length,
&flagPtr[i]) + 1;
}
/*
* Pass 2: copy into string rep buffer.
*/
listPtr->bytes = ckalloc((unsigned) listPtr->length);
dst = listPtr->bytes;
for (i = 0; i < numElems; i++) {
elem = Tcl_GetStringFromObj(elemPtrs[i], &length);
dst += Tcl_ConvertCountedElement(elem, length, dst,
flagPtr[i] | (i==0 ? 0 : TCL_DONT_QUOTE_HASH));
*dst = ' ';
dst++;
}
if (flagPtr != localFlags) {
ckfree((char *) flagPtr);
|
| ︙ | ︙ |
Changes to generic/tclLiteral.c.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | * * Copyright (c) 1997-1998 Sun Microsystems, Inc. * Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * * Copyright (c) 1997-1998 Sun Microsystems, Inc. * Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclLiteral.c,v 1.21.2.1 2005/06/13 01:46:13 msofer Exp $ */ #include "tclInt.h" #include "tclCompile.h" /* * When there are this many entries per bucket, on average, rebuild * a literal's hash table to make it larger. |
| ︙ | ︙ | |||
266 267 268 269 270 271 272 |
Interp *iPtr = envPtr->iPtr;
LiteralTable *globalTablePtr = &(iPtr->literalTable);
LiteralTable *localTablePtr = &(envPtr->localLitTable);
register LiteralEntry *globalPtr, *localPtr;
register Tcl_Obj *objPtr;
unsigned int hash;
int localHash, globalHash, objIndex;
| < < | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
Interp *iPtr = envPtr->iPtr;
LiteralTable *globalTablePtr = &(iPtr->literalTable);
LiteralTable *localTablePtr = &(envPtr->localLitTable);
register LiteralEntry *globalPtr, *localPtr;
register Tcl_Obj *objPtr;
unsigned int hash;
int localHash, globalHash, objIndex;
Namespace *nsPtr;
if (length < 0) {
length = (bytes? strlen(bytes) : 0);
}
hash = HashString(bytes, length);
|
| ︙ | ︙ | |||
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 |
if (flags & LITERAL_ON_HEAP) {
objPtr->bytes = bytes;
objPtr->length = length;
} else {
TclInitStringRep(objPtr, bytes, length);
}
if (TclLooksLikeInt(bytes, length)) {
/*
* From here we use the objPtr, because it is NULL terminated
*/
if (TclGetLong((Tcl_Interp *) NULL, objPtr->bytes, &n) == TCL_OK) {
TclFormatInt(buf, n);
if (strcmp(objPtr->bytes, buf) == 0) {
objPtr->internalRep.longValue = n;
objPtr->typePtr = &tclIntType;
}
}
}
#ifdef TCL_COMPILE_DEBUG
if (TclLookupLiteralEntry((Tcl_Interp *) iPtr, objPtr) != NULL) {
Tcl_Panic("TclRegisterLiteral: literal \"%.*s\" found globally but shouldn't be",
(length>60? 60 : length), bytes);
}
#endif
| > > > > | 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 |
if (flags & LITERAL_ON_HEAP) {
objPtr->bytes = bytes;
objPtr->length = length;
} else {
TclInitStringRep(objPtr, bytes, length);
}
#if 0
if (TclLooksLikeInt(bytes, length)) {
/*
* From here we use the objPtr, because it is NULL terminated
*/
long n;
char buf[TCL_INTEGER_SPACE];
if (TclGetLong((Tcl_Interp *) NULL, objPtr->bytes, &n) == TCL_OK) {
TclFormatInt(buf, n);
if (strcmp(objPtr->bytes, buf) == 0) {
objPtr->internalRep.longValue = n;
objPtr->typePtr = &tclIntType;
}
}
}
#endif
#ifdef TCL_COMPILE_DEBUG
if (TclLookupLiteralEntry((Tcl_Interp *) iPtr, objPtr) != NULL) {
Tcl_Panic("TclRegisterLiteral: literal \"%.*s\" found globally but shouldn't be",
(length>60? 60 : length), bytes);
}
#endif
|
| ︙ | ︙ |
Changes to generic/tclNamesp.c.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 | * Michael J. McLennan * Bell Labs Innovations for Lucent Technologies * mmclennan@lucent.com * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | * Michael J. McLennan * Bell Labs Innovations for Lucent Technologies * mmclennan@lucent.com * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclNamesp.c,v 1.71.2.2 2005/06/13 01:46:13 msofer Exp $ */ #include "tclInt.h" /* * Initial size of stack allocated space for tail list - used when resetting * shadowed command references in the functin: TclResetShadowedCmdRefs. |
| ︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 | } EnsembleCmdRep; /* * Declarations for procedures local to this file: */ static void DeleteImportedCmd _ANSI_ARGS_((ClientData clientData)); static void DupNsNameInternalRep _ANSI_ARGS_((Tcl_Obj *objPtr, Tcl_Obj *copyPtr)); static char * ErrorCodeRead _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, CONST char *name1, CONST char *name2, int flags)); static char * ErrorInfoRead _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, CONST char *name1, | > > > > | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | } EnsembleCmdRep; /* * Declarations for procedures local to this file: */ static void DeleteImportedCmd _ANSI_ARGS_((ClientData clientData)); static int DoImport _ANSI_ARGS_((Tcl_Interp *interp, Namespace *nsPtr, Tcl_HashEntry *hPtr, CONST char *cmdName, CONST char *pattern, Namespace *importNsPtr, int allowOverwrite)); static void DupNsNameInternalRep _ANSI_ARGS_((Tcl_Obj *objPtr, Tcl_Obj *copyPtr)); static char * ErrorCodeRead _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, CONST char *name1, CONST char *name2, int flags)); static char * ErrorInfoRead _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp, CONST char *name1, |
| ︙ | ︙ | |||
234 235 236 237 238 239 240 241 242 243 244 245 246 247 | int objc, Tcl_Obj *CONST objv[])); static int NamespaceOriginCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespaceParentCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespaceQualifiersCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespaceTailCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespaceWhichCmd _ANSI_ARGS_(( | > > > | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | int objc, Tcl_Obj *CONST objv[])); static int NamespaceOriginCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespaceParentCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespacePathCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespaceQualifiersCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespaceTailCmd _ANSI_ARGS_(( ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int NamespaceWhichCmd _ANSI_ARGS_(( |
| ︙ | ︙ | |||
262 263 264 265 266 267 268 269 270 271 272 273 274 275 | static void MakeCachedEnsembleCommand _ANSI_ARGS_(( Tcl_Obj *objPtr, EnsembleConfig *ensemblePtr, CONST char *subcmdName, Tcl_Obj *prefixObjPtr)); static void FreeEnsembleCmdRep _ANSI_ARGS_((Tcl_Obj *objPtr)); static void DupEnsembleCmdRep _ANSI_ARGS_((Tcl_Obj *objPtr, Tcl_Obj *copyPtr)); static void StringOfEnsembleCmdRep _ANSI_ARGS_((Tcl_Obj *objPtr)); /* * This structure defines a Tcl object type that contains a * namespace reference. It is used in commands that take the * name of a namespace as an argument. The namespace reference * is resolved, and the result in cached in the object. */ | > > > | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | static void MakeCachedEnsembleCommand _ANSI_ARGS_(( Tcl_Obj *objPtr, EnsembleConfig *ensemblePtr, CONST char *subcmdName, Tcl_Obj *prefixObjPtr)); static void FreeEnsembleCmdRep _ANSI_ARGS_((Tcl_Obj *objPtr)); static void DupEnsembleCmdRep _ANSI_ARGS_((Tcl_Obj *objPtr, Tcl_Obj *copyPtr)); static void StringOfEnsembleCmdRep _ANSI_ARGS_((Tcl_Obj *objPtr)); static void UnlinkNsPath _ANSI_ARGS_((Namespace *nsPtr)); static void SetNsPath _ANSI_ARGS_((Namespace *nsPtr, int pathLength, Tcl_Namespace *pathAry[])); /* * This structure defines a Tcl object type that contains a * namespace reference. It is used in commands that take the * name of a namespace as an argument. The namespace reference * is resolved, and the result in cached in the object. */ |
| ︙ | ︙ | |||
285 286 287 288 289 290 291 | /* * This structure defines a Tcl object type that contains a reference * to an ensemble subcommand (e.g. the "length" in [string length ab]) * It is used to cache the mapping between the subcommand itself and * the real command that implements it. */ | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
/*
* This structure defines a Tcl object type that contains a reference
* to an ensemble subcommand (e.g. the "length" in [string length ab])
* It is used to cache the mapping between the subcommand itself and
* the real command that implements it.
*/
static Tcl_ObjType ensembleCmdType = {
"ensembleCommand", /* the type's name */
FreeEnsembleCmdRep, /* freeIntRepProc */
DupEnsembleCmdRep, /* dupIntRepProc */
StringOfEnsembleCmdRep, /* updateStringProc */
NULL /* setFromAnyProc */
};
|
| ︙ | ︙ | |||
825 826 827 828 829 830 831 |
Tcl_InitHashTable(&nsPtr->childTable, TCL_STRING_KEYS);
nsPtr->nsId = ++(tsdPtr->numNsCreated);
nsPtr->interp = interp;
nsPtr->flags = 0;
nsPtr->activationCount = 0;
nsPtr->refCount = 0;
Tcl_InitHashTable(&nsPtr->cmdTable, TCL_STRING_KEYS);
| | > > > > | 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 |
Tcl_InitHashTable(&nsPtr->childTable, TCL_STRING_KEYS);
nsPtr->nsId = ++(tsdPtr->numNsCreated);
nsPtr->interp = interp;
nsPtr->flags = 0;
nsPtr->activationCount = 0;
nsPtr->refCount = 0;
Tcl_InitHashTable(&nsPtr->cmdTable, TCL_STRING_KEYS);
Tcl_InitHashTable((Tcl_HashTable *)&nsPtr->varTable, TCL_STRING_KEYS);
nsPtr->varTable.nsPtr = nsPtr;
nsPtr->exportArrayPtr = NULL;
nsPtr->numExportPatterns = 0;
nsPtr->maxExportPatterns = 0;
nsPtr->cmdRefEpoch = 0;
nsPtr->resolverEpoch = 0;
nsPtr->cmdResProc = NULL;
nsPtr->varResProc = NULL;
nsPtr->compiledVarResProc = NULL;
nsPtr->exportLookupEpoch = 0;
nsPtr->ensembles = NULL;
nsPtr->commandPathLength = 0;
nsPtr->commandPathArray = NULL;
nsPtr->commandPathSourceList = NULL;
if (parentPtr != NULL) {
entryPtr = Tcl_CreateHashEntry(&parentPtr->childTable, simpleName,
&newEntry);
Tcl_SetHashValue(entryPtr, (ClientData) nsPtr);
} else {
/*
|
| ︙ | ︙ | |||
976 977 978 979 980 981 982 | /* * If this is the global namespace, then it may have residual * "errorInfo" and "errorCode" variables for errors that * occurred while it was being torn down. Try to clear the * variable list one last time. */ | | | 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | /* * If this is the global namespace, then it may have residual * "errorInfo" and "errorCode" variables for errors that * occurred while it was being torn down. Try to clear the * variable list one last time. */ TclDeleteVars((Interp *) nsPtr->interp, (Tcl_HashTable *)&nsPtr->varTable); Tcl_DeleteHashTable(&nsPtr->childTable); Tcl_DeleteHashTable(&nsPtr->cmdTable); /* * If the reference count is 0, then discard the namespace. * Otherwise, mark it as "dead" so that it can't be used. |
| ︙ | ︙ | |||
1040 1041 1042 1043 1044 1045 1046 |
/*
* Start by destroying the namespace's variable table,
* since variables might trigger traces.
* Variable table should be cleared but not freed!
* TclDeleteVars frees it, so we reinitialize it afterwards.
*/
| | | > > > > > > > > > > > > > > > > > | 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 |
/*
* Start by destroying the namespace's variable table,
* since variables might trigger traces.
* Variable table should be cleared but not freed!
* TclDeleteVars frees it, so we reinitialize it afterwards.
*/
TclDeleteVars(iPtr, (Tcl_HashTable *)&nsPtr->varTable);
Tcl_InitHashTable((Tcl_HashTable *)&nsPtr->varTable, TCL_STRING_KEYS);
nsPtr->varTable.nsPtr = nsPtr;
/*
* Remove the namespace from its parent's child hashtable.
*/
if (nsPtr->parentPtr != NULL) {
entryPtr = Tcl_FindHashEntry(&nsPtr->parentPtr->childTable,
nsPtr->name);
if (entryPtr != NULL) {
Tcl_DeleteHashEntry(entryPtr);
}
}
nsPtr->parentPtr = NULL;
/*
* Delete the namespace path if one is installed.
*/
if (nsPtr->commandPathLength != 0) {
UnlinkNsPath(nsPtr);
nsPtr->commandPathLength = 0;
}
if (nsPtr->commandPathSourceList != NULL) {
NamespacePathEntry *nsPathPtr = nsPtr->commandPathSourceList;
do {
nsPathPtr->nsPtr = NULL;
nsPathPtr = nsPathPtr->nextPtr;
} while (nsPathPtr != NULL);
}
/*
* Delete all the child namespaces.
*
* BE CAREFUL: When each child is deleted, it will divorce
* itself from its parent. You can't traverse a hash table
* properly if its elements are being deleted. We use only
|
| ︙ | ︙ | |||
1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 |
/*
* Scan through the command table in the source namespace and look for
* exported commands that match the string pattern. Create an "imported
* command" in the current namespace for each imported command; these
* commands redirect their invocations to the "real" command.
*/
for (hPtr = Tcl_FirstHashEntry(&importNsPtr->cmdTable, &search);
(hPtr != NULL); hPtr = Tcl_NextHashEntry(&search)) {
char *cmdName = Tcl_GetHashKey(&importNsPtr->cmdTable, hPtr);
| > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > | | | | | < < | | < < | < | < > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < | 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 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 1651 1652 1653 |
/*
* Scan through the command table in the source namespace and look for
* exported commands that match the string pattern. Create an "imported
* command" in the current namespace for each imported command; these
* commands redirect their invocations to the "real" command.
*/
if ((simplePattern != NULL) && TclMatchIsTrivial(simplePattern)) {
hPtr = Tcl_FindHashEntry(&importNsPtr->cmdTable, simplePattern);
if (hPtr == NULL) {
return TCL_OK;
}
return DoImport(interp, nsPtr, hPtr, simplePattern, pattern,
importNsPtr, allowOverwrite);
}
for (hPtr = Tcl_FirstHashEntry(&importNsPtr->cmdTable, &search);
(hPtr != NULL); hPtr = Tcl_NextHashEntry(&search)) {
char *cmdName = Tcl_GetHashKey(&importNsPtr->cmdTable, hPtr);
if (Tcl_StringMatch(cmdName, simplePattern)
&& (TCL_ERROR == DoImport( interp, nsPtr, hPtr, cmdName,
pattern, importNsPtr, allowOverwrite))) {
return TCL_ERROR;
}
}
return TCL_OK;
}
static int
DoImport(interp, nsPtr, hPtr, cmdName, pattern, importNsPtr, allowOverwrite)
Tcl_Interp *interp;
Namespace *nsPtr;
Tcl_HashEntry *hPtr;
CONST char *cmdName;
CONST char *pattern;
Namespace *importNsPtr;
int allowOverwrite;
{
int i = 0, exported = 0;
Tcl_HashEntry *found;
/*
* The command cmdName in the source namespace matches the
* pattern. Check whether it was exported. If it wasn't,
* we ignore it.
*/
while (!exported && (i < importNsPtr->numExportPatterns)) {
exported |= Tcl_StringMatch(cmdName, importNsPtr->exportArrayPtr[i++]);
}
if (!exported) {
return TCL_OK;
}
/*
* Unless there is a name clash, create an imported command
* in the current namespace that refers to cmdPtr.
*/
found = Tcl_FindHashEntry(&nsPtr->cmdTable, cmdName);
if ((found == NULL) || allowOverwrite) {
/*
* Create the imported command and its client data.
* To create the new command in the current namespace,
* generate a fully qualified name for it.
*/
Tcl_DString ds;
Tcl_Command importedCmd;
ImportedCmdData *dataPtr;
Command *cmdPtr;
ImportRef *refPtr;
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, nsPtr->fullName, -1);
if (nsPtr != ((Interp *) interp)->globalNsPtr) {
Tcl_DStringAppend(&ds, "::", 2);
}
Tcl_DStringAppend(&ds, cmdName, -1);
/*
* Check whether creating the new imported command in the
* current namespace would create a cycle of imported
* command references.
*/
cmdPtr = (Command *) Tcl_GetHashValue(hPtr);
if (found != NULL && cmdPtr->deleteProc == DeleteImportedCmd) {
Command *overwrite = (Command *) Tcl_GetHashValue(found);
Command *link = cmdPtr;
while (link->deleteProc == DeleteImportedCmd) {
ImportedCmdData *dataPtr;
dataPtr = (ImportedCmdData *) link->objClientData;
link = dataPtr->realCmdPtr;
if (overwrite == link) {
Tcl_AppendResult(interp, "import pattern \"",
pattern,
"\" would create a loop containing ",
"command \"", Tcl_DStringValue(&ds),
"\"", (char *) NULL);
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
}
}
dataPtr = (ImportedCmdData *) ckalloc(sizeof(ImportedCmdData));
importedCmd = Tcl_CreateObjCommand(interp,
Tcl_DStringValue(&ds), InvokeImportedCmd,
(ClientData) dataPtr, DeleteImportedCmd);
dataPtr->realCmdPtr = cmdPtr;
dataPtr->selfPtr = (Command *) importedCmd;
dataPtr->selfPtr->compileProc = cmdPtr->compileProc;
Tcl_DStringFree(&ds);
/*
* Create an ImportRef structure describing this new import
* command and add it to the import ref list in the "real"
* command.
*/
refPtr = (ImportRef *) ckalloc(sizeof(ImportRef));
refPtr->importedCmdPtr = (Command *) importedCmd;
refPtr->nextPtr = cmdPtr->importRefPtr;
cmdPtr->importRefPtr = refPtr;
} else {
Tcl_AppendResult(interp, "can't import command \"", cmdName,
"\": already exists", (char *) NULL);
return TCL_ERROR;
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 |
if (strcmp(pattern, simplePattern) == 0) {
/*
* The pattern is simple.
* Delete any imported commands that match it.
*/
for (hPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
(hPtr != NULL);
hPtr = Tcl_NextHashEntry(&search)) {
Command *cmdPtr = (Command *) Tcl_GetHashValue(hPtr);
if (cmdPtr->deleteProc != DeleteImportedCmd) {
continue;
}
| > > > > > > > > > > | 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 |
if (strcmp(pattern, simplePattern) == 0) {
/*
* The pattern is simple.
* Delete any imported commands that match it.
*/
if (TclMatchIsTrivial(simplePattern)) {
Command *cmdPtr;
hPtr = Tcl_FindHashEntry(&nsPtr->cmdTable, simplePattern);
if ((hPtr != NULL)
&& (cmdPtr = (Command *) Tcl_GetHashValue(hPtr))
&& (cmdPtr->deleteProc == DeleteImportedCmd)) {
Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr);
}
return TCL_OK;
}
for (hPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
(hPtr != NULL);
hPtr = Tcl_NextHashEntry(&search)) {
Command *cmdPtr = (Command *) Tcl_GetHashValue(hPtr);
if (cmdPtr->deleteProc != DeleteImportedCmd) {
continue;
}
|
| ︙ | ︙ | |||
2269 2270 2271 2272 2273 2274 2275 |
* 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. */
{
Interp *iPtr = (Interp*)interp;
| < < | < | < | | > | 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 |
* 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. */
{
Interp *iPtr = (Interp*)interp;
Namespace *cxtNsPtr;
register Tcl_HashEntry *entryPtr;
register Command *cmdPtr;
CONST char *simpleName;
int result;
/*
* If this namespace has a command resolver, then give it first
* crack at the command resolution. If the interpreter has any
* command resolvers, consult them next. The command resolver
* procedures may return a Tcl_Command value, they may signal
* to continue onward, or they may signal an error.
*/
if (flags & TCL_GLOBAL_ONLY) {
cxtNsPtr = (Namespace *) Tcl_GetGlobalNamespace(interp);
} else if (contextNsPtr != NULL) {
cxtNsPtr = (Namespace *) contextNsPtr;
} else {
cxtNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
}
if (cxtNsPtr->cmdResProc != NULL || iPtr->resolverPtr != NULL) {
ResolverScheme *resPtr = iPtr->resolverPtr;
Tcl_Command cmd;
if (cxtNsPtr->cmdResProc) {
result = (*cxtNsPtr->cmdResProc)(interp, name,
(Tcl_Namespace *) cxtNsPtr, flags, &cmd);
} else {
result = TCL_CONTINUE;
}
|
| ︙ | ︙ | |||
2323 2324 2325 2326 2327 2328 2329 |
}
}
/*
* Find the namespace(s) that contain the command.
*/
| | | | < < < | < < < > > > | | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | 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 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 |
}
}
/*
* Find the namespace(s) that contain the command.
*/
cmdPtr = NULL;
if (cxtNsPtr->commandPathLength!=0 && strncmp(name, "::", 2)) {
int i;
Namespace *pathNsPtr, *realNsPtr, *dummyNsPtr;
(void) TclGetNamespaceForQualName(interp, name, cxtNsPtr,
TCL_NAMESPACE_ONLY, &realNsPtr, &dummyNsPtr, &dummyNsPtr,
&simpleName);
if (realNsPtr != NULL && simpleName != NULL) {
entryPtr = Tcl_FindHashEntry(&realNsPtr->cmdTable, simpleName);
if (entryPtr != NULL) {
cmdPtr = (Command *) Tcl_GetHashValue(entryPtr);
}
}
/*
* Next, check along the path.
*/
for (i=0 ; i<cxtNsPtr->commandPathLength && cmdPtr==NULL ; i++) {
pathNsPtr = cxtNsPtr->commandPathArray[i].nsPtr;
if (pathNsPtr == NULL) {
continue;
}
(void) TclGetNamespaceForQualName(interp, name, pathNsPtr,
TCL_NAMESPACE_ONLY, &realNsPtr, &dummyNsPtr, &dummyNsPtr,
&simpleName);
if (realNsPtr != NULL && simpleName != NULL) {
entryPtr = Tcl_FindHashEntry(&realNsPtr->cmdTable, simpleName);
if (entryPtr != NULL) {
cmdPtr = (Command *) Tcl_GetHashValue(entryPtr);
}
}
}
/*
* If we've still not found the command, look in the global
* namespace as a last resort.
*/
if (cmdPtr == NULL) {
(void) TclGetNamespaceForQualName(interp, name, NULL,
TCL_GLOBAL_ONLY, &realNsPtr, &dummyNsPtr, &dummyNsPtr,
&simpleName);
if (realNsPtr != NULL && simpleName != NULL) {
entryPtr = Tcl_FindHashEntry(&realNsPtr->cmdTable, simpleName);
if (entryPtr != NULL) {
cmdPtr = (Command *) Tcl_GetHashValue(entryPtr);
}
}
}
} else {
Namespace *nsPtr[2];
register int search;
TclGetNamespaceForQualName(interp, name, (Namespace *) contextNsPtr,
flags, &nsPtr[0], &nsPtr[1], &cxtNsPtr, &simpleName);
/*
* Look for the command in the command table of its namespace.
* Be sure to check both possible search paths: from the
* specified namespace context and from the global namespace.
*/
for (search = 0; (search < 2) && (cmdPtr == NULL); search++) {
if ((nsPtr[search] != NULL) && (simpleName != NULL)) {
entryPtr = Tcl_FindHashEntry(&nsPtr[search]->cmdTable,
simpleName);
if (entryPtr != NULL) {
cmdPtr = (Command *) Tcl_GetHashValue(entryPtr);
}
}
}
}
if (cmdPtr != NULL) {
return (Tcl_Command) cmdPtr;
}
if (flags & TCL_LEAVE_ERR_MSG) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "unknown command \"", name,
"\"", (char *) NULL);
}
return (Tcl_Command) NULL;
}
/*
*----------------------------------------------------------------------
*
* Tcl_FindNamespaceVar --
|
| ︙ | ︙ | |||
2462 2463 2464 2465 2466 2467 2468 |
* Be sure to check both possible search paths: from the specified
* namespace context and from the global namespace.
*/
varPtr = NULL;
for (search = 0; (search < 2) && (varPtr == NULL); search++) {
if ((nsPtr[search] != NULL) && (simpleName != NULL)) {
| | > | 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 |
* Be sure to check both possible search paths: from the specified
* namespace context and from the global namespace.
*/
varPtr = NULL;
for (search = 0; (search < 2) && (varPtr == NULL); search++) {
if ((nsPtr[search] != NULL) && (simpleName != NULL)) {
entryPtr = Tcl_FindHashEntry(
(Tcl_HashTable *)&nsPtr[search]->varTable, simpleName);
if (entryPtr != NULL) {
varPtr = (Var *) Tcl_GetHashValue(entryPtr);
}
}
}
if (varPtr != NULL) {
return (Tcl_Var) varPtr;
|
| ︙ | ︙ | |||
2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 |
* shadowNsPtr is initially :: and we check for case 1. above.
*/
if (found) {
hPtr = Tcl_FindHashEntry(&shadowNsPtr->cmdTable, cmdName);
if (hPtr != NULL) {
nsPtr->cmdRefEpoch++;
/*
* If the shadowed command was compiled to bytecodes, we
* invalidate all the bytecodes in nsPtr, to force a new
* compilation. We use the resolverEpoch to signal the need
* for a fresh compilation of every bytecode.
*/
| > | 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 |
* shadowNsPtr is initially :: and we check for case 1. above.
*/
if (found) {
hPtr = Tcl_FindHashEntry(&shadowNsPtr->cmdTable, cmdName);
if (hPtr != NULL) {
nsPtr->cmdRefEpoch++;
TclInvalidateNsPath(nsPtr);
/*
* If the shadowed command was compiled to bytecodes, we
* invalidate all the bytecodes in nsPtr, to force a new
* compilation. We use the resolverEpoch to signal the need
* for a fresh compilation of every bytecode.
*/
|
| ︙ | ︙ | |||
2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 | * Invoked to implement the "namespace" command that creates, deletes, * or manipulates Tcl namespaces. Handles the following syntax: * * namespace children ?name? ?pattern? * namespace code arg * namespace current * namespace delete ?name name...? * namespace eval name arg ?arg...? * namespace exists name * namespace export ?-clear? ?pattern pattern...? * namespace forget ?pattern pattern...? * namespace import ?-force? ?pattern pattern...? * namespace inscope name arg ?arg...? * namespace origin name | > | 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 | * Invoked to implement the "namespace" command that creates, deletes, * or manipulates Tcl namespaces. Handles the following syntax: * * namespace children ?name? ?pattern? * namespace code arg * namespace current * namespace delete ?name name...? * namespace ensemble subcommand ?arg...? * namespace eval name arg ?arg...? * namespace exists name * namespace export ?-clear? ?pattern pattern...? * namespace forget ?pattern pattern...? * namespace import ?-force? ?pattern pattern...? * namespace inscope name arg ?arg...? * namespace origin name |
| ︙ | ︙ | |||
2790 2791 2792 2793 2794 2795 2796 |
Tcl_Interp *interp; /* Current interpreter. */
register int objc; /* Number of arguments. */
register Tcl_Obj *CONST objv[]; /* Argument objects. */
{
static CONST char *subCmds[] = {
"children", "code", "current", "delete", "ensemble",
"eval", "exists", "export", "forget", "import",
| | | | 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 |
Tcl_Interp *interp; /* Current interpreter. */
register int objc; /* Number of arguments. */
register Tcl_Obj *CONST objv[]; /* Argument objects. */
{
static CONST char *subCmds[] = {
"children", "code", "current", "delete", "ensemble",
"eval", "exists", "export", "forget", "import",
"inscope", "origin", "parent", "path", "qualifiers",
"tail", "which", (char *) NULL
};
enum NSSubCmdIdx {
NSChildrenIdx, NSCodeIdx, NSCurrentIdx, NSDeleteIdx, NSEnsembleIdx,
NSEvalIdx, NSExistsIdx, NSExportIdx, NSForgetIdx, NSImportIdx,
NSInscopeIdx, NSOriginIdx, NSParentIdx, NSPathIdx, NSQualifiersIdx,
NSTailIdx, NSWhichIdx
};
int index, result;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?arg ...?");
return TCL_ERROR;
|
| ︙ | ︙ | |||
2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 |
break;
case NSOriginIdx:
result = NamespaceOriginCmd(clientData, interp, objc, objv);
break;
case NSParentIdx:
result = NamespaceParentCmd(clientData, interp, objc, objv);
break;
case NSQualifiersIdx:
result = NamespaceQualifiersCmd(clientData, interp, objc, objv);
break;
case NSTailIdx:
result = NamespaceTailCmd(clientData, interp, objc, objv);
break;
case NSWhichIdx:
| > > > | 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 |
break;
case NSOriginIdx:
result = NamespaceOriginCmd(clientData, interp, objc, objv);
break;
case NSParentIdx:
result = NamespaceParentCmd(clientData, interp, objc, objv);
break;
case NSPathIdx:
result = NamespacePathCmd(clientData, interp, objc, objv);
break;
case NSQualifiersIdx:
result = NamespaceQualifiersCmd(clientData, interp, objc, objv);
break;
case NSTailIdx:
result = NamespaceTailCmd(clientData, interp, objc, objv);
break;
case NSWhichIdx:
|
| ︙ | ︙ | |||
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 |
/*
* Create a list containing the full names of all child namespaces
* whose names match the specified pattern, if any.
*/
listPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
entryPtr = Tcl_FirstHashEntry(&nsPtr->childTable, &search);
while (entryPtr != NULL) {
childNsPtr = (Namespace *) Tcl_GetHashValue(entryPtr);
if ((pattern == NULL)
|| Tcl_StringMatch(childNsPtr->fullName, pattern)) {
elemPtr = Tcl_NewStringObj(childNsPtr->fullName, -1);
Tcl_ListObjAppendElement(interp, listPtr, elemPtr);
}
entryPtr = Tcl_NextHashEntry(&search);
}
Tcl_SetObjResult(interp, listPtr);
Tcl_DStringFree(&buffer);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
| > > > > > > > > | 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 |
/*
* Create a list containing the full names of all child namespaces
* whose names match the specified pattern, if any.
*/
listPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
if ((pattern != NULL) && TclMatchIsTrivial(pattern)) {
if (Tcl_FindHashEntry(&nsPtr->childTable, pattern) != NULL) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(pattern, -1));
}
goto searchDone;
}
entryPtr = Tcl_FirstHashEntry(&nsPtr->childTable, &search);
while (entryPtr != NULL) {
childNsPtr = (Namespace *) Tcl_GetHashValue(entryPtr);
if ((pattern == NULL)
|| Tcl_StringMatch(childNsPtr->fullName, pattern)) {
elemPtr = Tcl_NewStringObj(childNsPtr->fullName, -1);
Tcl_ListObjAppendElement(interp, listPtr, elemPtr);
}
entryPtr = Tcl_NextHashEntry(&search);
}
searchDone:
Tcl_SetObjResult(interp, listPtr);
Tcl_DStringFree(&buffer);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 |
if (nsPtr->parentPtr != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
nsPtr->parentPtr->fullName, -1));
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* NamespaceQualifiersCmd --
*
* Invoked to implement the "namespace qualifiers" command that returns
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 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 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 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 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 |
if (nsPtr->parentPtr != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
nsPtr->parentPtr->fullName, -1));
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* NamespacePathCmd --
*
* Invoked to implement the "namespace path" command that reads
* and writes the current namespace's command resolution path.
* Has one optional argument: if present, it is a list of named
* namespaces to set the path to, and if absent, the current path
* should be returned. Handles the following syntax:
*
* namespace path ?nsList?
*
* Results:
* Returns TCL_OK if successful, and TCL_ERROR if anything goes
* wrong (most notably if the namespace list contains the name of
* something other than a namespace). In the successful-exit
* case, may set the interpreter result to the list of names of
* the namespaces on the current namespace's path.
*
* Side effects:
* May update the namespace path (triggering a recomputing of all
* command names that depend on the namespace for resolution).
*
*----------------------------------------------------------------------
*/
static int
NamespacePathCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
Namespace *nsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
int i, nsObjc, result = TCL_ERROR;
Tcl_Obj **nsObjv;
Tcl_Namespace **namespaceList = NULL;
Tcl_Namespace *staticNs[4];
if (objc > 3) {
Tcl_WrongNumArgs(interp, 2, objv, "?pathList?");
return TCL_ERROR;
}
/*
* If no path is given, return the current path.
*/
if (objc == 2) {
/*
* Not a very fast way to compute this, but easy to get right.
*/
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
if (nsPtr->commandPathArray[i].nsPtr != NULL) {
Tcl_AppendElement(interp,
nsPtr->commandPathArray[i].nsPtr->fullName);
}
}
return TCL_OK;
}
/*
* There is a path given, so parse it into an array of namespace
* pointers.
*/
if (Tcl_ListObjGetElements(interp, objv[2], &nsObjc, &nsObjv) != TCL_OK) {
goto badNamespace;
}
if (nsObjc != 0) {
if (nsObjc > 4) {
namespaceList = (Tcl_Namespace **)
ckalloc(sizeof(Tcl_Namespace *) * nsObjc);
} else {
namespaceList = staticNs;
}
for (i=0 ; i<nsObjc ; i++) {
if (TclGetNamespaceFromObj(interp, nsObjv[i],
&namespaceList[i]) != TCL_OK) {
goto badNamespace;
}
if (namespaceList[i] == NULL) {
Tcl_AppendResult(interp, "unknown namespace \"",
TclGetString(nsObjv[i]), "\"", NULL);
goto badNamespace;
}
}
}
/*
* Now we have the list of valid namespaces, install it as the
* path.
*/
SetNsPath(nsPtr, nsObjc, namespaceList);
result = TCL_OK;
badNamespace:
if (namespaceList != NULL && namespaceList != staticNs) {
ckfree((char *) namespaceList);
}
return result;
}
/*
*----------------------------------------------------------------------
*
* SetNsPath --
*
* Sets the namespace command name resolution path to the given
* list of namespaces. If the list is empty (of zero length) the
* path is set to empty and the default old-style behaviour of
* command name resolution is used.
*
* Results:
* nothing
*
* Side effects:
* Invalidates the command name resolution caches for any command
* resolved in the given namespace.
*
*----------------------------------------------------------------------
*/
/* EXPOSE ME? */
static void
SetNsPath(nsPtr, pathLength, pathAry)
Namespace *nsPtr; /* Namespace whose path is to be set. */
int pathLength; /* Length of pathAry */
Tcl_Namespace *pathAry[]; /* Array of namespaces that are the path. */
{
NamespacePathEntry *tmpPathArray;
int i;
if (pathLength != 0) {
tmpPathArray = (NamespacePathEntry *)
ckalloc(sizeof(NamespacePathEntry) * pathLength);
for (i=0 ; i<pathLength ; i++) {
tmpPathArray[i].nsPtr = (Namespace *) pathAry[i];
tmpPathArray[i].creatorNsPtr = nsPtr;
tmpPathArray[i].prevPtr = NULL;
tmpPathArray[i].nextPtr =
tmpPathArray[i].nsPtr->commandPathSourceList;
if (tmpPathArray[i].nextPtr != NULL) {
tmpPathArray[i].nextPtr->prevPtr = &tmpPathArray[i];
}
tmpPathArray[i].nsPtr->commandPathSourceList = &tmpPathArray[i];
}
if (nsPtr->commandPathLength != 0) {
UnlinkNsPath(nsPtr);
}
nsPtr->commandPathArray = tmpPathArray;
} else {
if (nsPtr->commandPathLength != 0) {
UnlinkNsPath(nsPtr);
}
}
nsPtr->commandPathLength = pathLength;
nsPtr->cmdRefEpoch++;
nsPtr->resolverEpoch++;
}
/*
*----------------------------------------------------------------------
*
* UnlinkNsPath --
*
* Delete the given namespace's command name resolution path. Only
* call if the path is non-empty. Caller must reset the counter
* containing the path size.
*
* Results:
* nothing
*
* Side effects:
* Deletes the array of path entries and unlinks those path entries
* from the target namespace's list of interested namespaces.
*
*----------------------------------------------------------------------
*/
static void
UnlinkNsPath(nsPtr)
Namespace *nsPtr;
{
int i;
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
NamespacePathEntry *nsPathPtr = &nsPtr->commandPathArray[i];
if (nsPathPtr->prevPtr != NULL) {
nsPathPtr->prevPtr->nextPtr = nsPathPtr->nextPtr;
}
if (nsPathPtr->nextPtr != NULL) {
nsPathPtr->nextPtr->prevPtr = nsPathPtr->prevPtr;
}
if (nsPathPtr->nsPtr != NULL) {
if (nsPathPtr->nsPtr->commandPathSourceList == nsPathPtr) {
nsPathPtr->nsPtr->commandPathSourceList = nsPathPtr->nextPtr;
}
}
}
ckfree((char *) nsPtr->commandPathArray);
}
/*
*----------------------------------------------------------------------
*
* TclInvalidateNsPath --
*
* Invalidate the name resolution caches for all names looked up
* in namespaces whose name path includes the given namespace.
*
* Results:
* nothing
*
* Side effects:
* Increments the command reference epoch in each namespace whose
* path includes the given namespace. This causes any cached
* resolved names whose root cacheing context starts at that
* namespace to be recomputed the next time they are used.
*
*----------------------------------------------------------------------
*/
void
TclInvalidateNsPath(nsPtr)
Namespace *nsPtr;
{
NamespacePathEntry *nsPathPtr = nsPtr->commandPathSourceList;
while (nsPathPtr != NULL) {
if (nsPathPtr->nsPtr != NULL) {
nsPathPtr->creatorNsPtr->cmdRefEpoch++;
}
nsPathPtr = nsPathPtr->nextPtr;
}
}
/*
*----------------------------------------------------------------------
*
* NamespaceQualifiersCmd --
*
* Invoked to implement the "namespace qualifiers" command that returns
|
| ︙ | ︙ | |||
5485 5486 5487 5488 5489 5490 5491 | * Table of subcommands is still valid; therefore there might * be a valid cache of discovered information which we can * reuse. Do the check here, and if we're still valid, we can * jump straight to the part where we do the invocation of the * subcommand. */ | | | 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 |
* Table of subcommands is still valid; therefore there might
* be a valid cache of discovered information which we can
* reuse. Do the check here, and if we're still valid, we can
* jump straight to the part where we do the invocation of the
* subcommand.
*/
if (objv[1]->typePtr == &ensembleCmdType) {
EnsembleCmdRep *ensembleCmd = (EnsembleCmdRep *)
objv[1]->internalRep.otherValuePtr;
if (ensembleCmd->nsPtr == ensemblePtr->nsPtr &&
ensembleCmd->epoch == ensemblePtr->epoch &&
ensembleCmd->token == ensemblePtr->token) {
prefixObj = ensembleCmd->realPrefixObj;
Tcl_IncrRefCount(prefixObj);
|
| ︙ | ︙ | |||
5781 5782 5783 5784 5785 5786 5787 |
EnsembleConfig *ensemblePtr;
CONST char *subcommandName;
Tcl_Obj *prefixObjPtr;
{
register EnsembleCmdRep *ensembleCmd;
int length;
| | | | 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 |
EnsembleConfig *ensemblePtr;
CONST char *subcommandName;
Tcl_Obj *prefixObjPtr;
{
register EnsembleCmdRep *ensembleCmd;
int length;
if (objPtr->typePtr == &ensembleCmdType) {
ensembleCmd = (EnsembleCmdRep *) objPtr->internalRep.otherValuePtr;
Tcl_DecrRefCount(ensembleCmd->realPrefixObj);
ensembleCmd->nsPtr->refCount--;
if ((ensembleCmd->nsPtr->refCount == 0)
&& (ensembleCmd->nsPtr->flags & NS_DEAD)) {
NamespaceFree(ensembleCmd->nsPtr);
}
ckfree(ensembleCmd->fullSubcmdName);
} else {
/*
* Kill the old internal rep, and replace it with a brand new
* one of our own.
*/
TclFreeIntRep(objPtr);
ensembleCmd = (EnsembleCmdRep *) ckalloc(sizeof(EnsembleCmdRep));
objPtr->internalRep.otherValuePtr = (VOID *) ensembleCmd;
objPtr->typePtr = &ensembleCmdType;
}
/*
* Populate the internal rep.
*/
ensembleCmd->nsPtr = ensemblePtr->nsPtr;
ensembleCmd->epoch = ensemblePtr->epoch;
|
| ︙ | ︙ | |||
6225 6226 6227 6228 6229 6230 6231 |
{
EnsembleCmdRep *ensembleCmd = (EnsembleCmdRep *)
objPtr->internalRep.otherValuePtr;
EnsembleCmdRep *ensembleCopy = (EnsembleCmdRep *)
ckalloc(sizeof(EnsembleCmdRep));
int length = strlen(ensembleCmd->fullSubcmdName);
| | | 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 |
{
EnsembleCmdRep *ensembleCmd = (EnsembleCmdRep *)
objPtr->internalRep.otherValuePtr;
EnsembleCmdRep *ensembleCopy = (EnsembleCmdRep *)
ckalloc(sizeof(EnsembleCmdRep));
int length = strlen(ensembleCmd->fullSubcmdName);
copyPtr->typePtr = &ensembleCmdType;
copyPtr->internalRep.otherValuePtr = (VOID *) ensembleCopy;
ensembleCopy->nsPtr = ensembleCmd->nsPtr;
ensembleCopy->epoch = ensembleCmd->epoch;
ensembleCopy->token = ensembleCmd->token;
ensembleCopy->nsPtr->refCount++;
ensembleCopy->realPrefixObj = ensembleCmd->realPrefixObj;
Tcl_IncrRefCount(ensembleCopy->realPrefixObj);
|
| ︙ | ︙ |
Changes to generic/tclNotify.c.
| ︙ | ︙ | |||
10 11 12 13 14 15 16 | * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. * Copyright (c) 2003 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. * Copyright (c) 2003 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclNotify.c,v 1.16.4.1 2005/06/13 01:46:14 msofer Exp $ */ #include "tclInt.h" extern TclStubs tclStubs; /* |
| ︙ | ︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
* called during an event source traversal. */
EventSource *firstEventSourcePtr;
/* Pointer to first event source in
* list of event sources for this thread. */
Tcl_ThreadId threadId; /* Thread that owns this notifier instance. */
ClientData clientData; /* Opaque handle for platform specific
* notifier. */
struct ThreadSpecificData *nextPtr;
/* Next notifier in global list of notifiers.
* Access is controlled by the listLock global
* mutex. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
| > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
* called during an event source traversal. */
EventSource *firstEventSourcePtr;
/* Pointer to first event source in
* list of event sources for this thread. */
Tcl_ThreadId threadId; /* Thread that owns this notifier instance. */
ClientData clientData; /* Opaque handle for platform specific
* notifier. */
int initialized; /* 1 if notifier has been initialized. */
struct ThreadSpecificData *nextPtr;
/* Next notifier in global list of notifiers.
* Access is controlled by the listLock global
* mutex. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
|
| ︙ | ︙ | |||
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
/* Empty loop body. */
}
if (NULL == tsdPtr) {
/* Notifier not yet initialized in this thread */
tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->threadId = threadId;
tsdPtr->clientData = tclStubs.tcl_InitNotifier();
tsdPtr->nextPtr = firstNotifierPtr;
firstNotifierPtr = tsdPtr;
}
Tcl_MutexUnlock(&listLock);
}
/*
| > | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
/* Empty loop body. */
}
if (NULL == tsdPtr) {
/* Notifier not yet initialized in this thread */
tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->threadId = threadId;
tsdPtr->clientData = tclStubs.tcl_InitNotifier();
tsdPtr->initialized = 1;
tsdPtr->nextPtr = firstNotifierPtr;
firstNotifierPtr = tsdPtr;
}
Tcl_MutexUnlock(&listLock);
}
/*
|
| ︙ | ︙ | |||
159 160 161 162 163 164 165 |
void
TclFinalizeNotifier()
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
ThreadSpecificData **prevPtrPtr;
Tcl_Event *evPtr, *hold;
| | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
void
TclFinalizeNotifier()
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
ThreadSpecificData **prevPtrPtr;
Tcl_Event *evPtr, *hold;
if (!tsdPtr->initialized) {
return; /* Notifier not initialized for the current thread */
}
Tcl_MutexLock(&(tsdPtr->queueMutex));
for (evPtr = tsdPtr->firstEventPtr; evPtr != (Tcl_Event *) NULL; ) {
hold = evPtr;
evPtr = evPtr->nextPtr;
|
| ︙ | ︙ | |||
186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
for (prevPtrPtr = &firstNotifierPtr; *prevPtrPtr != NULL;
prevPtrPtr = &((*prevPtrPtr)->nextPtr)) {
if (*prevPtrPtr == tsdPtr) {
*prevPtrPtr = tsdPtr->nextPtr;
break;
}
}
Tcl_MutexUnlock(&listLock);
}
/*
*----------------------------------------------------------------------
*
| > | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
for (prevPtrPtr = &firstNotifierPtr; *prevPtrPtr != NULL;
prevPtrPtr = &((*prevPtrPtr)->nextPtr)) {
if (*prevPtrPtr == tsdPtr) {
*prevPtrPtr = tsdPtr->nextPtr;
break;
}
}
tsdPtr->initialized = 0;
Tcl_MutexUnlock(&listLock);
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ |
Changes to generic/tclObj.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclObj.c -- * * This file contains Tcl object-related procedures that are used by * many Tcl commands. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * Copyright (c) 2001 by ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | > | > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /* * tclObj.c -- * * This file contains Tcl object-related procedures that are used by * many Tcl commands. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * Copyright (c) 2001 by ActiveState Corporation. * Copyright (c) 2005 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclObj.c,v 1.73.2.4 2005/06/13 01:46:14 msofer Exp $ */ #include "tclInt.h" #include "tommath.h" #include "tclCompile.h" #include <float.h> /* * Define test for NaN */ #ifdef _MSC_VER #define IS_NAN(f) _isnan((f)) #else #define IS_NAN(f) ((f) != (f)) #endif /* * Table of all object types. */ static Tcl_HashTable typeTable; static int typeTableInitialized = 0; /* 0 means not yet initialized. */ |
| ︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 |
*/
typedef struct ThreadSpecificData {
Tcl_HashTable *objThreadMap;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
#endif /* TCL_MEM_DEBUG && TCL_THREADS */
/*
| > | < > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > < > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > < < > | > > > > > > > > > | > > > > > > | 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 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 |
*/
typedef struct ThreadSpecificData {
Tcl_HashTable *objThreadMap;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
#endif /* TCL_MEM_DEBUG && TCL_THREADS */
/*
* Nested Tcl_Obj deletion management support
*
* All context references used in the object freeing code are pointers
* to this structure; every thread will have its own structure
* instance. The purpose of this structure is to allow deeply nested
* collections of Tcl_Objs to be freed without taking a vast depth of
* C stack (which could cause all sorts of breakage.)
*/
typedef struct PendingObjData {
int deletionCount; /* Count of the number of invokations of
* TclFreeObj() are on the stack (at least
* conceptually; many are actually expanded
* macros). */
Tcl_Obj *deletionStack; /* Stack of objects that have had TclFreeObj()
* invoked upon them but which can't be deleted
* yet because they are in a nested invokation
* of TclFreeObj(). By postponing this way, we
* limit the maximum overall C stack depth when
* deleting a complex object. The down-side is
* that we alter the overall behaviour by
* altering the order in which objects are
* deleted, and we change the order in which
* the string rep and the internal rep of an
* object are deleted. Note that code which
* assumes the previous behaviour in either of
* these respects is unsafe anyway; it was
* never documented as to exactly what would
* happen in these cases, and the overall
* contract of a user-level Tcl_DecrRefCount()
* is still preserved (assuming that a
* particular T_DRC would delete an object is
* not very safe). */
} PendingObjData;
/*
* These are separated out so that some semantic content is attached
* 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) \
/* Invalidate the string rep first so we can use the bytes value \
* for our pointer chain. */ \
if (((objPtr)->bytes != NULL) \
&& ((objPtr)->bytes != tclEmptyStringRep)) { \
ckfree((char *) (objPtr)->bytes); \
} \
/* Now push onto the head of the stack. */ \
(objPtr)->bytes = (char *) ((contextPtr)->deletionStack); \
(contextPtr)->deletionStack = (objPtr)
#define PopObjToDelete(contextPtr,objPtrVar) \
(objPtrVar) = (contextPtr)->deletionStack; \
(contextPtr)->deletionStack = (Tcl_Obj *) (objPtrVar)->bytes
/*
* Macro to set up the local reference to the deletion context.
*/
#ifndef TCL_THREADS
PendingObjData pendingObjData;
#define ObjInitDeletionContext(contextPtr) \
PendingObjData *CONST contextPtr = &pendingObjData
#else
Tcl_ThreadDataKey pendingObjDataKey;
#define ObjInitDeletionContext(contextPtr) \
PendingObjData *CONST contextPtr = (PendingObjData *) \
Tcl_GetThreadData(&pendingObjDataKey, sizeof(PendingObjData))
#endif
/*
* Macros to pack/unpack a bignum's fields in a Tcl_Obj internal rep
*/
#define PACK_BIGNUM( bignum, objPtr ) \
do { \
(objPtr)->internalRep.bignumValue.digits = (void*) (bignum).dp; \
(objPtr)->internalRep.bignumValue.misc = ( \
( (bignum).sign << 30 ) \
| ( (bignum).alloc << 15 ) \
| ( (bignum).used ) ); \
} while ( 0 )
#define UNPACK_BIGNUM( objPtr, bignum ) \
do { \
(bignum).dp = (mp_digit*) (objPtr)->internalRep.bignumValue.digits; \
(bignum).sign = (objPtr)->internalRep.bignumValue.misc >> 30; \
(bignum).alloc = ( (objPtr)->internalRep.bignumValue.misc >> 15 ) \
& 0x7fff; \
(bignum).used = (objPtr)->internalRep.bignumValue.misc & 0x7fff; \
} while ( 0 )
/*
* Prototypes for procedures defined later in this file:
*/
static int SetBooleanFromAny _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
static int SetDoubleFromAny _ANSI_ARGS_((Tcl_Interp *interp,
|
| ︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | static void UpdateStringOfInt _ANSI_ARGS_((Tcl_Obj *objPtr)); static int SetWideIntFromAny _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr)); #ifndef TCL_WIDE_INT_IS_LONG static void UpdateStringOfWideInt _ANSI_ARGS_((Tcl_Obj *objPtr)); #endif /* * Prototypes for the array hash key methods. */ static Tcl_HashEntry * AllocObjEntry _ANSI_ARGS_(( Tcl_HashTable *tablePtr, VOID *keyPtr)); | > > > > > > > | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | static void UpdateStringOfInt _ANSI_ARGS_((Tcl_Obj *objPtr)); static int SetWideIntFromAny _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr)); #ifndef TCL_WIDE_INT_IS_LONG static void UpdateStringOfWideInt _ANSI_ARGS_((Tcl_Obj *objPtr)); #endif static void FreeBignum _ANSI_ARGS_(( Tcl_Obj *objPtr )); static void DupBignum _ANSI_ARGS_(( Tcl_Obj *objPtr, Tcl_Obj *copyPtr )); static void UpdateStringOfBignum _ANSI_ARGS_(( Tcl_Obj *objPtr )); static int SetBignumFromAny _ANSI_ARGS_(( Tcl_Interp* interp, Tcl_Obj* objPtr )); /* * Prototypes for the array hash key methods. */ static Tcl_HashEntry * AllocObjEntry _ANSI_ARGS_(( Tcl_HashTable *tablePtr, VOID *keyPtr)); |
| ︙ | ︙ | |||
170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
#ifdef TCL_WIDE_INT_IS_LONG
UpdateStringOfInt, /* updateStringProc */
#else /* !TCL_WIDE_INT_IS_LONG */
UpdateStringOfWideInt, /* updateStringProc */
#endif /* TCL_WIDE_INT_IS_LONG */
SetWideIntFromAny /* setFromAnyProc */
};
/*
* The structure below defines the Tcl obj hash key type.
*/
Tcl_HashKeyType tclObjHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
0, /* flags */
| > > > > > > > > | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
#ifdef TCL_WIDE_INT_IS_LONG
UpdateStringOfInt, /* updateStringProc */
#else /* !TCL_WIDE_INT_IS_LONG */
UpdateStringOfWideInt, /* updateStringProc */
#endif /* TCL_WIDE_INT_IS_LONG */
SetWideIntFromAny /* setFromAnyProc */
};
Tcl_ObjType tclBignumType = {
"bignum", /* name */
FreeBignum, /* freeIntRepProc */
DupBignum, /* dupIntRepProc */
UpdateStringOfBignum, /* updateStringProc */
SetBignumFromAny /* setFromAnyProc */
};
/*
* The structure below defines the Tcl obj hash key type.
*/
Tcl_HashKeyType tclObjHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
0, /* flags */
|
| ︙ | ︙ | |||
270 271 272 273 274 275 276 |
TclInitObjSubsystem()
{
Tcl_MutexLock(&tableMutex);
typeTableInitialized = 1;
Tcl_InitHashTable(&typeTable, TCL_STRING_KEYS);
Tcl_MutexUnlock(&tableMutex);
| < | | < < < < | | 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 |
TclInitObjSubsystem()
{
Tcl_MutexLock(&tableMutex);
typeTableInitialized = 1;
Tcl_InitHashTable(&typeTable, TCL_STRING_KEYS);
Tcl_MutexUnlock(&tableMutex);
Tcl_RegisterObjType(&tclByteArrayType);
Tcl_RegisterObjType(&tclDoubleType);
Tcl_RegisterObjType(&tclEndOffsetType);
Tcl_RegisterObjType(&tclIntType);
Tcl_RegisterObjType(&tclWideIntType);
Tcl_RegisterObjType( &tclBignumType );
Tcl_RegisterObjType(&tclStringType);
Tcl_RegisterObjType(&tclDictType);
Tcl_RegisterObjType(&tclByteCodeType);
Tcl_RegisterObjType(&tclArraySearchType);
Tcl_RegisterObjType(&tclNsNameType);
Tcl_RegisterObjType(&tclCmdNameType);
Tcl_RegisterObjType(&tclRegexpType);
Tcl_RegisterObjType(&tclProcBodyType);
#ifdef TCL_COMPILE_STATS
Tcl_MutexLock(&tclObjMutex);
tclObjsAlloced = 0;
tclObjsFreed = 0;
{
int i;
|
| ︙ | ︙ | |||
771 772 773 774 775 776 777 |
TclFreeObj(objPtr)
register Tcl_Obj *objPtr; /* The object to be freed. */
{
register Tcl_ObjType *typePtr = objPtr->typePtr;
/*
* This macro declares a variable, so must come here...
*/
| | | | | | | | | | > > > > > > > > > > > > > > > | > | | | > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > | 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 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 |
TclFreeObj(objPtr)
register Tcl_Obj *objPtr; /* The object to be freed. */
{
register Tcl_ObjType *typePtr = objPtr->typePtr;
/*
* This macro declares a variable, so must come here...
*/
ObjInitDeletionContext(context);
if (objPtr->refCount < -1) {
Tcl_Panic("Reference count for %lx was negative", objPtr);
}
if (ObjDeletePending(context)) {
PushObjToDelete(context, objPtr);
} else {
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
ObjDeletionLock(context);
typePtr->freeIntRepProc(objPtr);
ObjDeletionUnlock(context);
}
Tcl_InvalidateStringRep(objPtr);
Tcl_MutexLock(&tclObjMutex);
ckfree((char *) objPtr);
Tcl_MutexUnlock(&tclObjMutex);
#ifdef TCL_COMPILE_STATS
tclObjsFreed++;
#endif /* TCL_COMPILE_STATS */
ObjDeletionLock(context);
while (ObjOnStack(context)) {
Tcl_Obj *objToFree;
PopObjToDelete(context,objToFree);
TclFreeIntRep(objToFree);
Tcl_MutexLock(&tclObjMutex);
ckfree((char *) objToFree);
Tcl_MutexUnlock(&tclObjMutex);
#ifdef TCL_COMPILE_STATS
tclObjsFreed++;
#endif /* TCL_COMPILE_STATS */
}
ObjDeletionUnlock(context);
}
}
#else /* TCL_MEM_DEBUG */
void
TclFreeObj(objPtr)
register Tcl_Obj *objPtr; /* The object to be freed. */
{
if (!objPtr->typePtr || !objPtr->typePtr->freeIntRepProc) {
/*
* objPtr can be freed safely, as it will not attempt to free any
* other objects: it will not cause recursive calls to this function.
*/
if (objPtr->bytes && (objPtr->bytes != tclEmptyStringRep)) {
ckfree((char *) objPtr->bytes);
}
TclFreeObjStorage(objPtr);
TclIncrObjsFreed();
} else {
/*
* This macro declares a variable, so must come here...
*/
ObjInitDeletionContext(context);
if (ObjDeletePending(context)) {
PushObjToDelete(context, objPtr);
} else {
/*
* Note that the contents of the while loop assume that the string
* rep has already been freed and we don't want to do anything
* fancy with adding to the queue inside ourselves. Must take care
* to unstack the object first since freeing the internal rep can
* add further objects to the stack. The code assumes that it is
* the first thing in a block; all current usages in the core
* satisfy this.
*/
ObjDeletionLock(context);
objPtr->typePtr->freeIntRepProc(objPtr);
ObjDeletionUnlock(context);
if (objPtr->bytes && (objPtr->bytes != tclEmptyStringRep)) {
ckfree((char *) objPtr->bytes);
}
TclFreeObjStorage(objPtr);
TclIncrObjsFreed();
ObjDeletionLock(context);
while (ObjOnStack(context)) {
Tcl_Obj *objToFree;
PopObjToDelete(context,objToFree);
if ((objToFree->typePtr != NULL)
&& (objToFree->typePtr->freeIntRepProc != NULL)) {
objToFree->typePtr->freeIntRepProc(objToFree);
}
TclFreeObjStorage(objToFree);
TclIncrObjsFreed();
}
ObjDeletionUnlock(context);
}
}
}
#endif
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
986 987 988 989 990 991 992 |
*/
void
Tcl_InvalidateStringRep(objPtr)
register Tcl_Obj *objPtr; /* Object whose string rep byte pointer
* should be freed. */
{
| < | < | < | < | 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 |
*/
void
Tcl_InvalidateStringRep(objPtr)
register Tcl_Obj *objPtr; /* Object whose string rep byte pointer
* should be freed. */
{
TclInvalidateStringRep(objPtr);
}
/*
*----------------------------------------------------------------------
*
* Tcl_NewBooleanObj --
*
* This procedure is normally called when not debugging: i.e., when
|
| ︙ | ︙ | |||
1035 1036 1037 1038 1039 1040 1041 |
Tcl_Obj *
Tcl_NewBooleanObj(boolValue)
register int boolValue; /* Boolean used to initialize new object. */
{
register Tcl_Obj *objPtr;
| | < < < < | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
Tcl_Obj *
Tcl_NewBooleanObj(boolValue)
register int boolValue; /* Boolean used to initialize new object. */
{
register Tcl_Obj *objPtr;
TclNewBooleanObj(objPtr, boolValue);
return objPtr;
}
#endif /* TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1086 1087 1088 1089 1090 1091 1092 |
{
register Tcl_Obj *objPtr;
TclDbNewObj(objPtr, file, line);
objPtr->bytes = NULL;
objPtr->internalRep.longValue = (boolValue? 1 : 0);
| | | 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 |
{
register Tcl_Obj *objPtr;
TclDbNewObj(objPtr, file, line);
objPtr->bytes = NULL;
objPtr->internalRep.longValue = (boolValue? 1 : 0);
objPtr->typePtr = &tclIntType;
return objPtr;
}
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_DbNewBooleanObj(boolValue, file, line)
|
| ︙ | ︙ | |||
1131 1132 1133 1134 1135 1136 1137 |
register Tcl_Obj *objPtr; /* Object whose internal rep to init. */
register int boolValue; /* Boolean used to set object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetBooleanObj called with shared object");
}
| | < < < | | < < | > > | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | > > | | > > > > > | > | | 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 |
register Tcl_Obj *objPtr; /* Object whose internal rep to init. */
register int boolValue; /* Boolean used to set object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetBooleanObj called with shared object");
}
TclSetBooleanObj(objPtr, boolValue);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetBooleanFromObj --
*
* Attempt to return a boolean from the Tcl object "objPtr". This
* includes conversion from any of Tcl's numeric types.
*
* Results:
* The return value is a standard Tcl object result. If an error occurs
* during conversion, an error message is left in the interpreter's
* result unless "interp" is NULL.
*
* Side effects:
* The intrep of *objPtr may be changed.
*
*----------------------------------------------------------------------
*/
int
Tcl_GetBooleanFromObj(interp, objPtr, boolPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object from which to get boolean. */
register int *boolPtr; /* Place to store resulting boolean. */
{
double d;
long l;
/*
* The flow through this routine is "optimized" to avoid the
* generation of string rep. for "pure" numeric values. However,
* once the string rep is generated it's fairly inefficient at
* determining a string is *not* a valid boolean. It has to
* scan the string as many as four times (ruling out "double",
* "long", "wideint", and "boolean" in turn) to figure out that
* an invalid boolean value is stored in objPtr->bytes.
*/
if (objPtr->typePtr == &tclIntType) {
*boolPtr = (int) (objPtr->internalRep.longValue != 0);
return TCL_OK;
}
if (objPtr->typePtr == &tclBooleanType) {
*boolPtr = (int) objPtr->internalRep.longValue;
return TCL_OK;
}
if (objPtr->typePtr == &tclWideIntType) {
*boolPtr = (int) (objPtr->internalRep.wideValue != 0);
return TCL_OK;
}
/*
* Caution: Don't be tempted to check directly for the
* "double" Tcl_ObjType and then compare the intrep to 0.0.
* This isn't reliable because a "double" Tcl_ObjType can
* hold the NaN value. Use the API Tcl_GetDoubleFromObj,
* which does the checking for us.
*/
/*
* The following call retrieves a numeric value without
* generating the string rep of a double.
*/
if (Tcl_GetDoubleFromObj(NULL, objPtr, &d) == TCL_OK) {
*boolPtr = (d != 0.0);
/* Tcl_GetDoubleFromObj() will succeed on the strings "0"
* and "1", but we'd rather keep those values around as
* a better objType for boolean value. Following call
* will shimmer appropriately.
*/
if (objPtr->bytes != NULL) {
SetBooleanFromAny(NULL, objPtr);
}
return TCL_OK;
}
/*
* Value didn't already have a numeric intrep, but perhaps we can
* generate one. Try a long value first...
*/
if (Tcl_GetLongFromObj(NULL, objPtr, &l) == TCL_OK) {
*boolPtr = (l != 0);
return TCL_OK;
}
#ifndef TCL_WIDE_INT_IS_LONG
else {
Tcl_WideInt w;
/*
* ...then a wide. Check in that order so that we don't promote
* anything to wide unnecessarily.
*/
if (Tcl_GetWideIntFromObj(NULL, objPtr, &w) == TCL_OK) {
*boolPtr = (w != 0);
return TCL_OK;
}
}
#endif
/*
* Finally, check for the string values like "yes"
* and generate error message for non-boolean values.
*/
if (SetBooleanFromAny(interp, objPtr) == TCL_OK) {
*boolPtr = (int) objPtr->internalRep.longValue;
return TCL_OK;
}
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* SetBooleanFromAny --
*
|
| ︙ | ︙ | |||
1203 1204 1205 1206 1207 1208 1209 |
*/
static int
SetBooleanFromAny(interp, objPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object to convert. */
{
| < < | | < > > | | | < < < < > | | | > > > | > | > > | | | < | > > | | | | | | < < | | > > | | | > | < > | < < | < | > > > < < | | | < | > > > | > > > > > > > | > > > > | < | < | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < > | > > > > > > | 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 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 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 |
*/
static int
SetBooleanFromAny(interp, objPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object to convert. */
{
char *str, lowerCase[6];
int i, newBool, length;
/*
* For some "pure" numeric Tcl_ObjTypes (no string rep), we can
* determine whether a boolean conversion is possible without
* generating the string rep.
*/
if (objPtr->bytes == NULL) {
if (objPtr->typePtr == &tclDoubleType) {
goto badBoolean;
}
if (objPtr->typePtr == &tclIntType) {
switch (objPtr->internalRep.longValue) {
case 0L: case 1L:
return TCL_OK;
}
goto badBoolean;
}
if (objPtr->typePtr == &tclWideIntType) {
Tcl_WideInt w = objPtr->internalRep.wideValue;
if ( w == 0 || w == 1 ) {
newBool = (int)w;
goto numericBoolean;
} else {
goto badBoolean;
}
}
}
/*
* Parse the string as a boolean. We use an implementation here
* that doesn't report errors in interp if interp is NULL.
*/
str = Tcl_GetStringFromObj(objPtr, &length);
if ((length == 0) || (length > 5)) {
/* longest valid boolean string rep. is "false" */
goto badBoolean;
}
switch (str[0]) {
case '0':
if (length == 1) {
newBool = 0;
goto numericBoolean;
}
goto badBoolean;
case '1':
if (length == 1) {
newBool = 1;
goto numericBoolean;
}
goto badBoolean;
}
/*
* Force to lower case for case-insensitive detection.
* Filter out known invalid characters at the same time.
*/
for (i=0; i < length; i++) {
char c = str[i];
switch (c) {
case 'A': case 'E': case 'F': case 'L': case 'N':
case 'O': case 'R': case 'S': case 'T': case 'U': case 'Y':
lowerCase[i] = c + (char) ('a' - 'A'); break;
case 'a': case 'e': case 'f': case 'l': case 'n':
case 'o': case 'r': case 's': case 't': case 'u': case 'y':
lowerCase[i] = c; break;
default:
goto badBoolean;
}
}
lowerCase[length] = 0;
switch (lowerCase[0]) {
case 'y':
/*
* Checking the 'y' is redundant, but makes the code clearer.
*/
if (strncmp(lowerCase, "yes", (size_t) length) == 0) {
newBool = 1;
goto goodBoolean;
}
goto badBoolean;
case 'n':
if (strncmp(lowerCase, "no", (size_t) length) == 0) {
newBool = 0;
goto goodBoolean;
}
goto badBoolean;
case 't':
if (strncmp(lowerCase, "true", (size_t) length) == 0) {
newBool = 1;
goto goodBoolean;
}
goto badBoolean;
case 'f':
if (strncmp(lowerCase, "false", (size_t) length) == 0) {
newBool = 0;
goto goodBoolean;
}
goto badBoolean;
case 'o':
if (length < 2) {
goto badBoolean;
}
if (strncmp(lowerCase, "on", (size_t) length) == 0) {
newBool = 1;
goto goodBoolean;
} else if (strncmp(lowerCase, "off", (size_t) length) == 0) {
newBool = 0;
goto goodBoolean;
}
goto badBoolean;
default:
goto badBoolean;
}
/*
* Free the old internalRep before setting the new one. We do this as
* late as possible to allow the conversion code, in particular
* Tcl_GetStringFromObj, to use that old internalRep.
*/
goodBoolean:
TclFreeIntRep(objPtr);
objPtr->internalRep.longValue = newBool;
objPtr->typePtr = &tclBooleanType;
return TCL_OK;
badBoolean:
if (interp != NULL) {
Tcl_Obj *msg =
Tcl_NewStringObj("expected boolean value but got \"", -1);
str = Tcl_GetStringFromObj(objPtr, &length);
TclAppendLimitedToObj(msg, str, length, 50, "");
Tcl_AppendToObj(msg, "\"", -1);
Tcl_SetObjResult(interp, msg);
}
return TCL_ERROR;
numericBoolean:
TclFreeIntRep(objPtr);
objPtr->internalRep.longValue = newBool;
objPtr->typePtr = &tclIntType;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* UpdateStringOfBoolean --
*
|
| ︙ | ︙ | |||
1490 1491 1492 1493 1494 1495 1496 |
Tcl_Obj *
Tcl_NewDoubleObj(dblValue)
register double dblValue; /* Double used to initialize the object. */
{
register Tcl_Obj *objPtr;
| | < < < < | 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 |
Tcl_Obj *
Tcl_NewDoubleObj(dblValue)
register double dblValue; /* Double used to initialize the object. */
{
register Tcl_Obj *objPtr;
TclNewDoubleObj(objPtr, dblValue);
return objPtr;
}
#endif /* if TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1586 1587 1588 1589 1590 1591 1592 |
register Tcl_Obj *objPtr; /* Object whose internal rep to init. */
register double dblValue; /* Double used to set the object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetDoubleObj called with shared object");
}
| | < < < | 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 |
register Tcl_Obj *objPtr; /* Object whose internal rep to init. */
register double dblValue; /* Double used to set the object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetDoubleObj called with shared object");
}
TclSetDoubleObj(objPtr, dblValue);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetDoubleFromObj --
*
|
| ︙ | ︙ | |||
1621 1622 1623 1624 1625 1626 1627 |
Tcl_GetDoubleFromObj(interp, objPtr, dblPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object from which to get a double. */
register double *dblPtr; /* Place to store resulting double. */
{
register int result;
| | | | | > > > > | | < < | > > > > > | > > > | | 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 1775 1776 1777 1778 1779 1780 1781 1782 |
Tcl_GetDoubleFromObj(interp, objPtr, dblPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object from which to get a double. */
register double *dblPtr; /* Place to store resulting double. */
{
register int result;
if (objPtr->typePtr == &tclIntType) {
*dblPtr = objPtr->internalRep.longValue;
return TCL_OK;
} else if (objPtr->typePtr == &tclWideIntType) {
*dblPtr = (double) objPtr->internalRep.wideValue;
return TCL_OK;
} else if (objPtr->typePtr != &tclDoubleType) {
result = SetDoubleFromAny(interp, objPtr);
if ( result != TCL_OK ) {
return TCL_ERROR;
}
}
if ( IS_NAN( objPtr->internalRep.doubleValue ) ) {
if ( interp != NULL ) {
Tcl_SetObjResult
( interp,
Tcl_NewStringObj( "floating point value is Not a Number",
-1 ) );
}
return TCL_ERROR;
}
*dblPtr = objPtr->internalRep.doubleValue;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* SetDoubleFromAny --
*
|
| ︙ | ︙ | |||
1661 1662 1663 1664 1665 1666 1667 |
*/
static int
SetDoubleFromAny(interp, objPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object to convert. */
{
| | | < < < < < < > > > > > > > | 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 |
*/
static int
SetDoubleFromAny(interp, objPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object to convert. */
{
CONST char *string, *end;
double newDouble;
int length;
/*
* Get the string representation. Make it up-to-date if necessary.
*/
string = Tcl_GetStringFromObj(objPtr, &length);
/*
* Now parse "objPtr"s string as an double. Numbers can't have embedded
* NULLs. We use an implementation here that doesn't report errors in
* interp if interp is NULL.
*/
errno = 0;
newDouble = TclStrToD(string, &end);
if (end == string) {
badDouble:
if (interp != NULL) {
Tcl_Obj *msg = Tcl_NewStringObj(
"expected floating-point number but got \"", -1);
TclAppendLimitedToObj(msg, string, length, 50, "");
Tcl_AppendToObj(msg, "\"", -1);
Tcl_SetObjResult(interp, msg);
}
return TCL_ERROR;
}
/*
* Make sure that the string has no garbage after the end of the double.
*/
while ((end < (string+length))
&& isspace(UCHAR(*end))) { /* INTL: ISO space. */
end++;
}
if (end != (string+length)) {
goto badDouble;
}
if (errno != 0 && errno != ERANGE) {
if (interp != NULL) {
TclExprFloatError(interp, newDouble);
}
return TCL_ERROR;
}
/*
* The conversion to double succeeded. Free the old internalRep before
* setting the new one. We do this as late as possible to allow the
* conversion code, in particular Tcl_GetStringFromObj, to use that old
* internalRep.
*/
|
| ︙ | ︙ | |||
1807 1808 1809 1810 1811 1812 1813 |
Tcl_Obj *
Tcl_NewIntObj(intValue)
register int intValue; /* Int used to initialize the new object. */
{
register Tcl_Obj *objPtr;
| | < < < < | 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 |
Tcl_Obj *
Tcl_NewIntObj(intValue)
register int intValue; /* Int used to initialize the new object. */
{
register Tcl_Obj *objPtr;
TclNewIntObj(objPtr, intValue);
return objPtr;
}
#endif /* if TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1843 1844 1845 1846 1847 1848 1849 |
register Tcl_Obj *objPtr; /* Object whose internal rep to init. */
register int intValue; /* Integer used to set object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetIntObj called with shared object");
}
| | < < < | 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 |
register Tcl_Obj *objPtr; /* Object whose internal rep to init. */
register int intValue; /* Integer used to set object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetIntObj called with shared object");
}
TclSetIntObj(objPtr, intValue);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetIntFromObj --
*
|
| ︙ | ︙ | |||
1881 1882 1883 1884 1885 1886 1887 |
int
Tcl_GetIntFromObj(interp, objPtr, intPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object from which to get a int. */
register int *intPtr; /* Place to store resulting int. */
{
| < > | < < < < < < < < < < < < > | < < < < < < | < < < < | | < < | < | > | | | | > > > | 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 |
int
Tcl_GetIntFromObj(interp, objPtr, intPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object from which to get a int. */
register int *intPtr; /* Place to store resulting int. */
{
int result;
Tcl_WideInt w = 0;
/* If the object isn't already an integer of any width, try to
* convert it to one.
*/
if (objPtr->typePtr != &tclIntType && objPtr->typePtr != &tclWideIntType) {
result = SetIntOrWideFromAny(interp, objPtr);
if (result != TCL_OK) {
return result;
}
}
/* Object should now be either int or wide. Get its value. */
#ifndef TCL_WIDE_INT_IS_LONG
if (objPtr->typePtr == &tclWideIntType) {
w = objPtr->internalRep.wideValue;
} else
#endif
{
w = Tcl_LongAsWide(objPtr->internalRep.longValue);
}
if ((LLONG_MAX > UINT_MAX)
&& ((w > UINT_MAX) || (w < -(Tcl_WideInt)UINT_MAX))) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"integer value too large to represent as non-long integer",
-1));
}
return TCL_ERROR;
}
*intPtr = (int)w;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* SetIntFromAny --
*
|
| ︙ | ︙ | |||
2007 2008 2009 2010 2011 2012 2013 |
register Tcl_Obj *objPtr; /* The object to convert. */
{
char *string, *end;
int length;
register char *p;
unsigned long newLong;
int isNegative = 0;
| < | | > | 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 |
register Tcl_Obj *objPtr; /* The object to convert. */
{
char *string, *end;
int length;
register char *p;
unsigned long newLong;
int isNegative = 0;
/*
* Get the string representation. Make it up-to-date if necessary.
*/
p = string = Tcl_GetStringFromObj(objPtr, &length);
/*
* Now parse "objPtr"s string as an int. We use an implementation here
* that doesn't report errors in interp if interp is NULL. Note: use
* strtoul instead of strtol for integer conversions to allow full-size
* unsigned numbers. We parse the leading space and sign ourselves so
* we can tell the difference between apparently positive and negative
* values.
*/
errno = 0;
for (; isspace(UCHAR(*p)) ; p++) { /* INTL: ISO space. */
/* Empty loop body. */
}
if (*p == '-') {
|
| ︙ | ︙ | |||
2049 2050 2051 2052 2053 2054 2055 |
}
return TCL_ERROR;
}
newLong = strtoul(p, &end, 0);
if (end == p) {
goto badInteger;
}
| < < < < < < < < < > > | < < > > | | < < < < > > > > > | > > | > > | 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 |
}
return TCL_ERROR;
}
newLong = strtoul(p, &end, 0);
if (end == p) {
goto badInteger;
}
/*
* Make sure that the string has no garbage after the end of the int.
*/
while ((end < (string+length))
&& isspace(UCHAR(*end))) { /* INTL: ISO space. */
end++;
}
if (end != (string+length)) {
goto badInteger;
}
if (errno == ERANGE) {
if (interp != NULL) {
CONST char *s = "integer value too large to represent";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, (char *) NULL);
}
return TCL_ERROR;
}
/*
* The conversion to int succeeded. Free the old internalRep before
* setting the new one. We do this as late as possible to allow the
* conversion code, in particular Tcl_GetStringFromObj, to use that old
* internalRep.
*/
TclFreeIntRep(objPtr);
#ifndef TCL_WIDE_INT_IS_LONG
/*
* If the resulting integer will exceed the range of a long,
* put it into a wide instead. (Tcl Bug #868489)
*/
if ((isNegative && newLong > (unsigned long) (LONG_MAX) + 1)
|| (!isNegative && newLong > LONG_MAX)) {
objPtr->internalRep.wideValue =
(isNegative ? -(Tcl_WideInt)newLong : (Tcl_WideInt)newLong);
objPtr->typePtr = &tclWideIntType;
} else
#endif
{
objPtr->internalRep.longValue =
(isNegative ? -(long)newLong : (long)newLong);
objPtr->typePtr = &tclIntType;
}
return TCL_OK;
}
|
| ︙ | ︙ | |||
2185 2186 2187 2188 2189 2190 2191 |
Tcl_Obj *
Tcl_NewLongObj(longValue)
register long longValue; /* Long integer used to initialize the
* new object. */
{
register Tcl_Obj *objPtr;
| | < < < < | 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 |
Tcl_Obj *
Tcl_NewLongObj(longValue)
register long longValue; /* Long integer used to initialize the
* new object. */
{
register Tcl_Obj *objPtr;
TclNewLongObj(objPtr, longValue);
return objPtr;
}
#endif /* if TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
2291 2292 2293 2294 2295 2296 2297 |
register long longValue; /* Long integer used to initialize the
* object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetLongObj called with shared object");
}
| < | < < | 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 |
register long longValue; /* Long integer used to initialize the
* object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetLongObj called with shared object");
}
TclSetLongObj(objPtr, longValue);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetLongFromObj --
*
|
| ︙ | ︙ | |||
2404 2405 2406 2407 2408 2409 2410 |
p = string = Tcl_GetStringFromObj(objPtr, &length);
/*
* Now parse "objPtr"s string as an int. We use an implementation here
* that doesn't report errors in interp if interp is NULL. Note: use
* strtoull instead of strtoll for integer conversions to allow full-size
| | < < < < < < < < < < | < < < < < < < < < < < < > > > > > > > > | 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 2553 2554 2555 |
p = string = Tcl_GetStringFromObj(objPtr, &length);
/*
* Now parse "objPtr"s string as an int. We use an implementation here
* that doesn't report errors in interp if interp is NULL. Note: use
* strtoull instead of strtoll for integer conversions to allow full-size
* unsigned numbers.
*/
errno = 0;
newWide = strtoull(p, &end, 0);
if (end == p) {
badInteger:
if (interp != NULL) {
Tcl_Obj *msg =
Tcl_NewStringObj("expected integer but got \"", -1);
TclAppendLimitedToObj(msg, string, length, 50, "");
Tcl_AppendToObj(msg, "\"", -1);
Tcl_SetObjResult(interp, msg);
TclCheckBadOctal(interp, string);
}
return TCL_ERROR;
}
/*
* Make sure that the string has no garbage after the end of the int.
*/
while ((end < (string+length))
&& isspace(UCHAR(*end))) { /* INTL: ISO space. */
end++;
}
if (end != (string+length)) {
goto badInteger;
}
if (errno == ERANGE) {
if (interp != NULL) {
CONST char *s = "integer value too large to represent";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, (char *) NULL);
}
return TCL_ERROR;
}
/*
* The conversion to int succeeded. Free the old internalRep before
* setting the new one. We do this as late as possible to allow the
* conversion code, in particular Tcl_GetStringFromObj, to use that old
* internalRep.
*/
|
| ︙ | ︙ | |||
2561 2562 2563 2564 2565 2566 2567 |
Tcl_Obj *
Tcl_NewWideIntObj(wideValue)
register Tcl_WideInt wideValue; /* Wide integer used to initialize
* the new object. */
{
register Tcl_Obj *objPtr;
| | < < < < | 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 |
Tcl_Obj *
Tcl_NewWideIntObj(wideValue)
register Tcl_WideInt wideValue; /* Wide integer used to initialize
* the new object. */
{
register Tcl_Obj *objPtr;
TclNewWideIntObj(objPtr, wideValue);
return objPtr;
}
#endif /* if TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
2670 2671 2672 2673 2674 2675 2676 |
register Tcl_WideInt wideValue; /* Wide integer used to initialize
* the object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetWideIntObj called with shared object");
}
| < | < < | 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 |
register Tcl_WideInt wideValue; /* Wide integer used to initialize
* the object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("Tcl_SetWideIntObj called with shared object");
}
TclSetWideIntObj(objPtr, wideValue);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetWideIntFromObj --
*
|
| ︙ | ︙ | |||
2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 |
}
result = SetWideIntFromAny(interp, objPtr);
if (result == TCL_OK) {
*wideIntPtr = objPtr->internalRep.wideValue;
}
return result;
}
/*
*----------------------------------------------------------------------
*
* Tcl_DbIncrRefCount --
*
* This procedure is normally called when debugging: i.e., when
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 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 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 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 |
}
result = SetWideIntFromAny(interp, objPtr);
if (result == TCL_OK) {
*wideIntPtr = objPtr->internalRep.wideValue;
}
return result;
}
/*
*----------------------------------------------------------------------
*
* FreeBignum --
*
* This procedure frees the internal rep of a bignum.
*
* Results:
* None.
*
*----------------------------------------------------------------------
*/
static void
FreeBignum( Tcl_Obj* objPtr )
{
mp_int toFree; /* Bignum to free */
UNPACK_BIGNUM( objPtr, toFree );
mp_clear( &toFree );
}
/*
*----------------------------------------------------------------------
*
* DupBignum --
*
* This procedure duplicates the internal rep of a bignum.
*
* Results:
* None.
*
* Side effects:
* The destination object receies a copy of the source object
*
*----------------------------------------------------------------------
*/
static void
DupBignum( srcPtr, copyPtr )
Tcl_Obj* srcPtr;
Tcl_Obj* copyPtr;
{
mp_int bignumVal;
mp_int bignumCopy;
copyPtr->typePtr = &tclBignumType;
UNPACK_BIGNUM( srcPtr, bignumVal );
if ( mp_init_copy( &bignumCopy, &bignumVal ) != MP_OKAY ) {
Tcl_Panic( "initialization failure in DupBignum" );
}
PACK_BIGNUM( bignumVal, copyPtr );
}
/*
*----------------------------------------------------------------------
*
* SetBignumFromAny --
*
* This procedure interprets a Tcl_Obj as a bignum and sets
* the internal representation accordingly.
*
* Results:
* Returns a standard Tcl status. If conversion fails, an
* error message is left in the interpreter result.
*
* Side effects:
* The bignum internal representation is packed into the object.
*
*----------------------------------------------------------------------
*/
static int
SetBignumFromAny( interp, objPtr )
Tcl_Interp* interp;
Tcl_Obj* objPtr;
{
CONST char* stringVal;
CONST char* p;
int length;
int signum = MP_ZPOS;
int radix = 10;
int status;
mp_int bignumVal;
if ( objPtr->typePtr == &tclIntType ) {
/*
* If the number already contains an integer, simply widen it to
* a bignum.
*/
TclBNInitBignumFromLong( &bignumVal, objPtr->internalRep.longValue );
} else {
/*
* The number doesn't contain an integer. Convert its string rep
* to a bignum, handling 0XXX and 0xXXX notation
*/
stringVal = Tcl_GetStringFromObj( objPtr, &length );
p = stringVal;
/*
* Pull off the signum
*/
if ( *p == '+' ) {
++p;
} else if ( *p == '-' ) {
++p;
signum = MP_NEG;
}
/*
* Handle octal and hexadecimal
*/
if ( *p == '0' ) {
++p;
if ( *p == 'x' || *p == 'X' ) {
++p;
radix = 16;
} else {
--p;
radix = 8;
}
}
/* Convert the value */
if ( mp_init( &bignumVal ) != MP_OKAY ) {
Tcl_Panic( "initialization failure in SetBignumFromAny" );
}
status = mp_read_radix( &bignumVal, p, radix );
switch ( status ) {
case MP_MEM:
Tcl_Panic( "out of memory in SetBignumFromAny" );
case MP_OKAY:
break;
default:
{
if ( interp != NULL ) {
Tcl_Obj* msg
= Tcl_NewStringObj( "expected integer but got \"",
-1 );
TclAppendLimitedToObj( msg, stringVal, length, 50, "" );
Tcl_AppendToObj( msg, "\"", -1 );
Tcl_SetObjResult( interp, msg );
TclCheckBadOctal( interp, stringVal );
}
mp_clear( &bignumVal );
return TCL_ERROR;
}
}
/* Conversion to bignum succeeded. Make sure that everything fits. */
if ( bignumVal.alloc > 0x7fff ) {
Tcl_Obj* msg
= Tcl_NewStringObj( "integer value too large to represent", -1 );
Tcl_SetObjResult( interp, msg );
mp_clear( &bignumVal );
return TCL_ERROR;
}
}
/*
* Conversion succeeded. Clean up the old internal rep and
* store the new one.
*/
TclFreeIntRep( objPtr );
bignumVal.sign = signum;
PACK_BIGNUM( bignumVal, objPtr );
objPtr->typePtr = &tclBignumType;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* UpdateStringOfBignum --
*
* This procedure updates the string representation of a bignum
* object.
*
* Results:
* None.
*
* Side effects:
* The object's string is set to whatever results from the bignum-
* to-string conversion.
*
* The object's existing string representation is NOT freed; memory
* will leak if the string rep is still valid at the time this procedure
* is called.
*/
static void
UpdateStringOfBignum( Tcl_Obj* objPtr )
{
mp_int bignumVal;
int size;
int status;
char* stringVal;
UNPACK_BIGNUM( objPtr, bignumVal );
status = mp_radix_size( &bignumVal, 10, &size );
if ( status != MP_OKAY ) {
Tcl_Panic( "radix size failure in UpdateStringOfBignum" );
}
stringVal = Tcl_Alloc( (size_t) size );
status = mp_toradix_n( &bignumVal, stringVal, 10, size );
if ( status != MP_OKAY ) {
Tcl_Panic( "conversion failure in UpdateStringOfBignum" );
}
objPtr->bytes = stringVal;
objPtr->length = size - 1; /* size includes a trailing null byte */
}
/*
*----------------------------------------------------------------------
*
* Tcl_NewBignumObj --
*
* Creates an initializes a bignum object.
*
* Results:
* Returns the newly created object.
*
* Side effects:
* The bignum value is cleared, since ownership has transferred
* to Tcl.
*
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
#undef Tcl_NewBignumObj
Tcl_Obj*
Tcl_NewBignumObj( mp_int* bignumValue )
{
return Tcl_DbNewBignumObj( bignumValue, "unknown", 0 );
}
#else
Tcl_Obj *
Tcl_NewBignumObj( mp_int* bignumValue )
{
Tcl_Obj* objPtr;
TclNewObj( objPtr );
PACK_BIGNUM( *bignumValue, objPtr );
objPtr->typePtr=&tclBignumType;
objPtr->bytes = NULL;
/* Clear with mp_init; mp_clear would overwrite the digit array. */
mp_init( bignumValue );
return objPtr;
}
#endif
/*
*----------------------------------------------------------------------
*
* Tcl_DbNewBignumObj --
*
* This procedure is normally called when debugging: that is, when
* TCL_MEM_DEBUG is defined. It constructs a bignum object, recording
* the creation point so that [memory active] can report it.
*
* Results:
* Returns the newly created object.
*
* Side effects:
* The bignum value is cleared, since ownership has transferred
* to Tcl.
*
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
Tcl_Obj*
Tcl_DbNewBignumObj( mp_int* bignumValue, CONST char* file, int line )
{
Tcl_Obj* objPtr;
TclDbNewObj( objPtr, file, line );
objPtr->bytes = NULL;
PACK_BIGNUM( *bignumValue, objPtr );
objPtr->typePtr=&tclBignumType;
objPtr->bytes = NULL;
/* Clear with mp_init; mp_clear would overwrite the digit array. */
mp_init( bignumValue );
return objPtr;
}
#else
Tcl_Obj*
Tcl_DbNewBignumObj( mp_int* bignumValue, CONST char* file, int line )
{
return Tcl_NewBignumObj( bignumValue );
}
#endif
/*
*----------------------------------------------------------------------
*
* Tcl_GetBignumFromObj --
*
* This procedure retrieves a 'bignum' value from a Tcl object,
* converting the object if necessary.
*
* Results:
* Returns TCL_OK if the conversion is successful, TCL_ERROR otherwise.
*
* Side effects:
* A copy of bignum is stored in *bignumValue, which is expected
* to be uninitialized or cleared. If conversion fails, an
* the 'interp' argument is not NULL, an error message is stored
* in the interpreter result.
*
* It is expected that the caller will NOT have invoked mp_init on the
* bignum value before passing it in. The raw value of the object is
* returned, and Tcl owns that memory, so the caller should NOT invoke
* mp_clear afterwards.
*
*----------------------------------------------------------------------
*/
int
Tcl_GetBignumFromObj( Tcl_Interp* interp,
/* Tcl interpreter for error reporting */
Tcl_Obj* objPtr,
/* Object to read */
mp_int* bignumValue )
/* Returned bignum value. */
{
mp_int temp;
if ( objPtr -> typePtr != &tclBignumType ) {
if ( SetBignumFromAny( interp, objPtr ) != TCL_OK ) {
return TCL_ERROR;
}
}
UNPACK_BIGNUM( objPtr, temp );
mp_init_copy( bignumValue, &temp );
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_SetBignumObj --
*
* This procedure sets the value of a Tcl_Obj to a large integer.
*
* Results:
* None.
*
* Side effects:
* Object value is stored. The bignum value is cleared, since
* ownership has transferred to Tcl.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetBignumObj( Tcl_Obj* objPtr,
/* Object to set */
mp_int* bignumValue )
/* Value to store */
{
if ( Tcl_IsShared( objPtr ) ) {
Tcl_Panic( "Tcl_SetBignumObj called with shared object" );
}
TclFreeIntRep( objPtr );
objPtr->typePtr = &tclBignumType;
PACK_BIGNUM( *bignumValue, objPtr );
Tcl_InvalidateStringRep( objPtr );
/* Clear the value with mp_init; mp_clear overwrites the digit array. */
mp_init( bignumValue );
}
/*
*----------------------------------------------------------------------
*
* Tcl_DbIncrRefCount --
*
* This procedure is normally called when debugging: i.e., when
|
| ︙ | ︙ |
Changes to generic/tclParse.c.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Ajuba Solutions. * Contributions from Don Porter, NIST, 2002. (not subject to US copyright) * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Copyright (c) 1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Ajuba Solutions. * Contributions from Don Porter, NIST, 2002. (not subject to US copyright) * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclParse.c,v 1.39.4.1 2005/06/13 01:46:14 msofer Exp $ */ #include "tclInt.h" /* * The following table provides parsing information about each possible * 8-bit character. The table is designed to be referenced with either |
| ︙ | ︙ | |||
239 240 241 242 243 244 245 | * eventually invoke Tcl_FreeParse to release any additional space * that was allocated. * *---------------------------------------------------------------------- */ int | | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
* eventually invoke Tcl_FreeParse to release any additional space
* that was allocated.
*
*----------------------------------------------------------------------
*/
int
Tcl_ParseCommand(interp, start, numBytes, nested, parsePtr)
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. */
register int numBytes; /* Total number of bytes in string. If < 0,
* the script consists of all bytes up to
* the first null character. */
int nested; /* Non-zero means this is a nested command:
* close bracket should be considered
* a command terminator. If zero, then close
|
| ︙ | ︙ | |||
269 270 271 272 273 274 275 |
int wordIndex; /* Index of word token for current word. */
int terminators; /* CHAR_TYPE bits that indicate the end
* of a command. */
CONST char *termPtr; /* Set by Tcl_ParseBraces/QuotedString to
* point to char after terminating one. */
int scanned;
| | | | | | | 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 |
int wordIndex; /* Index of word token for current word. */
int terminators; /* CHAR_TYPE bits that indicate the end
* of a command. */
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_SetResult(interp, "can't parse a NULL pointer", TCL_STATIC);
}
return TCL_ERROR;
}
if (numBytes < 0) {
numBytes = strlen(start);
}
TclParseInit(interp, start, numBytes, parsePtr);
parsePtr->commentStart = NULL;
parsePtr->commentSize = 0;
parsePtr->commandStart = NULL;
parsePtr->commandSize = 0;
if (nested != 0) {
terminators = TYPE_COMMAND_END | TYPE_CLOSE_BRACK;
} else {
terminators = TYPE_COMMAND_END;
}
/*
* Parse any leading space and comments before the first word of the
* command.
*/
scanned = ParseComment(start, numBytes, parsePtr);
src = (start + scanned); numBytes -= scanned;
if (numBytes == 0) {
if (nested) {
parsePtr->incomplete = nested;
}
}
/*
|
| ︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | * eventually invoke Tcl_FreeParse to release any additional space * that was allocated. * *---------------------------------------------------------------------- */ int | | | | | | | | | 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 |
* eventually invoke Tcl_FreeParse to release any additional space
* that was allocated.
*
*----------------------------------------------------------------------
*/
int
Tcl_ParseVarName(interp, start, numBytes, parsePtr, append)
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 "$". */
register int numBytes; /* Total number of bytes in string. If < 0,
* the string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr; /* Structure to fill in with information
* about the variable name. */
int append; /* Non-zero means append tokens to existing
* information in parsePtr; zero means ignore
* existing tokens in parsePtr and reinitialize
* it. */
{
Tcl_Token *tokenPtr;
register CONST char *src;
unsigned char c;
int varIndex, offset;
Tcl_UniChar ch;
unsigned array;
if ((numBytes == 0) || (start == NULL)) {
return TCL_ERROR;
}
if (numBytes < 0) {
numBytes = strlen(start);
}
if (!append) {
TclParseInit(interp, start, numBytes, parsePtr);
}
/*
* Generate one token for the variable, an additional token for the
* name, plus any number of additional tokens for the index, if
* there is one.
*/
src = start;
if ((parsePtr->numTokens + 2) > parsePtr->tokensAvailable) {
TclExpandTokenArray(parsePtr);
}
tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens];
tokenPtr->type = TCL_TOKEN_VARIABLE;
tokenPtr->start = src;
varIndex = parsePtr->numTokens;
|
| ︙ | ︙ | |||
1350 1351 1352 1353 1354 1355 1356 | * Side effects: * None. * *---------------------------------------------------------------------- */ CONST char * | | | | | | 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 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
CONST char *
Tcl_ParseVar(interp, start, termPtr)
Tcl_Interp *interp; /* Context for looking up variable. */
register CONST char *start; /* Start of variable substitution.
* First character must be "$". */
CONST char **termPtr; /* If non-NULL, points to word to fill
* in with character just after last
* one in the variable specifier. */
{
Tcl_Parse parse;
register Tcl_Obj *objPtr;
int code;
if (Tcl_ParseVarName(interp, start, -1, &parse, 0) != TCL_OK) {
return NULL;
}
if (termPtr != NULL) {
*termPtr = start + parse.tokenPtr->size;
}
if (parse.numTokens == 1) {
/*
* There isn't a variable name after all: the $ is just a $.
*/
return "$";
|
| ︙ | ︙ | |||
1432 1433 1434 1435 1436 1437 1438 | * eventually invoke Tcl_FreeParse to release any additional space * that was allocated. * *---------------------------------------------------------------------- */ int | | | | | | | | | | | 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 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 1523 1524 |
* eventually invoke Tcl_FreeParse to release any additional space
* that was allocated.
*
*----------------------------------------------------------------------
*/
int
Tcl_ParseBraces(interp, start, numBytes, parsePtr, append, termPtr)
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 {'. */
register int numBytes; /* Total number of bytes in string. If < 0,
* the string consists of all bytes up to
* the first null character. */
register Tcl_Parse *parsePtr;
/* Structure to fill in with information
* about the string. */
int append; /* Non-zero means append tokens to existing
* information in parsePtr; zero means
* ignore existing tokens in parsePtr and
* reinitialize it. */
CONST char **termPtr; /* If non-NULL, points to word in which to
* store a pointer to the character just
* after the terminating '}' if the parse
* was successful. */
{
Tcl_Token *tokenPtr;
register CONST char *src;
int startIndex, level, length;
if ((numBytes == 0) || (start == NULL)) {
return TCL_ERROR;
}
if (numBytes < 0) {
numBytes = strlen(start);
}
if (!append) {
TclParseInit(interp, start, numBytes, parsePtr);
}
src = start;
startIndex = parsePtr->numTokens;
if (parsePtr->numTokens == parsePtr->tokensAvailable) {
TclExpandTokenArray(parsePtr);
}
tokenPtr = &parsePtr->tokenPtr[startIndex];
tokenPtr->type = TCL_TOKEN_TEXT;
tokenPtr->start = src+1;
tokenPtr->numComponents = 0;
level = 1;
while (1) {
while (++src, --numBytes) {
if (CHAR_TYPE(*src) != TYPE_NORMAL) {
break;
}
}
if (numBytes == 0) {
register int openBrace = 0;
parsePtr->errorType = TCL_PARSE_MISSING_BRACE;
parsePtr->term = start;
parsePtr->incomplete = 1;
if (interp == NULL) {
/*
* Skip straight to the exit code since we have no
* interpreter to put error message in.
*/
goto error;
}
Tcl_SetResult(interp, "missing close-brace", TCL_STATIC);
/*
* Guess if the problem is due to comments by searching
* the source string for a possible open brace within the
* context of a comment. Since we aren't performing a
* full Tcl parse, just look for an open brace preceded
* by a '<whitespace>#' on the same line.
*/
for (; src > start; src--) {
switch (*src) {
case '{':
openBrace = 1;
break;
case '\n':
openBrace = 0;
break;
|
| ︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | * eventually invoke Tcl_FreeParse to release any additional space * that was allocated. * *---------------------------------------------------------------------- */ int | | | | | | | | | 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 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 |
* eventually invoke Tcl_FreeParse to release any additional space
* that was allocated.
*
*----------------------------------------------------------------------
*/
int
Tcl_ParseQuotedString(interp, start, numBytes, parsePtr, append, termPtr)
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 '"'. */
register int numBytes; /* Total number of bytes in string. If < 0,
* the string consists of all bytes up to
* the first null character. */
register Tcl_Parse *parsePtr;
/* Structure to fill in with information
* about the string. */
int append; /* Non-zero means append tokens to existing
* information in parsePtr; zero means
* ignore existing tokens in parsePtr and
* reinitialize it. */
CONST char **termPtr; /* If non-NULL, points to word in which to
* store a pointer to the character just
* after the quoted string's terminating
* close-quote if the parse succeeds. */
{
if ((numBytes == 0) || (start == NULL)) {
return TCL_ERROR;
}
if (numBytes < 0) {
numBytes = strlen(start);
}
if (!append) {
TclParseInit(interp, start, numBytes, parsePtr);
}
if (TCL_OK != ParseTokens(start+1, numBytes-1, TYPE_QUOTE,
TCL_SUBST_ALL, parsePtr)) {
goto error;
}
if (*parsePtr->term != '"') {
if (interp != NULL) {
Tcl_SetResult(parsePtr->interp, "missing \"", TCL_STATIC);
}
parsePtr->errorType = TCL_PARSE_MISSING_QUOTE;
parsePtr->term = start;
parsePtr->incomplete = 1;
goto error;
}
if (termPtr != NULL) {
*termPtr = (parsePtr->term + 1);
}
return TCL_OK;
|
| ︙ | ︙ | |||
1997 1998 1999 2000 2001 2002 2003 |
case TCL_TOKEN_BS: {
appendByteLength = Tcl_UtfBackslash(tokenPtr->start,
(int *) NULL, utfCharBytes);
append = utfCharBytes;
break;
}
| | > > > > | | > > > | 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 |
case TCL_TOKEN_BS: {
appendByteLength = Tcl_UtfBackslash(tokenPtr->start,
(int *) NULL, utfCharBytes);
append = utfCharBytes;
break;
}
case TCL_TOKEN_COMMAND: {
Interp *iPtr = (Interp *) interp;
iPtr->numLevels++;
code = TclInterpReady(interp);
if (code == TCL_OK) {
code = Tcl_EvalEx(interp,
tokenPtr->start+1, tokenPtr->size-2, 0);
}
iPtr->numLevels--;
appendObj = Tcl_GetObjResult(interp);
break;
}
case TCL_TOKEN_VARIABLE: {
Tcl_Obj *arrayIndex = NULL;
Tcl_Obj *varName = NULL;
if (tokenPtr->numComponents > 1) {
/* Subst the index part of an array variable reference */
code = TclSubstTokens(interp, tokenPtr+2,
|
| ︙ | ︙ |
Changes to generic/tclParseExpr.c.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Contributions from Don Porter, NIST, 2002. (not subject to US copyright) * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Copyright (c) 1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Contributions from Don Porter, NIST, 2002. (not subject to US copyright) * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclParseExpr.c,v 1.23.4.1 2005/06/13 01:46:15 msofer Exp $ */ #include "tclInt.h" /* * The stuff below is a bit of a hack so that this file can be used in * environments that include no UNIX, i.e. no errno: just arrange to use |
| ︙ | ︙ | |||
201 202 203 204 205 206 207 | *---------------------------------------------------------------------- * * Tcl_ParseExpr -- * * Given a string, this procedure parses the first Tcl expression * in the string and returns information about the structure of * the expression. This procedure is the top-level interface to the | | | | | | | | | | | | 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 |
*----------------------------------------------------------------------
*
* Tcl_ParseExpr --
*
* Given a string, this procedure parses the first Tcl expression
* in the string and returns information about the structure of
* the expression. This procedure is the top-level interface to the
* the expression parsing module. No more than numBytes bytes will
* be scanned.
*
* Results:
* The return value is TCL_OK if the command was parsed successfully
* and TCL_ERROR otherwise. If an error occurs and interp isn't NULL
* then an error message is left in its result. On a successful return,
* parsePtr is filled in with information about the expression that
* was parsed.
*
* Side effects:
* If there is insufficient space in parsePtr to hold all the
* information about the expression, then additional space is
* malloc-ed. If the procedure returns TCL_OK then the caller must
* eventually invoke Tcl_FreeParse to release any additional space
* that was allocated.
*
*----------------------------------------------------------------------
*/
int
Tcl_ParseExpr(interp, start, numBytes, parsePtr)
Tcl_Interp *interp; /* Used for error reporting. */
CONST char *start; /* Start of source string to parse. */
int numBytes; /* Number of bytes in string. If < 0, the
* string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr; /* Structure to fill with information about
* the parsed expression; any previous
* information in the structure is
* ignored. */
{
ParseInfo info;
int code;
if (numBytes < 0) {
numBytes = (start? strlen(start) : 0);
}
#ifdef TCL_COMPILE_DEBUG
if (traceParseExpr) {
fprintf(stderr, "Tcl_ParseExpr: string=\"%.*s\"\n",
numBytes, start);
}
#endif /* TCL_COMPILE_DEBUG */
TclParseInit(interp, start, numBytes, parsePtr);
/*
* Initialize the ParseInfo structure that holds state while parsing
* the expression.
*/
info.parsePtr = parsePtr;
info.lexeme = UNKNOWN;
info.start = NULL;
info.size = 0;
info.next = start;
info.prevEnd = start;
info.originalExpr = start;
info.lastChar = (start + numBytes); /* just after last char of expr */
/*
* Get the first lexeme then parse the expression.
*/
code = GetLexeme(&info);
if (code != TCL_OK) {
|
| ︙ | ︙ | |||
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 |
firstIndex = parsePtr->numTokens;
switch (lexeme) {
case LITERAL:
/*
* Int or double number.
*/
if (parsePtr->numTokens == parsePtr->tokensAvailable) {
TclExpandTokenArray(parsePtr);
}
tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens];
tokenPtr->type = TCL_TOKEN_TEXT;
tokenPtr->start = infoPtr->start;
tokenPtr->size = infoPtr->size;
| > | 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 |
firstIndex = parsePtr->numTokens;
switch (lexeme) {
case LITERAL:
/*
* Int or double number.
*/
tokenizeLiteral:
if (parsePtr->numTokens == parsePtr->tokensAvailable) {
TclExpandTokenArray(parsePtr);
}
tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens];
tokenPtr->type = TCL_TOKEN_TEXT;
tokenPtr->start = infoPtr->start;
tokenPtr->size = infoPtr->size;
|
| ︙ | ︙ | |||
1427 1428 1429 1430 1431 1432 1433 | tokenPtr->type = TCL_TOKEN_WORD; tokenPtr->start = exprTokenPtr->start; tokenPtr->size = exprTokenPtr->size; tokenPtr->numComponents = exprTokenPtr->numComponents-1; } break; | > > > > | | < < < < < < | < < | | | | | | | < < > | > | > | > | | < < | | | | | > > | < > > > | > > | < < < > > | > | > | > | < | > | > > > > | | 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 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 |
tokenPtr->type = TCL_TOKEN_WORD;
tokenPtr->start = exprTokenPtr->start;
tokenPtr->size = exprTokenPtr->size;
tokenPtr->numComponents = exprTokenPtr->numComponents-1;
}
break;
case STREQ:
case STRNEQ:
case IN_LIST:
case NOT_IN_LIST:
case FUNC_NAME: {
/*
* math_func '(' expr {',' expr} ')'
*/
ParseInfo savedInfo = *infoPtr;
code = GetLexeme(infoPtr); /* skip over function name */
if (code != TCL_OK) {
return code;
}
if (infoPtr->lexeme != OPEN_PAREN) {
int code;
Tcl_Obj *errMsg, *objPtr
= Tcl_NewStringObj(savedInfo.start, savedInfo.size);
/* Check for boolean literals (true, false, yes, no, on, off) */
Tcl_IncrRefCount(objPtr);
code = Tcl_ConvertToType(NULL, objPtr, &tclBooleanType);
Tcl_DecrRefCount(objPtr);
if (code == TCL_OK) {
*infoPtr = savedInfo;
goto tokenizeLiteral;
}
/*
* Either there's a math function without a (, or a
* variable name without a '$'.
*/
errMsg = Tcl_NewStringObj( "syntax error in expression \"", -1 );
TclAppendLimitedToObj( errMsg,
infoPtr->originalExpr,
(int) (infoPtr->lastChar
- infoPtr->originalExpr ),
63,
NULL );
Tcl_AppendToObj( errMsg, "\": the word \"", -1 );
Tcl_AppendToObj( errMsg, savedInfo.start, savedInfo.size );
Tcl_AppendToObj( errMsg,
"\" requires a preceding $ if it's a variable ",
-1 );
Tcl_AppendToObj( errMsg,
"or function arguments if it's a function", -1 );
Tcl_SetObjResult( infoPtr->parsePtr->interp, errMsg );
infoPtr->parsePtr->errorType = TCL_PARSE_SYNTAX;
infoPtr->parsePtr->term = infoPtr->start;
return TCL_ERROR;
}
if (parsePtr->numTokens == parsePtr->tokensAvailable) {
TclExpandTokenArray(parsePtr);
}
tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens];
tokenPtr->type = TCL_TOKEN_OPERATOR;
tokenPtr->start = savedInfo.start;
tokenPtr->size = savedInfo.size;
tokenPtr->numComponents = 0;
parsePtr->numTokens++;
code = GetLexeme(infoPtr); /* skip over '(' */
if (code != TCL_OK) {
return code;
}
while (infoPtr->lexeme != CLOSE_PAREN) {
code = ParseCondExpr(infoPtr);
|
| ︙ | ︙ | |||
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 |
}
}
exprTokenPtr = &parsePtr->tokenPtr[exprIndex];
exprTokenPtr->size = (infoPtr->next - exprTokenPtr->start);
exprTokenPtr->numComponents = parsePtr->numTokens - firstIndex;
break;
case COMMA:
LogSyntaxError(infoPtr,
"commas can only separate function arguments");
return TCL_ERROR;
case END:
LogSyntaxError(infoPtr, "premature end of expression");
| > | 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 |
}
}
exprTokenPtr = &parsePtr->tokenPtr[exprIndex];
exprTokenPtr->size = (infoPtr->next - exprTokenPtr->start);
exprTokenPtr->numComponents = parsePtr->numTokens - firstIndex;
break;
}
case COMMA:
LogSyntaxError(infoPtr,
"commas can only separate function arguments");
return TCL_ERROR;
case END:
LogSyntaxError(infoPtr, "premature end of expression");
|
| ︙ | ︙ | |||
1662 1663 1664 1665 1666 1667 1668 |
} else if ((length = ParseMaxDoubleLength(src, end))) {
/*
* There are length characters that could be a double.
* Let strtod() tells us for sure. Need a writable copy
* so we can set an terminating NULL to keep strtod from
* scanning too far.
*/
| | > | < < < < < < < | 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 |
} else if ((length = ParseMaxDoubleLength(src, end))) {
/*
* There are length characters that could be a double.
* Let strtod() tells us for sure. Need a writable copy
* so we can set an terminating NULL to keep strtod from
* scanning too far.
*/
char *startPtr;
CONST char *termPtr;
double doubleValue;
Tcl_DString toParse;
errno = 0;
Tcl_DStringInit(&toParse);
startPtr = Tcl_DStringAppend(&toParse, src, length);
doubleValue = TclStrToD(startPtr, &termPtr);
Tcl_DStringFree(&toParse);
if (termPtr != startPtr) {
/*
* startPtr was the start of a valid double, copied
* from src.
*/
infoPtr->lexeme = LITERAL;
|
| ︙ | ︙ | |||
1930 1931 1932 1933 1934 1935 1936 | offset = Tcl_UtfToUniChar(utfBytes, &ch); } c = UCHAR(ch); } infoPtr->size = (src - infoPtr->start); infoPtr->next = src; parsePtr->term = infoPtr->next; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 |
offset = Tcl_UtfToUniChar(utfBytes, &ch);
}
c = UCHAR(ch);
}
infoPtr->size = (src - infoPtr->start);
infoPtr->next = src;
parsePtr->term = infoPtr->next;
return TCL_OK;
}
infoPtr->lexeme = UNKNOWN_CHAR;
return TCL_OK;
}
}
|
| ︙ | ︙ | |||
2073 2074 2075 2076 2077 2078 2079 |
while (p < end) {
switch (*p) {
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case 'A': case 'B':
case 'C': case 'D': case 'E': case 'F': case 'I': case 'N':
case 'P': case 'X': case 'a': case 'b': case 'c': case 'd':
case 'e': case 'f': case 'i': case 'n': case 'p': case 'x':
| | | 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 |
while (p < end) {
switch (*p) {
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case 'A': case 'B':
case 'C': case 'D': case 'E': case 'F': case 'I': case 'N':
case 'P': case 'X': case 'a': case 'b': case 'c': case 'd':
case 'e': case 'f': case 'i': case 'n': case 'p': case 'x':
case '.': case '+': case '-': case '(': case ' ': case ')':
p++;
break;
default:
goto done;
}
}
done:
|
| ︙ | ︙ |
Changes to generic/tclPathObj.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclPathObj.c -- * * This file contains the implementation of Tcl's "path" object * type used to represent and manipulate a general (virtual) * filesystem entity in an efficient manner. * * Copyright (c) 2003 Vince Darley. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclPathObj.c -- * * This file contains the implementation of Tcl's "path" object * type used to represent and manipulate a general (virtual) * filesystem entity in an efficient manner. * * Copyright (c) 2003 Vince Darley. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclPathObj.c,v 1.40.2.1 2005/06/13 01:46:15 msofer Exp $ */ #include "tclInt.h" #include "tclFileSystem.h" /* * Prototypes for procedures defined later in this file. |
| ︙ | ︙ |
Changes to generic/tclPort.h.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclPort.h -- * * This header file handles porting issues that occur because * of differences between systems. It reads in platform specific * portability files. * * Copyright (c) 1994-1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclPort.h -- * * This header file handles porting issues that occur because * of differences between systems. It reads in platform specific * portability files. * * Copyright (c) 1994-1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclPort.h,v 1.14.2.1 2005/06/13 01:46:15 msofer Exp $ */ #ifndef _TCLPORT #define _TCLPORT #ifdef HAVE_TCL_CONFIG_H #include "tclConfig.h" |
| ︙ | ︙ |
Changes to generic/tclProc.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclProc.c -- * * This file contains routines that implement Tcl procedures, * including the "proc" and "uplevel" commands. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
/*
* tclProc.c --
*
* This file contains routines that implement Tcl procedures,
* including the "proc" and "uplevel" commands.
*
* Copyright (c) 1987-1993 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclProc.c,v 1.73.2.7 2005/06/13 01:46:15 msofer Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
/*
* Prototypes for static functions in this file
*/
static void ProcBodyDup _ANSI_ARGS_((Tcl_Obj *srcPtr, Tcl_Obj *dupPtr));
static void ProcBodyFree _ANSI_ARGS_((Tcl_Obj *objPtr));
static int ProcessProcResultCode _ANSI_ARGS_((Tcl_Interp *interp,
char *procName, int nameLen, int returnCode));
static int TclCompileNoOp _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Parse *parsePtr, struct CompileEnv *envPtr));
static void InitCompiledLocals _ANSI_ARGS_((Tcl_Interp *interp,
ByteCode *codePtr, CompiledLocal *localPtr,
ShortVar *varPtr, char **varNames, Namespace *nsPtr));
/*
* The ProcBodyObjType type
*/
Tcl_ObjType tclProcBodyType = {
"procbody", /* name for this type */
|
| ︙ | ︙ | |||
51 52 53 54 55 56 57 | * field, encoding the type of level reference in ptr1 and the actual * parsed out offset in ptr2. * * Uses the default behaviour throughout, and never disposes of the * string rep; it's just a cache type. */ | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
* field, encoding the type of level reference in ptr1 and the actual
* parsed out offset in ptr2.
*
* Uses the default behaviour throughout, and never disposes of the
* string rep; it's just a cache type.
*/
static Tcl_ObjType levelReferenceType = {
"levelReference",
NULL, NULL, NULL, NULL
};
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
408 409 410 411 412 413 414 |
}
p++;
}
if (precompiled) {
/*
* Compare the parsed argument with the stored one.
| < > | | | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
}
p++;
}
if (precompiled) {
/*
* Compare the parsed argument with the stored one.
*
* NOTE: code precompiled under older versions of Tcl will not
* work properly.
*/
if ((localPtr->nameLength != nameLength)
|| (strcmp(localPtr->name, fieldValues[0]))
|| (localPtr->frameIndex != i)
|| (localPtr->flags != (VAR_ARGUMENT|VAR_SHORT
|VAR_DIRECT_READABLE|VAR_DIRECT_WRITABLE))
|| (localPtr->defValuePtr == NULL && fieldCount == 2)
|| (localPtr->defValuePtr != NULL && fieldCount != 2)) {
char buf[40 + TCL_INTEGER_SPACE];
ckfree((char *) fieldValues);
sprintf(buf, "%d is inconsistent with precompiled body", i);
Tcl_AppendResult(interp, "procedure \"", procName,
|
| ︙ | ︙ | |||
473 474 475 476 477 478 479 |
} else {
procPtr->lastLocalPtr->nextPtr = localPtr;
procPtr->lastLocalPtr = localPtr;
}
localPtr->nextPtr = NULL;
localPtr->nameLength = nameLength;
localPtr->frameIndex = i;
| | > | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
} else {
procPtr->lastLocalPtr->nextPtr = localPtr;
procPtr->lastLocalPtr = localPtr;
}
localPtr->nextPtr = NULL;
localPtr->nameLength = nameLength;
localPtr->frameIndex = i;
localPtr->flags = (VAR_ARGUMENT|VAR_SHORT
|VAR_DIRECT_READABLE|VAR_DIRECT_WRITABLE);
localPtr->resolveInfo = NULL;
if (fieldCount == 2) {
localPtr->defValuePtr =
Tcl_NewStringObj(fieldValues[1], valueLength);
Tcl_IncrRefCount(localPtr->defValuePtr);
} else {
|
| ︙ | ︙ | |||
646 647 648 649 650 651 652 |
/*
* Parse object to figure out which level number to go to.
*/
result = 1;
curLevel = (iPtr->varFramePtr == NULL) ? 0 : iPtr->varFramePtr->level;
| | | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
/*
* Parse object to figure out which level number to go to.
*/
result = 1;
curLevel = (iPtr->varFramePtr == NULL) ? 0 : iPtr->varFramePtr->level;
if (objPtr->typePtr == &levelReferenceType) {
if ((int) objPtr->internalRep.twoPtrValue.ptr1) {
level = curLevel - (int) objPtr->internalRep.twoPtrValue.ptr2;
} else {
level = (int) objPtr->internalRep.twoPtrValue.ptr2;
}
if (level < 0) {
goto levelError;
|
| ︙ | ︙ | |||
670 671 672 673 674 675 676 |
if (Tcl_GetInt(interp, name+1, &level) != TCL_OK || level < 0) {
goto levelError;
}
/*
* Cache for future reference.
*/
TclFreeIntRep(objPtr);
| | | | 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 |
if (Tcl_GetInt(interp, name+1, &level) != TCL_OK || level < 0) {
goto levelError;
}
/*
* Cache for future reference.
*/
TclFreeIntRep(objPtr);
objPtr->typePtr = &levelReferenceType;
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) 0;
objPtr->internalRep.twoPtrValue.ptr2 = (VOID *) level;
} else if (isdigit(UCHAR(*name))) { /* INTL: digit */
if (Tcl_GetInt(interp, name, &level) != TCL_OK) {
return -1;
}
/*
* Cache for future reference.
*/
TclFreeIntRep(objPtr);
objPtr->typePtr = &levelReferenceType;
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) 1;
objPtr->internalRep.twoPtrValue.ptr2 = (VOID *) level;
level = curLevel - level;
} else {
/*
* Don't cache as the object *isn't* a level reference.
*/
|
| ︙ | ︙ | |||
908 909 910 911 912 913 914 | * May invoke various name resolvers in order to determine which * variables are being referenced at runtime. * *---------------------------------------------------------------------- */ static void | | | > | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 |
* May invoke various name resolvers in order to determine which
* variables are being referenced at runtime.
*
*----------------------------------------------------------------------
*/
static void
InitCompiledLocals(interp, codePtr, localPtr, varPtr, varNames, nsPtr)
Tcl_Interp *interp; /* Current interpreter. */
ByteCode *codePtr;
CompiledLocal *localPtr;
ShortVar *varPtr;
char **varNames;
Namespace *nsPtr; /* Pointer to current namespace. */
{
Interp *iPtr = (Interp*) interp;
int haveResolvers = (nsPtr->compiledVarResProc || iPtr->resolverPtr);
CompiledLocal *firstLocalPtr;
if (codePtr->flags & TCL_BYTECODE_RESOLVE_VARS) {
|
| ︙ | ︙ | |||
979 980 981 982 983 984 985 |
* Some variables may have special resolution rules. In that case,
* we call their "resolver" procs to get our hands on the variable,
* and we make the compiled local a link to the real variable.
*/
if (haveResolvers) {
Tcl_ResolvedVarInfo *resVarInfo;
| | > > | < < < < < < | > > | < < < < < < | 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 |
* Some variables may have special resolution rules. In that case,
* we call their "resolver" procs to get our hands on the variable,
* and we make the compiled local a link to the real variable.
*/
if (haveResolvers) {
Tcl_ResolvedVarInfo *resVarInfo;
for (; localPtr != NULL;
varPtr++, localPtr = localPtr->nextPtr, varNames++) {
varPtr->flags = localPtr->flags;
varPtr->value.objPtr = NULL;
*varNames = localPtr->name; /* will be just '\0' if temp var */
/*
* Now invoke the resolvers to determine the exact variables that
* should be used.
*/
resVarInfo = localPtr->resolveInfo;
if (resVarInfo && resVarInfo->fetchProc) {
Var *resolvedVarPtr = (Var*) (*resVarInfo->fetchProc)(interp,
resVarInfo);
if (resolvedVarPtr) {
resolvedVarPtr->refCount++;
varPtr->value.linkPtr = resolvedVarPtr;
varPtr->flags = VAR_LINK;
}
}
}
} else {
for (; localPtr != NULL;
varPtr++, localPtr = localPtr->nextPtr, varNames++) {
varPtr->flags = localPtr->flags;
varPtr->value.objPtr = NULL;
*varNames = localPtr->name; /* will be just '\0' if temp var */
}
}
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1046 1047 1048 1049 1050 1051 1052 |
void
TclInitCompiledLocals(interp, framePtr, nsPtr)
Tcl_Interp *interp; /* Current interpreter. */
CallFrame *framePtr; /* Call frame to initialize. */
Namespace *nsPtr; /* Pointer to current namespace. */
{
| | > | | 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 |
void
TclInitCompiledLocals(interp, framePtr, nsPtr)
Tcl_Interp *interp; /* Current interpreter. */
CallFrame *framePtr; /* Call frame to initialize. */
Namespace *nsPtr; /* Pointer to current namespace. */
{
ShortVar *varPtr = framePtr->compiledLocals;
Tcl_Obj *bodyPtr;
ByteCode *codePtr;
CompiledLocal *localPtr = framePtr->procPtr->firstLocalPtr;
char **varNames = (char **) (varPtr + framePtr->numCompiledLocals);
bodyPtr = framePtr->procPtr->bodyPtr;
if (bodyPtr->typePtr != &tclByteCodeType) {
Tcl_Panic("body object for proc attached to frame is not a byte code type");
}
codePtr = (ByteCode *) bodyPtr->internalRep.otherValuePtr;
InitCompiledLocals(interp, codePtr, localPtr, varPtr, varNames, nsPtr);
}
/*
*----------------------------------------------------------------------
*
* TclObjInterpProc --
*
|
| ︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 |
int objc; /* Count of number of arguments to this
* procedure. */
Tcl_Obj *CONST objv[]; /* Argument value objects. */
{
register Proc *procPtr = (Proc *) clientData;
Namespace *nsPtr = procPtr->cmdPtr->nsPtr;
CallFrame *framePtr, **framePtrPtr;
| | | | | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 |
int objc; /* Count of number of arguments to this
* procedure. */
Tcl_Obj *CONST objv[]; /* Argument value objects. */
{
register Proc *procPtr = (Proc *) clientData;
Namespace *nsPtr = procPtr->cmdPtr->nsPtr;
CallFrame *framePtr, **framePtrPtr;
register ShortVar *varPtr;
register CompiledLocal *localPtr;
char *procName, **varNames;
int nameLen, localCt, numArgs, argCt, i, imax, result;
ShortVar *compiledLocals;
/*
* Get the procedure's name.
*/
procName = Tcl_GetStringFromObj(objv[0], &nameLen);
|
| ︙ | ︙ | |||
1146 1147 1148 1149 1150 1151 1152 |
/*
* Create the "compiledLocals" array. Make sure it is large enough to
* hold all the procedure's compiled local variables, including its
* formal parameters.
*/
localCt = procPtr->numCompiledLocals;
| | > | > | < < < < < < > | > | < < < < < < | 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 1201 1202 1203 |
/*
* Create the "compiledLocals" array. Make sure it is large enough to
* hold all the procedure's compiled local variables, including its
* formal parameters.
*/
localCt = procPtr->numCompiledLocals;
compiledLocals = (ShortVar *) TclStackAlloc(interp,
localCt*(sizeof(ShortVar)+sizeof(char *)));
framePtr->numCompiledLocals = localCt;
framePtr->compiledLocals = compiledLocals;
/*
* Match and assign the call's actual parameters to the procedure's
* formal arguments. The formal arguments are described by the first
* numArgs entries in both the Proc structure's local variable list and
* the call frame's local variable array.
*/
numArgs = procPtr->numArgs;
argCt = objc-1; /* set it to the number of args to the proc */
varPtr = framePtr->compiledLocals;
varNames = (char **) (varPtr + framePtr->numCompiledLocals);
localPtr = procPtr->firstLocalPtr;
if (numArgs == 0) {
if (argCt) {
goto incorrectArgs;
} else {
goto runProc;
}
}
imax = ((argCt < numArgs - 1)? argCt : (numArgs - 1));
for (i = 1; i <= imax; i++, varNames++) {
/*
* "Normal" arguments; last formal is special, depends on
* it being 'args'.
*/
Tcl_Obj *objPtr = objv[i];
varPtr->value.objPtr = objPtr;
Tcl_IncrRefCount(objPtr); /* local var is a reference */
varPtr->flags = localPtr->flags;
*varNames = localPtr->name;
varPtr++;
localPtr = localPtr->nextPtr;
}
for (; i < numArgs; i++, varNames++) {
/*
* This loop is entered if argCt < (numArgs-1).
* Set default values; last formal is special.
*/
if (localPtr->defValuePtr != NULL) {
Tcl_Obj *objPtr = localPtr->defValuePtr;
varPtr->flags = localPtr->flags;
varPtr->value.objPtr = objPtr;
Tcl_IncrRefCount(objPtr); /* local var is a reference */
*varNames = localPtr->name;
varPtr++;
localPtr = localPtr->nextPtr;
} else {
goto incorrectArgs;
}
}
|
| ︙ | ︙ | |||
1237 1238 1239 1240 1241 1242 1243 |
ByteCode *codePtr;
incorrectArgs:
/*
* Do initialise all compiled locals, to avoid problems at
* DeleteLocalVars.
*/
codePtr = (ByteCode *) procPtr->bodyPtr->internalRep.otherValuePtr;
| | > | 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 |
ByteCode *codePtr;
incorrectArgs:
/*
* Do initialise all compiled locals, to avoid problems at
* DeleteLocalVars.
*/
codePtr = (ByteCode *) procPtr->bodyPtr->internalRep.otherValuePtr;
InitCompiledLocals(interp, codePtr, localPtr,
varPtr, varNames, nsPtr);
/*
* Build up desired argument list for Tcl_WrongNumArgs
*/
desiredObjs = (Tcl_Obj **)
ckalloc(sizeof(Tcl_Obj *) * (unsigned)(numArgs+1));
|
| ︙ | ︙ | |||
1282 1283 1284 1285 1286 1287 1288 |
TclDecrRefCount(desiredObjs[i]);
}
#endif /* AVOID_HACKS_FOR_ITCL */
ckfree((char *) desiredObjs);
goto procDone;
}
| < < < < < < > | | 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 |
TclDecrRefCount(desiredObjs[i]);
}
#endif /* AVOID_HACKS_FOR_ITCL */
ckfree((char *) desiredObjs);
goto procDone;
}
varPtr->flags = localPtr->flags;
*(varNames++) = localPtr->name;
localPtr = localPtr->nextPtr;
varPtr++;
runProc:
/*
* Initialise and resolve the remaining compiledLocals.
*/
if (localPtr) {
ByteCode *codePtr = (ByteCode *) procPtr->bodyPtr->internalRep.otherValuePtr;
InitCompiledLocals(interp, codePtr,
localPtr, varPtr, varNames, nsPtr);
}
/*
* Invoke the commands in the procedure's body.
*/
#ifdef TCL_COMPILE_DEBUG
|
| ︙ | ︙ | |||
1667 1668 1669 1670 1671 1672 1673 |
iPtr->returnLevel--;
if (iPtr->returnLevel < 0) {
Tcl_Panic("TclUpdateReturnInfo: negative return level");
}
if (iPtr->returnLevel == 0) {
/* Now we've reached the level to return the requested -code */
| | | 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 |
iPtr->returnLevel--;
if (iPtr->returnLevel < 0) {
Tcl_Panic("TclUpdateReturnInfo: negative return level");
}
if (iPtr->returnLevel == 0) {
/* Now we've reached the level to return the requested -code */
code = iPtr->returnCode;
}
return code;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
1835 1836 1837 1838 1839 1840 1841 |
for(i = 1; i < parsePtr->numWords; i++) {
tokenPtr = tokenPtr + tokenPtr->numComponents + 1;
envPtr->currStackDepth = savedStackDepth;
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
TclCompileTokens(interp, tokenPtr+1, tokenPtr->numComponents,
envPtr);
| | | 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 |
for(i = 1; i < parsePtr->numWords; i++) {
tokenPtr = tokenPtr + tokenPtr->numComponents + 1;
envPtr->currStackDepth = savedStackDepth;
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
TclCompileTokens(interp, tokenPtr+1, tokenPtr->numComponents,
envPtr);
TclEmitInst0(INST_POP, envPtr);
}
}
envPtr->currStackDepth = savedStackDepth;
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
return TCL_OK;
}
|
Changes to generic/tclRegexp.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclRegexp.c -- * * This file contains the public interfaces to the Tcl regular * expression mechanism. * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclRegexp.c -- * * This file contains the public interfaces to the Tcl regular * expression mechanism. * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclRegexp.c,v 1.17.4.1 2005/06/13 01:46:15 msofer Exp $ */ #include "tclInt.h" #include "tclRegexp.h" /* *---------------------------------------------------------------------- |
| ︙ | ︙ | |||
133 134 135 136 137 138 139 | * Side effects: * Updates the cache of compiled regexps. * *---------------------------------------------------------------------- */ Tcl_RegExp | | | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
* Side effects:
* Updates the cache of compiled regexps.
*
*----------------------------------------------------------------------
*/
Tcl_RegExp
Tcl_RegExpCompile(interp, pattern)
Tcl_Interp *interp; /* For use in error reporting and
* to access the interp regexp cache. */
CONST char *pattern; /* String for which to produce
* compiled regular expression. */
{
return (Tcl_RegExp) CompileRegexp(interp, pattern, (int) strlen(pattern),
REG_ADVANCED);
}
/*
*----------------------------------------------------------------------
*
* Tcl_RegExpExec --
|
| ︙ | ︙ | |||
165 166 167 168 169 170 171 | * Side effects: * None. * *---------------------------------------------------------------------- */ int | | | | | | | | 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 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_RegExpExec(interp, re, text, start)
Tcl_Interp *interp; /* Interpreter to use for error reporting. */
Tcl_RegExp re; /* Compiled regular expression; must have
* been returned by previous call to
* Tcl_GetRegExpFromObj. */
CONST char *text; /* Text against which to match re. */
CONST char *start; /* If text is part of a larger string,
* this identifies beginning of larger
* string, so that "^" won't match. */
{
int flags, result, numChars;
TclRegexp *regexp = (TclRegexp *)re;
Tcl_DString ds;
CONST Tcl_UniChar *ustr;
/*
* If the starting point is offset from the beginning of the buffer,
* then we need to tell the regexp engine not to match "^".
*/
if (text > start) {
flags = REG_NOTBOL;
} else {
flags = 0;
}
/*
* Remember the string for use by Tcl_RegExpRange().
*/
regexp->string = text;
regexp->objPtr = NULL;
/*
* Convert the string to Unicode and perform the match.
*/
Tcl_DStringInit(&ds);
ustr = Tcl_UtfToUniCharDString(text, -1, &ds);
numChars = Tcl_DStringLength(&ds) / sizeof(Tcl_UniChar);
result = RegExpExecUniChar(interp, re, ustr, numChars,
-1 /* nmatches */, flags);
Tcl_DStringFree(&ds);
return result;
}
|
| ︙ | ︙ | |||
381 382 383 384 385 386 387 | * Tcl_RegExpMatch -- * * See if a string matches a regular expression. * * Results: * If an error occurs during the matching operation then -1 * is returned and the interp's result contains an error message. | | | | | < | | 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 |
* Tcl_RegExpMatch --
*
* See if a string matches a regular expression.
*
* Results:
* If an error occurs during the matching operation then -1
* is returned and the interp's result contains an error message.
* Otherwise the return value is 1 if "text" matches "pattern"
* and 0 otherwise.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_RegExpMatch(interp, text, pattern)
Tcl_Interp *interp; /* Used for error reporting. May be NULL. */
CONST char *text; /* Text to search for pattern matches. */
CONST char *pattern; /* Regular expression to match against text. */
{
Tcl_RegExp re;
re = Tcl_RegExpCompile(interp, pattern);
if (re == NULL) {
return -1;
}
return Tcl_RegExpExec(interp, re, text, text);
}
/*
*----------------------------------------------------------------------
*
* Tcl_RegExpExecObj --
*
|
| ︙ | ︙ | |||
426 427 428 429 430 431 432 | * Side effects: * Converts the object to a Unicode object. * *---------------------------------------------------------------------- */ int | | | | | | | | | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
* Side effects:
* Converts the object to a Unicode object.
*
*----------------------------------------------------------------------
*/
int
Tcl_RegExpExecObj(interp, re, textObj, offset, nmatches, flags)
Tcl_Interp *interp; /* Interpreter to use for error reporting. */
Tcl_RegExp re; /* Compiled regular expression; must have
* been returned by previous call to
* Tcl_GetRegExpFromObj. */
Tcl_Obj *textObj; /* Text against which to match re. */
int offset; /* Character index that marks where matching
* should begin. */
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;
int length;
/*
* Save the target object so we can extract strings from it later.
*/
regexpPtr->string = NULL;
regexpPtr->objPtr = textObj;
udata = Tcl_GetUnicodeFromObj(textObj, &length);
if (offset > length) {
offset = length;
}
udata += offset;
length -= offset;
return RegExpExecUniChar(interp, re, udata, length, nmatches, flags);
}
/*
*----------------------------------------------------------------------
*
* Tcl_RegExpMatchObj --
*
* See if an object matches a regular expression.
*
* Results:
* If an error occurs during the matching operation then -1
* is returned and the interp's result contains an error message.
* Otherwise the return value is 1 if "text" matches "pattern"
* and 0 otherwise.
*
* Side effects:
* Changes the internal rep of the pattern and string objects.
*
*----------------------------------------------------------------------
*/
int
Tcl_RegExpMatchObj(interp, textObj, patternObj)
Tcl_Interp *interp; /* Used for error reporting. May be NULL. */
Tcl_Obj *textObj; /* Object containing the String to search. */
Tcl_Obj *patternObj; /* Regular expression to match against
* string. */
{
Tcl_RegExp re;
re = Tcl_GetRegExpFromObj(interp, patternObj,
TCL_REG_ADVANCED | TCL_REG_NOSUB);
if (re == NULL) {
return -1;
}
return Tcl_RegExpExecObj(interp, re, textObj, 0 /* offset */,
0 /* nmatches */, 0 /* flags */);
}
/*
*----------------------------------------------------------------------
*
* Tcl_RegExpGetInfo --
|
| ︙ | ︙ |
Changes to generic/tclResolve.c.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | * whole, or both. * * Copyright (c) 1998 Lucent Technologies, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * whole, or both. * * Copyright (c) 1998 Lucent Technologies, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclResolve.c,v 1.4.8.1 2005/06/13 01:46:16 msofer Exp $ */ #include "tclInt.h" /* * Declarations for procedures local to this file: */ |
| ︙ | ︙ | |||
269 270 271 272 273 274 275 276 |
for (entry = Tcl_FirstHashEntry(&nsPtr->childTable, &search);
entry != NULL;
entry = Tcl_NextHashEntry(&search)) {
childNsPtr = (Namespace *) Tcl_GetHashValue(entry);
BumpCmdRefEpochs(childNsPtr);
}
}
| > < | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
for (entry = Tcl_FirstHashEntry(&nsPtr->childTable, &search);
entry != NULL;
entry = Tcl_NextHashEntry(&search)) {
childNsPtr = (Namespace *) Tcl_GetHashValue(entry);
BumpCmdRefEpochs(childNsPtr);
}
TclInvalidateNsPath(nsPtr);
}
/*
*----------------------------------------------------------------------
*
* Tcl_SetNamespaceResolvers --
*
* Sets the command/variable resolution procedures for a namespace,
|
| ︙ | ︙ | |||
365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
*/
nsPtr->cmdResProc = cmdProc;
nsPtr->varResProc = varProc;
nsPtr->compiledVarResProc = compiledVarProc;
nsPtr->cmdRefEpoch++;
nsPtr->resolverEpoch++;
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetNamespaceResolvers --
*
| > | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
*/
nsPtr->cmdResProc = cmdProc;
nsPtr->varResProc = varProc;
nsPtr->compiledVarResProc = compiledVarProc;
nsPtr->cmdRefEpoch++;
nsPtr->resolverEpoch++;
TclInvalidateNsPath(nsPtr);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetNamespaceResolvers --
*
|
| ︙ | ︙ |
Changes to generic/tclResult.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclResult.c -- * * This file contains code to manage the interpreter result. * * Copyright (c) 1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
/*
* tclResult.c --
*
* This file contains code to manage the interpreter result.
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclResult.c,v 1.23.4.1 2005/06/13 01:46:16 msofer Exp $
*/
#include "tclInt.h"
/* Indices of the standard return options dictionary keys */
enum returnKeys {
KEY_CODE, KEY_ERRORCODE, KEY_ERRORINFO, KEY_ERRORLINE,
|
| ︙ | ︙ | |||
377 378 379 380 381 382 383 | } /* *---------------------------------------------------------------------- * * Tcl_SetResult -- * | | | | | | | | | | | 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 |
}
/*
*----------------------------------------------------------------------
*
* Tcl_SetResult --
*
* Arrange for "result" to be the Tcl return value.
*
* Results:
* None.
*
* Side effects:
* interp->result is left pointing either to "result"
* or to a copy of it. Also, the object result is reset.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetResult(interp, result, freeProc)
Tcl_Interp *interp; /* Interpreter with which to associate the
* return value. */
register char *result; /* Value to be returned. If NULL, the
* result is set to an empty string. */
Tcl_FreeProc *freeProc; /* Gives information about the string:
* TCL_STATIC, TCL_VOLATILE, or the address
* of a Tcl_FreeProc such as free. */
{
Interp *iPtr = (Interp *) interp;
int length;
register Tcl_FreeProc *oldFreeProc = iPtr->freeProc;
char *oldResult = iPtr->result;
if (result == NULL) {
iPtr->resultSpace[0] = 0;
iPtr->result = iPtr->resultSpace;
iPtr->freeProc = 0;
} else if (freeProc == TCL_VOLATILE) {
length = strlen(result);
if (length > TCL_RESULT_SIZE) {
iPtr->result = (char *) ckalloc((unsigned) length+1);
iPtr->freeProc = TCL_DYNAMIC;
} else {
iPtr->result = iPtr->resultSpace;
iPtr->freeProc = 0;
}
strcpy(iPtr->result, result);
} else {
iPtr->result = result;
iPtr->freeProc = freeProc;
}
/*
* If the old result was dynamically-allocated, free it up. Do it
* here, rather than at the beginning, in case the new result value
* was part of the old result value.
|
| ︙ | ︙ | |||
702 703 704 705 706 707 708 | * If the string result is empty, the object result is moved to the * string result, then the object result is reset. * *---------------------------------------------------------------------- */ void | | | | | 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 |
* If the string result is empty, the object result is moved to the
* string result, then the object result is reset.
*
*----------------------------------------------------------------------
*/
void
Tcl_AppendElement(interp, element)
Tcl_Interp *interp; /* Interpreter whose result is to be
* extended. */
CONST char *element; /* String to convert to list element and
* add to result. */
{
Interp *iPtr = (Interp *) interp;
char *dst;
int size;
int flags;
/*
* If the string result is empty, move the object result to the
* string result, then reset the object result.
*/
(void) Tcl_GetStringResult(interp);
/*
* See how much space is needed, and grow the append buffer if
* needed to accommodate the list element.
*/
size = Tcl_ScanElement(element, &flags) + 1;
if ((iPtr->result != iPtr->appendResult)
|| (iPtr->appendResult[iPtr->appendUsed] != 0)
|| ((size + iPtr->appendUsed) >= iPtr->appendAvl)) {
SetupAppendBuffer(iPtr, size+iPtr->appendUsed);
}
/*
|
| ︙ | ︙ | |||
749 750 751 752 753 754 755 |
/*
* 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;
}
| | | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 |
/*
* 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;
}
iPtr->appendUsed += Tcl_ConvertElement(element, dst, flags);
}
/*
*----------------------------------------------------------------------
*
* SetupAppendBuffer --
*
|
| ︙ | ︙ | |||
923 924 925 926 927 928 929 930 931 932 933 934 935 936 |
if (iPtr->errorInfo) {
/* Legacy support */
Tcl_ObjSetVar2(interp, iPtr->eiVar, NULL,
iPtr->errorInfo, TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(iPtr->errorInfo);
iPtr->errorInfo = NULL;
}
if (iPtr->returnOpts) {
Tcl_DecrRefCount(iPtr->returnOpts);
iPtr->returnOpts = NULL;
}
iPtr->flags &= ~ERR_ALREADY_LOGGED;
}
| > > | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 |
if (iPtr->errorInfo) {
/* Legacy support */
Tcl_ObjSetVar2(interp, iPtr->eiVar, NULL,
iPtr->errorInfo, TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(iPtr->errorInfo);
iPtr->errorInfo = NULL;
}
iPtr->returnLevel = 1;
iPtr->returnCode = TCL_OK;
if (iPtr->returnOpts) {
Tcl_DecrRefCount(iPtr->returnOpts);
iPtr->returnOpts = NULL;
}
iPtr->flags &= ~ERR_ALREADY_LOGGED;
}
|
| ︙ | ︙ |
Changes to generic/tclScan.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclScan.c -- * * This file contains the implementation of the "scan" command. * * Copyright (c) 1998 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclScan.c -- * * This file contains the implementation of the "scan" command. * * Copyright (c) 1998 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclScan.c,v 1.16.4.1 2005/06/13 01:46:16 msofer Exp $ */ #include "tclInt.h" /* * Flag values used by Tcl_ScanObjCmd. */ |
| ︙ | ︙ | |||
1140 1141 1142 1143 1144 1145 1146 |
/*
* Scan the value from the temporary buffer.
*/
if (!(flags & SCAN_SUPPRESS)) {
double dvalue;
*end = '\0';
| | | 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 |
/*
* Scan the value from the temporary buffer.
*/
if (!(flags & SCAN_SUPPRESS)) {
double dvalue;
*end = '\0';
dvalue = TclStrToD(buf, NULL);
objPtr = Tcl_NewDoubleObj(dvalue);
Tcl_IncrRefCount(objPtr);
objs[objIndex++] = objPtr;
}
break;
}
nconversions++;
|
| ︙ | ︙ |
Added generic/tclStrToD.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 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 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 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 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 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 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 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 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 |
/*
*----------------------------------------------------------------------
*
* tclStrToD.c --
*
* This file contains a TclStrToD procedure that handles conversion
* of string to double, with correct rounding even where extended
* precision is needed to achieve that. It also contains a
* TclDoubleDigits procedure that handles conversion of double
* to string (at least the significand), and several utility functions
* for interconverting 'double' and the integer types.
*
* Copyright (c) 2005 by Kevin B. Kenny. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclStrToD.c,v 1.4.4.2 2005/06/13 01:46:16 msofer Exp $
*
*----------------------------------------------------------------------
*/
#include <tclInt.h>
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <ctype.h>
#include <tommath.h>
/*
* The stuff below is a bit of a hack so that this file can be used in
* environments that include no UNIX, i.e. no errno: just arrange to use
* the errno from tclExecute.c here.
*/
#ifdef TCL_GENERIC_ONLY
#define NO_ERRNO_H
#endif
#ifdef NO_ERRNO_H
extern int errno; /* Use errno from tclExecute.c. */
#define ERANGE 34
#endif
#if ( FLT_RADIX == 2 ) && ( DBL_MANT_DIG == 53 ) && ( DBL_MAX_EXP == 1024 )
#define IEEE_FLOATING_POINT
#endif
/*
* gcc on x86 needs access to rounding controls. It is tempting to
* include fpu_control.h, but that file exists only on Linux; it is
* missing on Cygwin and MinGW.
*/
#if defined(__GNUC__) && defined(__i386)
typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
#define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw))
#define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw))
#endif
/*
* HP's PA_RISC architecture uses 7ff4000000000000 to represent a
* quiet NaN. Everyone else uses 7ff8000000000000. (Why, HP, why?)
*/
#ifdef __hppa
# define NAN_START 0x7ff4
# define NAN_MASK (((Tcl_WideUInt) 1) << 50)
#else
# define NAN_START 0x7ff8
# define NAN_MASK (((Tcl_WideUInt) 1) << 51)
#endif
/* The powers of ten that can be represented exactly as IEEE754 doubles. */
#define MAXPOW 22
static double pow10 [MAXPOW+1];
static int mmaxpow; /* Largest power of ten that can be
* represented exactly in a 'double'. */
/* Inexact higher powers of ten */
static CONST double pow_10_2_n [] = {
1.0,
100.0,
10000.0,
1.0e+8,
1.0e+16,
1.0e+32,
1.0e+64,
1.0e+128,
1.0e+256
};
/* Logarithm of the floating point radix. */
static int log2FLT_RADIX;
/* Number of bits in a double's significand */
static int mantBits;
/* Table of powers of 5**(2**n), up to 5**256 */
static mp_int pow5[9];
/* The smallest representable double */
static double tiny;
/* The maximum number of digits to the left of the decimal point of a
* double. */
static int maxDigits;
/* The maximum number of digits to the right of the decimal point in a
* double. */
static int minDigits;
/* Number of mp_digit's needed to hold the significand of a double */
static int mantDIGIT;
/* Static functions defined in this file */
static double RefineResult _ANSI_ARGS_((double approx, CONST char* start,
int nDigits, long exponent));
static double ParseNaN _ANSI_ARGS_(( int signum, CONST char** end ));
static double SafeLdExp _ANSI_ARGS_(( double fraction, int exponent ));
/*
*----------------------------------------------------------------------
*
* TclStrToD --
*
* Scans a double from a string.
*
* Results:
* Returns the scanned number. In the case of underflow, returns
* an appropriately signed zero; in the case of overflow, returns
* an appropriately signed HUGE_VAL.
*
* Side effects:
* Stores a pointer to the end of the scanned number in '*endPtr',
* if endPtr is not NULL. If '*endPtr' is equal to 's' on return from
* this function, it indicates that the input string could not be
* recognized as a number.
* In the case of underflow or overflow, 'errno' is set to ERANGE.
*
*------------------------------------------------------------------------
*/
double
TclStrToD( CONST char* s,
/* String to scan */
CONST char ** endPtr )
/* Pointer to the end of the scanned number */
{
CONST char* p = s;
CONST char* startOfSignificand = NULL;
/* Start of the significand in the
* string */
int signum = 0; /* Sign of the significand */
double exactSignificand = 0.0;
/* Significand, represented exactly
* as a floating-point number */
int seenDigit = 0; /* Flag == 1 if a digit has been seen */
int nSigDigs = 0; /* Number of significant digits presented */
int nDigitsAfterDp = 0; /* Number of digits after the decimal point */
int nTrailZero = 0; /* Number of trailing zeros in the
* significand */
long exponent = 0; /* Exponent */
int seenDp = 0; /* Flag == 1 if decimal point has been seen */
char c; /* One character extracted from the input */
/*
* v must be 'volatile double' on gc-ix86 to force correct rounding
* to IEEE double and not Intel double-extended.
*/
volatile double v; /* Scanned value */
int machexp; /* Exponent of the machine rep of the
* scanned value */
int expt2; /* Exponent for computing first
* approximation to the true value */
int i, j;
/*
* With gcc on x86, the floating point rounding mode is double-extended.
* This causes the result of double-precision calculations to be rounded
* twice: once to the precision of double-extended and then again to the
* precision of double. Double-rounding introduces gratuitous errors of
* 1 ulp, so we need to change rounding mode to 53-bits.
*/
#if defined(__GNUC__) && defined(__i386)
fpu_control_t roundTo53Bits = 0x027f;
fpu_control_t oldRoundingMode;
_FPU_GETCW( oldRoundingMode );
_FPU_SETCW( roundTo53Bits );
#endif
/* Discard leading whitespace */
while ( isspace( *p ) ) {
++p;
}
/* Determine the sign of the significand */
switch( *p ) {
case '-':
signum = 1;
/* FALLTHROUGH */
case '+':
++p;
}
/* Discard leading zeroes */
while ( *p == '0' ) {
seenDigit = 1;
++p;
}
/*
* Scan digits from the significand. Simultaneously, keep track
* of the number of digits after the decimal point. Maintain
* a pointer to the start of the significand. Keep "exactSignificand"
* equal to the conversion of the DBL_DIG most significant digits.
*/
for ( ; ; ) {
c = *p;
if ( c == '.' && !seenDp ) {
seenDp = 1;
++p;
} else if ( isdigit( UCHAR(c) ) ) {
if ( c == '0' ) {
if ( startOfSignificand != NULL ) {
++nTrailZero;
}
} else {
if ( startOfSignificand == NULL ) {
startOfSignificand = p;
} else if ( nTrailZero ) {
if ( nTrailZero + nSigDigs < DBL_DIG ) {
exactSignificand *= pow10[ nTrailZero ];
} else if ( nSigDigs < DBL_DIG ) {
exactSignificand *= pow10[ DBL_DIG - nSigDigs ];
}
nSigDigs += nTrailZero;
}
if ( nSigDigs < DBL_DIG ) {
exactSignificand = 10. * exactSignificand + (c - '0');
}
++nSigDigs;
nTrailZero = 0;
}
if ( seenDp ) {
++nDigitsAfterDp;
}
seenDigit = 1;
++p;
} else {
break;
}
}
/*
* At this point, we've scanned the significand, and p points
* to the character beyond it. "startOfSignificand" is the first
* non-zero character in the significand. "nSigDigs" is the number
* of significant digits of the significand, not including any
* trailing zeroes. "exactSignificand" is a floating point number
* that represents, without loss of precision, the first
* min(DBL_DIG,n) digits of the significand. "nDigitsAfterDp"
* is the number of digits after the decimal point, again excluding
* trailing zeroes.
*
* Now scan 'E' format
*/
exponent = 0;
if ( seenDigit && ( *p == 'e' || *p == 'E' ) ) {
CONST char* stringSave = p;
++p;
c = *p;
if ( isdigit( UCHAR( c ) ) || c == '+' || c == '-' ) {
errno = 0;
exponent = strtol( p, (char**)&p, 10 );
if ( errno == ERANGE ) {
if ( exponent > 0 ) {
v = HUGE_VAL;
} else {
v = 0.0;
}
*endPtr = p;
goto returnValue;
}
}
if ( p == stringSave + 1 ) {
p = stringSave;
exponent = 0;
}
}
exponent = exponent + nTrailZero - nDigitsAfterDp;
/*
* If we come here with no significant digits, we might still be
* looking at Inf or NaN. Go parse them.
*/
if ( !seenDigit ) {
/* Test for Inf */
if ( c == 'I' || c == 'i' ) {
if ( ( p[1] == 'N' || p[1] == 'n' )
&& ( p[2] == 'F' || p[2] == 'f' ) ) {
p += 3;
if ( ( p[0] == 'I' || p[0] == 'i' )
&& ( p[1] == 'N' || p[1] == 'n' )
&& ( p[2] == 'I' || p[2] == 'i' )
&& ( p[3] == 'T' || p[3] == 't' )
&& ( p[4] == 'Y' || p[1] == 'y' ) ) {
p += 5;
}
errno = ERANGE;
v = HUGE_VAL;
if ( endPtr != NULL ) {
*endPtr = p;
}
goto returnValue;
}
#ifdef IEEE_FLOATING_POINT
/* IEEE floating point supports NaN */
} else if ( (c == 'N' || c == 'n' )
&& ( sizeof(Tcl_WideUInt) == sizeof( double ) ) ) {
if ( ( p[1] == 'A' || p[1] == 'a' )
&& ( p[2] == 'N' || p[2] == 'n' ) ) {
p += 3;
if ( endPtr != NULL ) {
*endPtr = p;
}
/* Restore FPU mode word */
#if defined(__GNUC__) && defined(__i386)
_FPU_SETCW( oldRoundingMode );
#endif
return ParseNaN( signum, endPtr );
}
#endif
}
goto error;
}
/*
* We've successfully scanned; update the end-of-element pointer.
*/
if ( endPtr != NULL ) {
*endPtr = p;
}
/* Test for zero. */
if ( nSigDigs == 0 ) {
v = 0.0;
goto returnValue;
}
/*
* The easy cases are where we have an exact significand and
* the exponent is small enough that we can compute the value
* with only one roundoff. In addition to the cases where we
* can multiply or divide an exact-integer significand by an
* exact-integer power of 10, there is also David Gay's case
* where we can scale the significand by a power of 10 (still
* keeping it exact) and then multiply by an exact power of 10.
* The last case enables combinations like 83e25 that would
* otherwise require high precision arithmetic.
*/
if ( nSigDigs <= DBL_DIG ) {
if ( exponent >= 0 ) {
if ( exponent <= mmaxpow ) {
v = exactSignificand * pow10[ exponent ];
goto returnValue;
} else {
int diff = DBL_DIG - nSigDigs;
if ( exponent - diff <= mmaxpow ) {
volatile double factor = exactSignificand * pow10[ diff ];
v = factor * pow10[ exponent - diff ];
goto returnValue;
}
}
} else {
if ( exponent >= -mmaxpow ) {
v = exactSignificand / pow10[ -exponent ];
goto returnValue;
}
}
}
/*
* We don't have one of the easy cases, so we can't compute the
* scanned number exactly, and have to do it in multiple precision.
* Begin by testing for obvious overflows and underflows.
*/
if ( nSigDigs + exponent - 1 > maxDigits ) {
v = HUGE_VAL;
errno = ERANGE;
goto returnValue;
}
if ( nSigDigs + exponent - 1 < minDigits ) {
errno = ERANGE;
v = 0.;
goto returnValue;
}
/*
* Nothing exceeds the boundaries of the tables, at least.
* Compute an approximate value for the number, with
* no possibility of overflow because we manage the exponent
* separately.
*/
if ( nSigDigs > DBL_DIG ) {
expt2 = exponent + nSigDigs - DBL_DIG;
} else {
expt2 = exponent;
}
v = frexp( exactSignificand, &machexp );
if ( expt2 > 0 ) {
v = frexp( v * pow10[ expt2 & 0xf ], &j );
machexp += j;
for ( i = 4; i < 9; ++i ) {
if ( expt2 & ( 1 << i ) ) {
v = frexp( v * pow_10_2_n[ i ], &j );
machexp += j;
}
}
} else {
v = frexp( v / pow10[ (-expt2) & 0xf ], &j );
machexp += j;
for ( i = 4; i < 9; ++i ) {
if ( (-expt2) & ( 1 << i ) ) {
v = frexp( v / pow_10_2_n[ i ], &j );
machexp += j;
}
}
}
/*
* A first approximation is that the result will be v * 2 ** machexp.
* v is greater than or equal to 0.5 and less than 1.
* If machexp > DBL_MAX_EXP * log2(FLT_RADIX), there is an overflow.
* Constrain the result to the smallest representible number to avoid
* premature underflow.
*/
if ( machexp > DBL_MAX_EXP * log2FLT_RADIX ) {
v = HUGE_VAL;
errno = ERANGE;
goto returnValue;
}
v = SafeLdExp( v, machexp );
if ( v < tiny ) {
v = tiny;
}
/* We have a first approximation in v. Now we need to refine it. */
v = RefineResult( v, startOfSignificand, nSigDigs, exponent );
/* In a very few cases, a second iteration is needed. e.g., 457e-102 */
v = RefineResult( v, startOfSignificand, nSigDigs, exponent );
/* Handle underflow */
returnValue:
if ( nSigDigs != 0 && v == 0.0 ) {
errno = ERANGE;
}
/* Return a number with correct sign */
if ( signum ) {
v = -v;
}
/* Restore FPU mode word */
#if defined(__GNUC__) && defined(__i386)
_FPU_SETCW( oldRoundingMode );
#endif
return v;
/* Come here on an invalid input */
error:
if ( endPtr != NULL ) {
*endPtr = s;
}
/* Restore FPU mode word */
#if defined(__GNUC__) && defined(__i386)
_FPU_SETCW( oldRoundingMode );
#endif
return 0.0;
}
/*
*----------------------------------------------------------------------
*
* RefineResult --
*
* Given a poor approximation to a floating point number, returns
* a better one (The better approximation is correct to within
* 1 ulp, and is entirely correct if the poor approximation is
* correct to 1 ulp.)
*
* Results:
* Returns the improved result.
*
*----------------------------------------------------------------------
*/
static double
RefineResult( double approxResult,
/* Approximate result of conversion */
CONST char* sigStart,
/* Pointer to start of significand in
* input string. */
int nSigDigs, /* Number of significant digits */
long exponent ) /* Power of ten to multiply by significand */
{
int M2, M5; /* Powers of 2 and of 5 needed to put
* the decimal and binary numbers over
* a common denominator. */
double significand; /* Sigificand of the binary number */
int binExponent; /* Exponent of the binary number */
int msb; /* Most significant bit position of an
* intermediate result */
int nDigits; /* Number of mp_digit's in an intermediate
* result */
mp_int twoMv; /* Approx binary value expressed as an
* exact integer scaled by the multiplier 2M */
mp_int twoMd; /* Exact decimal value expressed as an
* exact integer scaled by the multiplier 2M */
int scale; /* Scale factor for M */
int multiplier; /* Power of two to scale M */
double num, den; /* Numerator and denominator of the
* correction term */
double quot; /* Correction term */
double minincr; /* Lower bound on the absolute value
* of the correction term. */
int i;
CONST char* p;
/*
* The first approximation is always low. If we find that
* it's HUGE_VAL, we're done.
*/
if ( approxResult == HUGE_VAL ) {
return approxResult;
}
/*
* Find a common denominator for the decimal and binary fractions.
* The common denominator will be 2**M2 + 5**M5.
*/
significand = frexp( approxResult, &binExponent );
i = mantBits - binExponent;
if ( i < 0 ) {
M2 = 0;
} else {
M2 = i;
}
if ( exponent > 0 ) {
M5 = 0;
} else {
M5 = -exponent;
if ( (M5-1) > M2 ) {
M2 = M5-1;
}
}
/*
* The floating point number is significand*2**binExponent.
* The 2**-1 bit of the significand (the most significant)
* corresponds to the 2**(binExponent+M2 + 1) bit of 2*M2*v.
* Allocate enough digits to hold that quantity, then
* convert the significand to a large integer, scaled
* appropriately. Then multiply by the appropriate power of 5.
*/
msb = binExponent + M2; /* 1008 */
nDigits = msb / DIGIT_BIT + 1;
mp_init_size( &twoMv, nDigits );
i = ( msb % DIGIT_BIT + 1 );
twoMv.used = nDigits;
significand *= SafeLdExp( 1.0, i );
while ( -- nDigits >= 0 ) {
twoMv.dp[nDigits] = (mp_digit) significand;
significand -= (mp_digit) significand;
significand = SafeLdExp( significand, DIGIT_BIT );
}
for ( i = 0; i <= 8; ++i ) {
if ( M5 & ( 1 << i ) ) {
mp_mul( &twoMv, pow5+i, &twoMv );
}
}
/*
* Collect the decimal significand as a high precision integer.
* The least significant bit corresponds to bit M2+exponent+1
* so it will need to be shifted left by that many bits after
* being multiplied by 5**(M5+exponent).
*/
mp_init( &twoMd ); mp_zero( &twoMd );
i = nSigDigs;
for ( p = sigStart ; ; ++p ) {
char c = *p;
if ( isdigit( UCHAR( c ) ) ) {
mp_mul_d( &twoMd, (unsigned) 10, &twoMd );
mp_add_d( &twoMd, (unsigned) (c - '0'), &twoMd );
--i;
if ( i == 0 ) break;
}
}
for ( i = 0; i <= 8; ++i ) {
if ( (M5+exponent) & ( 1 << i ) ) {
mp_mul( &twoMd, pow5+i, &twoMd );
}
}
mp_mul_2d( &twoMd, M2+exponent+1, &twoMd );
mp_sub( &twoMd, &twoMv, &twoMd );
/*
* The result, 2Mv-2Md, needs to be divided by 2M to yield a correction
* term. Because 2M may well overflow a double, we need to scale the
* denominator by a factor of 2**binExponent-mantBits
*/
scale = binExponent - mantBits - 1;
mp_set( &twoMv, 1 );
for ( i = 0; i <= 8; ++i ) {
if ( M5 & ( 1 << i ) ) {
mp_mul( &twoMv, pow5+i, &twoMv );
}
}
multiplier = M2 + scale + 1;
if ( multiplier > 0 ) {
mp_mul_2d( &twoMv, multiplier, &twoMv );
} else if ( multiplier < 0 ) {
mp_div_2d( &twoMv, -multiplier, &twoMv, NULL );
}
/*
* If the result is less than unity, the error is less than 1/2 unit
* in the last place, so there's no correction to make.
*/
if ( mp_cmp_mag( &twoMd, &twoMv ) == MP_LT ) {
return approxResult;
}
/*
* Convert the numerator and denominator of the corrector term
* accurately to floating point numbers.
*/
num = TclBignumToDouble( &twoMd );
den = TclBignumToDouble( &twoMv );
quot = SafeLdExp( num/den, scale );
minincr = SafeLdExp( 1.0, binExponent - mantBits );
if ( quot < 0. && quot > -minincr ) {
quot = -minincr;
} else if ( quot > 0. && quot < minincr ) {
quot = minincr;
}
mp_clear( &twoMd );
mp_clear( &twoMv );
return approxResult + quot;
}
/*
*----------------------------------------------------------------------
*
* ParseNaN --
*
* Parses a "not a number" from an input string, and returns the
* double precision NaN corresponding to it.
*
* Side effects:
* Advances endPtr to follow any (hex) in the input string.
*
* If the NaN is followed by a left paren, a string of spaes
* and hexadecimal digits, and a right paren, endPtr is advanced
* to follow it.
*
* The string of hexadecimal digits is OR'ed into the resulting
* NaN, and the signum is set as well. Note that a signalling NaN
* is never returned.
*
*----------------------------------------------------------------------
*/
double
ParseNaN( int signum, /* Flag == 1 if minus sign has been
* seen in front of NaN */
CONST char** endPtr )
/* Pointer-to-pointer to char following "NaN"
* in the input string */
{
CONST char* p = *endPtr;
char c;
union {
Tcl_WideUInt iv;
double dv;
} theNaN;
/* Scan off a hex number in parentheses. Embedded blanks are ok. */
theNaN.iv = 0;
if ( *p == '(' ) {
++p;
for ( ; ; ) {
c = *p++;
if ( isspace( UCHAR(c) ) ) {
continue;
} else if ( c == ')' ) {
*endPtr = p;
break;
} else if ( isdigit( UCHAR(c) ) ) {
c -= '0';
} else if ( c >= 'A' && c <= 'F' ) {
c = c - 'A' + 10;
} else if ( c >= 'a' && c <= 'f' ) {
c = c - 'a' + 10;
} else {
theNaN.iv = ( ((Tcl_WideUInt) NAN_START) << 48 )
| ( ((Tcl_WideUInt) signum) << 63 );
return theNaN.dv;
}
theNaN.iv = (theNaN.iv << 4) | c;
}
}
/*
* Mask the hex number down to the least significant 51 bits.
*/
theNaN.iv &= ( ((Tcl_WideUInt) 1) << 51 ) - 1;
if ( signum ) {
theNaN.iv |= ((Tcl_WideUInt) 0xfff8) << 48;
} else {
theNaN.iv |= ((Tcl_WideUInt) NAN_START) << 48;
}
*endPtr = p;
return theNaN.dv;
}
/*
*----------------------------------------------------------------------
*
* TclDoubleDigits --
*
* Converts a double to a string of digits.
*
* Results:
* Returns the position of the character in the string
* after which the decimal point should appear. Since
* the string contains only significant digits, the
* position may be less than zero or greater than the
* length of the string.
*
* Side effects:
* Stores the digits in the given buffer and sets 'signum'
* according to the sign of the number.
*
*----------------------------------------------------------------------
*/
int
TclDoubleDigits( char * strPtr, /* Buffer in which to store the result,
* must have at least 18 chars */
double v, /* Number to convert. Must be
* finite, and not NaN */
int *signum ) /* Output: 1 if the number is negative.
* Should handle -0 correctly on the
* IEEE architecture. */
{
double f; /* Significand of v */
int e; /* Power of FLT_RADIX that satisfies
* v = f * FLT_RADIX**e */
int low_ok;
int high_ok;
mp_int r; /* Scaled significand */
mp_int s; /* Divisor such that v = r / s */
mp_int mplus; /* Scaled epsilon: (r + 2* mplus) ==
* v(+) where v(+) is the floating point
* successor of v. */
mp_int mminus; /* Scaled epsilon: (r - 2*mminus ) ==
* v(-) where v(-) is the floating point
* predecessor of v. */
mp_int temp;
int rfac2 = 0; /* Powers of 2 and 5 by which large */
int rfac5 = 0; /* integers should be scaled */
int sfac2 = 0;
int sfac5 = 0;
int mplusfac2 = 0;
int mminusfac2 = 0;
double a;
char c;
int i, k, n;
/*
* Take the absolute value of the number, and report the number's
* sign. Take special steps to preserve signed zeroes in IEEE floating
* point. (We can't use fpclassify, because that's a C9x feature and
* we still have to build on C89 compilers.)
*/
#ifndef IEEE_FLOATING_POINT
if ( v >= 0.0 ) {
*signum = 0;
} else {
*signum = 1;
v = -v;
}
#else
union {
Tcl_WideUInt iv;
double dv;
} bitwhack;
bitwhack.dv = v;
if ( bitwhack.iv & ( (Tcl_WideUInt) 1 << 63 ) ) {
*signum = 1;
bitwhack.iv &= ~( (Tcl_WideUInt) 1 << 63 );
v = bitwhack.dv;
} else {
*signum = 0;
}
#endif
/* Handle zero specially */
if ( v == 0.0 ) {
*strPtr++ = '0';
*strPtr++ = '\0';
return 1;
}
/*
* Develop f and e such that v = f * FLT_RADIX**e, with
* 1.0/FLT_RADIX <= f < 1.
*/
f = frexp( v, &e );
n = e % log2FLT_RADIX;
if ( n > 0 ) {
n -= log2FLT_RADIX;
e += 1;
}
f *= ldexp( 1.0, n );
e = ( e - n ) / log2FLT_RADIX;
if ( f == 1.0 ) {
f = 1.0 / FLT_RADIX;
e += 1;
}
/*
* If the original number was denormalized, adjust e and f to be
* denormal as well.
*/
if ( e < DBL_MIN_EXP ) {
n = mantBits + ( e - DBL_MIN_EXP ) * log2FLT_RADIX;
f = ldexp( f, ( e - DBL_MIN_EXP ) * log2FLT_RADIX );
e = DBL_MIN_EXP;
n = ( n + DIGIT_BIT - 1 ) / DIGIT_BIT;
} else {
n = mantDIGIT;
}
/*
* Now extract the base-2**DIGIT_BIT digits of f into a multi-precision
* integer r. Preserve the invariant v = r * 2**rfac2 * FLT_RADIX**e
* by adjusting e.
*/
a = f;
n = mantDIGIT;
mp_init_size( &r, n );
r.used = n;
r.sign = MP_ZPOS;
i = ( mantBits % DIGIT_BIT );
if ( i == 0 ) {
i = DIGIT_BIT;
}
while ( n > 0 ) {
a *= ldexp( 1.0, i );
i = DIGIT_BIT;
r.dp[--n] = (mp_digit) a;
a -= (mp_digit) a;
}
e -= DBL_MANT_DIG;
low_ok = high_ok = ( mp_iseven( &r ) );
/*
* We are going to want to develop integers r, s, mplus, and mminus
* such that v = r / s, v(+)-v / 2 = mplus / s; v-v(-) / 2 = mminus / s
* and then scale either s or r, mplus, mminus by an appropriate
* power of ten.
*
* We actually do this by keeping track of the powers of 2 and 5
* by which f is multiplied to yield v and by which 1 is multiplied
* to yield s, mplus, and mminus.
*/
if ( e >= 0 ) {
int bits = e * log2FLT_RADIX;
if ( f != 1.0 / FLT_RADIX ) {
/* Normal case, m+ and m- are both FLT_RADIX**e */
rfac2 += bits + 1;
sfac2 = 1;
mplusfac2 = bits;
mminusfac2 = bits;
} else {
/*
* If f is equal to the smallest significand, then we need another
* factor of FLT_RADIX in s to cope with stepping to
* the next smaller exponent when going to e's predecessor.
*/
rfac2 += bits + log2FLT_RADIX - 1;
sfac2 = 1 + log2FLT_RADIX;
mplusfac2 = bits + log2FLT_RADIX;
mminusfac2 = bits;
}
} else {
/* v has digits after the binary point */
if ( e <= DBL_MIN_EXP - DBL_MANT_DIG
|| f != 1.0 / FLT_RADIX ) {
/*
* Either f isn't the smallest significand or e is
* the smallest exponent. mplus and mminus will both be 1.
*/
rfac2 += 1;
sfac2 = 1 - e * log2FLT_RADIX;
mplusfac2 = 0;
mminusfac2 = 0;
} else {
/*
* f is the smallest significand, but e is not the smallest
* exponent. We need to scale by FLT_RADIX again to cope
* with the fact that v's predecessor has a smaller exponent.
*/
rfac2 += 1 + log2FLT_RADIX;
sfac2 = 1 + log2FLT_RADIX * ( 1 - e );
mplusfac2 = FLT_RADIX;
mminusfac2 = 0;
}
}
/*
* Estimate the highest power of ten that will be
* needed to hold the result.
*/
k = (int) ceil( log( v ) / log( 10. ) );
if ( k >= 0 ) {
sfac2 += k;
sfac5 = k;
} else {
rfac2 -= k;
mplusfac2 -= k;
mminusfac2 -= k;
rfac5 = -k;
}
/*
* Scale r, s, mplus, mminus by the appropriate powers of 2 and 5.
*/
mp_init_set( &mplus, 1 );
for ( i = 0; i <= 8; ++i ) {
if ( rfac5 & ( 1 << i ) ) {
mp_mul( &mplus, pow5+i, &mplus );
}
}
mp_mul( &r, &mplus, &r );
mp_mul_2d( &r, rfac2, &r );
mp_init_copy( &mminus, &mplus );
mp_mul_2d( &mplus, mplusfac2, &mplus );
mp_mul_2d( &mminus, mminusfac2, &mminus );
mp_init_set( &s, 1 );
for ( i = 0; i <= 8; ++i ) {
if ( sfac5 & ( 1 << i ) ) {
mp_mul( &s, pow5+i, &s );
}
}
mp_mul_2d( &s, sfac2, &s );
/*
* It is possible for k to be off by one because we used an
* inexact logarithm.
*/
mp_init( &temp );
mp_add( &r, &mplus, &temp );
i = mp_cmp_mag( &temp, &s );
if ( i > 0 || ( high_ok && i == 0 ) ) {
mp_mul_d( &s, 10, &s );
++k;
} else {
mp_mul_d( &temp, 10, &temp );
i = mp_cmp_mag( &temp, &s );
if ( i < 0 || ( high_ok && i == 0 ) ) {
mp_mul_d( &r, 10, &r );
mp_mul_d( &mplus, 10, &mplus );
mp_mul_d( &mminus, 10, &mminus );
--k;
}
}
/*
* At this point, k contains the power of ten by which we're
* scaling the result. r/s is at least 1/10 and strictly less
* than ten, and v = r/s * 10**k. mplus and mminus give the
* rounding limits.
*/
for ( ; ; ) {
int tc1, tc2;
mp_mul_d( &r, 10, &r );
mp_div( &r, &s, &temp, &r ); /* temp = 10r / s; r = 10r mod s */
i = temp.dp[0];
mp_mul_d( &mplus, 10, &mplus );
mp_mul_d( &mminus, 10, &mminus );
tc1 = mp_cmp_mag( &r, &mminus );
if ( low_ok ) {
tc1 = ( tc1 <= 0 );
} else {
tc1 = ( tc1 < 0 );
}
mp_add( &r, &mplus, &temp );
tc2 = mp_cmp_mag( &temp, &s );
if ( high_ok ) {
tc2 = ( tc2 >= 0 );
} else {
tc2= ( tc2 > 0 );
}
if ( ! tc1 ) {
if ( !tc2 ) {
*strPtr++ = '0' + i;
} else {
c = (char) (i + '1');
break;
}
} else {
if ( !tc2 ) {
c = (char) (i + '0');
} else {
mp_mul_2d( &r, 1, &r );
n = mp_cmp_mag( &r, &s );
if ( n < 0 ) {
c = (char) (i + '0');
} else {
c = (char) (i + '1');
}
}
break;
}
};
*strPtr++ = c;
*strPtr++ = '\0';
/* Free memory */
mp_clear_multi( &r, &s, &mplus, &mminus, &temp, NULL );
return k;
}
/*
*----------------------------------------------------------------------
*
* TclInitDoubleConversion --
*
* Initializes constants that are needed for conversions to and
* from 'double'
*
* Results:
* None.
*
* Side effects:
* The log base 2 of the floating point radix, the number of
* bits in a double mantissa, and a table of the powers of five
* and ten are computed and stored.
*
*----------------------------------------------------------------------
*/
void
TclInitDoubleConversion( void )
{
int i;
int x;
double d;
if ( frexp( (double) FLT_RADIX, &log2FLT_RADIX ) != 0.5 ) {
Tcl_Panic( "This code doesn't work on a decimal machine!" );
}
--log2FLT_RADIX;
mantBits = DBL_MANT_DIG * log2FLT_RADIX;
d = 1.0;
x = (int) (DBL_MANT_DIG * log((double) FLT_RADIX) / log( 5.0 ));
if ( x < MAXPOW ) {
mmaxpow = x;
} else {
mmaxpow = MAXPOW;
}
for ( i = 0; i <= mmaxpow; ++i ) {
pow10[i] = d;
d *= 10.0;
}
for ( i = 0; i < 9; ++i ) {
mp_init( pow5 + i );
}
mp_set( pow5, 5 );
for ( i = 0; i < 8; ++i ) {
mp_sqr( pow5+i, pow5+i+1 );
}
tiny = SafeLdExp( 1.0, DBL_MIN_EXP * log2FLT_RADIX - mantBits );
maxDigits = (int) ((DBL_MAX_EXP * log((double) FLT_RADIX)
+ 0.5 * log(10.))
/ log( 10. ));
minDigits = (int) floor ( ( DBL_MIN_EXP - DBL_MANT_DIG )
* log( (double) FLT_RADIX ) / log( 10. ) );
mantDIGIT = ( mantBits + DIGIT_BIT - 1 ) / DIGIT_BIT;
}
/*
*----------------------------------------------------------------------
*
* TclFinalizeDoubleConversion --
*
* Cleans up this file on exit.
*
* Results:
* None
*
* Side effects:
* Memory allocated by TclInitDoubleConversion is freed.
*
*----------------------------------------------------------------------
*/
void
TclFinalizeDoubleConversion()
{
int i;
for ( i = 0; i < 9; ++i ) {
mp_clear( pow5 + i );
}
}
/*
*----------------------------------------------------------------------
*
* TclBignumToDouble --
*
* Convert an arbitrary-precision integer to a native floating
* point number.
*
* Results:
* Returns the converted number. Sets errno to ERANGE if the
* number is too large to convert.
*
*----------------------------------------------------------------------
*/
double
TclBignumToDouble( mp_int* a )
/* Integer to convert */
{
mp_int b;
int bits;
int shift;
int i;
double r;
/* Determine how many bits we need, and extract that many from
* the input. Round to nearest unit in the last place. */
bits = mp_count_bits( a );
if ( bits > DBL_MAX_EXP * log2FLT_RADIX ) {
errno = ERANGE;
return HUGE_VAL;
}
shift = mantBits + 1 - bits;
mp_init( &b );
if ( shift > 0 ) {
mp_mul_2d( a, shift, &b );
} else if ( shift < 0 ) {
mp_div_2d( a, -shift, &b, NULL );
} else {
mp_copy( a, &b );
}
mp_add_d( &b, 1, &b );
mp_div_2d( &b, 1, &b, NULL );
/* Accumulate the result, one mp_digit at a time */
r = 0.0;
for ( i = b.used-1; i >= 0; --i ) {
r = ldexp( r, DIGIT_BIT ) + b.dp[i];
}
mp_clear( &b );
/* Scale the result to the correct number of bits. */
r = ldexp( r, bits - mantBits );
/* Return the result with the appropriate sign. */
if ( a->sign == MP_ZPOS ) {
return r;
} else {
return -r;
}
}
/*
*----------------------------------------------------------------------
*
* SafeLdExp --
*
* Do an 'ldexp' operation, but handle denormals gracefully.
*
* Results:
* Returns the appropriately scaled value.
*
* On some platforms, 'ldexp' fails when presented with a number
* too small to represent as a normalized double. This routine
* does 'ldexp' in two steps for those numbers, to return correctly
* denormalized values.
*
*----------------------------------------------------------------------
*/
static double
SafeLdExp( double fract, int expt )
{
int minexpt = DBL_MIN_EXP * log2FLT_RADIX;
volatile double a, b, retval;
if ( expt < minexpt ) {
a = ldexp( fract, expt - mantBits - minexpt );
b = ldexp( 1.0, mantBits + minexpt );
retval = a * b;
} else {
retval = ldexp( fract, expt );
}
return retval;
}
/*
*----------------------------------------------------------------------
*
* TclFormatNaN --
*
* Makes the string representation of a "Not a Number"
*
* Results:
* None.
*
* Side effects:
* Stores the string representation in the supplied buffer,
* which must be at least TCL_DOUBLE_SPACE characters.
*
*----------------------------------------------------------------------
*/
void
TclFormatNaN( double value, /* The Not-a-Number to format */
char* buffer ) /* String representation */
{
#ifndef IEEE_FLOATING_POINT
strcpy( buffer, "NaN" );
return;
#else
union {
double dv;
Tcl_WideUInt iv;
} bitwhack;
bitwhack.dv = value;
if ( bitwhack.iv & ((Tcl_WideUInt) 1 << 63 ) ) {
bitwhack.iv &= ~ ((Tcl_WideUInt) 1 << 63 );
*buffer++ = '-';
}
*buffer++ = 'N'; *buffer++ = 'a'; *buffer++ = 'N';
bitwhack.iv &= (((Tcl_WideUInt) 1) << 51) - 1;
if ( bitwhack.iv != 0 ) {
sprintf( buffer, "(%" TCL_LL_MODIFIER "x)", bitwhack.iv );
} else {
*buffer = '\0';
}
#endif
}
|
Changes to generic/tclStringObj.c.
| ︙ | ︙ | |||
29 30 31 32 33 34 35 | * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclStringObj.c,v 1.35.4.2 2005/06/13 01:46:16 msofer Exp $ */ #include "tclInt.h" /* * Prototypes for procedures defined later in this file: */ |
| ︙ | ︙ | |||
204 205 206 207 208 209 210 |
* NULL byte. */
{
register Tcl_Obj *objPtr;
if (length < 0) {
length = (bytes? strlen(bytes) : 0);
}
| < | | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
* NULL byte. */
{
register Tcl_Obj *objPtr;
if (length < 0) {
length = (bytes? strlen(bytes) : 0);
}
TclNewStringObj(objPtr, bytes, length);
return objPtr;
}
#endif /* TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ |
Changes to generic/tclStubInit.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclStubInit.c -- * * This file contains the initializers for the Tcl stub vectors. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclStubInit.c -- * * This file contains the initializers for the Tcl stub vectors. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclStubInit.c,v 1.113.2.2 2005/06/13 01:46:16 msofer Exp $ */ #include "tclInt.h" /* * Remove macros that will interfere with the definitions below. */ |
| ︙ | ︙ | |||
260 261 262 263 264 265 266 |
TclUniCharMatch, /* 173 */
TclIncrWideVar2, /* 174 */
TclCallVarTraces, /* 175 */
TclCleanupVar, /* 176 */
TclVarErrMsg, /* 177 */
Tcl_SetStartupScript, /* 178 */
Tcl_GetStartupScript, /* 179 */
| | | | > > > > > > | 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 |
TclUniCharMatch, /* 173 */
TclIncrWideVar2, /* 174 */
TclCallVarTraces, /* 175 */
TclCleanupVar, /* 176 */
TclVarErrMsg, /* 177 */
Tcl_SetStartupScript, /* 178 */
Tcl_GetStartupScript, /* 179 */
NULL, /* 180 */
NULL, /* 181 */
TclpLocaltime, /* 182 */
TclpGmtime, /* 183 */
TclThreadStorageLockInit, /* 184 */
TclThreadStorageLock, /* 185 */
TclThreadStorageUnlock, /* 186 */
TclThreadStoragePrint, /* 187 */
TclThreadStorageGetHashTable, /* 188 */
TclThreadStorageInit, /* 189 */
TclThreadStorageDataKeyInit, /* 190 */
TclThreadStorageDataKeyGet, /* 191 */
TclThreadStorageDataKeySet, /* 192 */
TclFinalizeThreadStorageThread, /* 193 */
TclFinalizeThreadStorage, /* 194 */
TclFinalizeThreadStorageData, /* 195 */
TclFinalizeThreadStorageDataKey, /* 196 */
TclCompEvalObj, /* 197 */
TclObjGetFrame, /* 198 */
NULL, /* 199 */
TclpObjRemoveDirectory, /* 200 */
TclpObjCopyDirectory, /* 201 */
TclpObjCreateDirectory, /* 202 */
TclpObjDeleteFile, /* 203 */
TclpObjCopyFile, /* 204 */
TclpObjRenameFile, /* 205 */
TclpObjStat, /* 206 */
TclpObjAccess, /* 207 */
TclpOpenFileChannel, /* 208 */
TclGetEncodingSearchPath, /* 209 */
TclSetEncodingSearchPath, /* 210 */
TclpGetEncodingNameFromEnvironment, /* 211 */
TclpFindExecutable, /* 212 */
TclGetObjNameOfExecutable, /* 213 */
TclSetObjNameOfExecutable, /* 214 */
TclStackAlloc, /* 215 */
TclStackFree, /* 216 */
TclPushStackFrame, /* 217 */
TclPopStackFrame, /* 218 */
TclBN_mp_div_d, /* 219 */
TclBN_mp_mul_d, /* 220 */
TclBN_mp_clear, /* 221 */
TclBN_mp_init, /* 222 */
TclBN_mp_read_radix, /* 223 */
TclGetPlatform, /* 224 */
};
TclIntPlatStubs tclIntPlatStubs = {
TCL_STUB_MAGIC,
NULL,
#if !defined(__WIN32__) /* UNIX */
TclGetAndDetachPids, /* 0 */
|
| ︙ | ︙ | |||
347 348 349 350 351 352 353 |
TclpMakeFile, /* 18 */
TclpOpenFile, /* 19 */
TclWinAddProcess, /* 20 */
NULL, /* 21 */
TclpCreateTempFile, /* 22 */
TclpGetTZName, /* 23 */
TclWinNoBackslash, /* 24 */
| | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
TclpMakeFile, /* 18 */
TclpOpenFile, /* 19 */
TclWinAddProcess, /* 20 */
NULL, /* 21 */
TclpCreateTempFile, /* 22 */
TclpGetTZName, /* 23 */
TclWinNoBackslash, /* 24 */
NULL, /* 25 */
TclWinSetInterfaces, /* 26 */
TclWinFlushDirtyChannels, /* 27 */
TclWinResetInterfaces, /* 28 */
TclWinCPUID, /* 29 */
#endif /* __WIN32__ */
#ifdef MAC_OSX_TCL
TclMacOSXGetFileAttribute, /* 15 */
|
| ︙ | ︙ | |||
967 968 969 970 971 972 973 974 975 976 |
Tcl_GetEnsembleMappingDict, /* 548 */
Tcl_GetEnsembleUnknownHandler, /* 549 */
Tcl_GetEnsembleFlags, /* 550 */
Tcl_GetEnsembleNamespace, /* 551 */
Tcl_SetTimeProc, /* 552 */
Tcl_QueryTimeProc, /* 553 */
Tcl_ChannelThreadActionProc, /* 554 */
};
/* !END!: Do not edit above this line. */
| > > > > > > | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 |
Tcl_GetEnsembleMappingDict, /* 548 */
Tcl_GetEnsembleUnknownHandler, /* 549 */
Tcl_GetEnsembleFlags, /* 550 */
Tcl_GetEnsembleNamespace, /* 551 */
Tcl_SetTimeProc, /* 552 */
Tcl_QueryTimeProc, /* 553 */
Tcl_ChannelThreadActionProc, /* 554 */
Tcl_NewBignumObj, /* 555 */
Tcl_DbNewBignumObj, /* 556 */
Tcl_SetBignumObj, /* 557 */
Tcl_GetBignumFromObj, /* 558 */
Tcl_TruncateChannel, /* 559 */
Tcl_ChannelTruncateProc, /* 560 */
};
/* !END!: Do not edit above this line. */
|
Changes to generic/tclTest.c.
| ︙ | ︙ | |||
10 11 12 13 14 15 16 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Ajuba Solutions. * Copyright (c) 2003 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Ajuba Solutions. * Copyright (c) 2003 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclTest.c,v 1.88.2.1 2005/06/13 01:46:17 msofer Exp $ */ #define TCL_TEST #include "tclInt.h" /* * Required for Testregexp*Cmd |
| ︙ | ︙ | |||
304 305 306 307 308 309 310 311 312 313 314 315 316 317 | Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestparsevarnameObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestregexpObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static void TestregexpXflags _ANSI_ARGS_((char *string, int length, int *cflagsPtr, int *eflagsPtr)); static int TestsaveresultCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static void TestsaveresultFree _ANSI_ARGS_((char *blockPtr)); | > > > | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestparsevarnameObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestregexpObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestreturnObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static void TestregexpXflags _ANSI_ARGS_((char *string, int length, int *cflagsPtr, int *eflagsPtr)); static int TestsaveresultCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static void TestsaveresultFree _ANSI_ARGS_((char *blockPtr)); |
| ︙ | ︙ | |||
659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
Tcl_CreateObjCommand(interp, "testparser", TestparserObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testparsevar", TestparsevarObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testparsevarname", TestparsevarnameObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testregexp", TestregexpObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testsaveresult", TestsaveresultCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "testsetassocdata", TestsetassocdataCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "testsetnoerr", TestsetCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
| > > | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
Tcl_CreateObjCommand(interp, "testparser", TestparserObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testparsevar", TestparsevarObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testparsevarname", TestparsevarnameObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testregexp", TestregexpObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testreturn", TestreturnObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testsaveresult", TestsaveresultCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "testsetassocdata", TestsetassocdataCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "testsetnoerr", TestsetCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
|
| ︙ | ︙ | |||
2453 2454 2455 2456 2457 2458 2459 |
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
CONST char **argv; /* Argument strings. */
{
static CONST char *platformStrings[] = { "unix", "mac", "windows" };
TclPlatformType *platform;
| < | < < < | 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 |
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
CONST char **argv; /* Argument strings. */
{
static CONST char *platformStrings[] = { "unix", "mac", "windows" };
TclPlatformType *platform;
platform = TclGetPlatform();
if (argc != 1) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
(char *) NULL);
return TCL_ERROR;
}
|
| ︙ | ︙ | |||
3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 |
*cflagsPtr = cflags;
*eflagsPtr = eflags;
}
/*
*----------------------------------------------------------------------
*
* TestsetassocdataCmd --
*
* This procedure implements the "testsetassocdata" command. It is used
* to test Tcl_SetAssocData.
*
* Results:
* A standard Tcl result.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 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 |
*cflagsPtr = cflags;
*eflagsPtr = eflags;
}
/*
*----------------------------------------------------------------------
*
* TestreturnObjCmd --
*
* This procedure implements the "testreturn" command. It is
* used to verify that a
* return TCL_RETURN;
* has same behavior as
* return Tcl_SetReturnOptions(interp, Tcl_NewObj());
*
* Results:
* A standard Tcl result.
*
* Side effects:
* See the user documentation.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
TestreturnObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
return TCL_RETURN;
}
/*
*----------------------------------------------------------------------
*
* TestsetassocdataCmd --
*
* This procedure implements the "testsetassocdata" command. It is used
* to test Tcl_SetAssocData.
*
* Results:
* A standard Tcl result.
|
| ︙ | ︙ | |||
3693 3694 3695 3696 3697 3698 3699 |
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
CONST char **argv; /* Argument strings. */
{
size_t length;
TclPlatformType *platform;
| < | < < < | 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 |
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
CONST char **argv; /* Argument strings. */
{
size_t length;
TclPlatformType *platform;
platform = TclGetPlatform();
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
" platform\"", (char *) NULL);
return TCL_ERROR;
}
|
| ︙ | ︙ |
Changes to generic/tclTestObj.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tclTestObj.c -- * * This file contains C command procedures for the additional Tcl * commands that are used for testing implementations of the Tcl object * types. These commands are not normally included in Tcl * applications; they're only used for testing. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /* * tclTestObj.c -- * * This file contains C command procedures for the additional Tcl * commands that are used for testing implementations of the Tcl object * types. These commands are not normally included in Tcl * applications; they're only used for testing. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * Copyright (c) 2005 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclTestObj.c,v 1.12.8.1 2005/06/13 01:46:17 msofer Exp $ */ #include "tclInt.h" #include "tommath.h" /* * An array of Tcl_Obj pointers used in the commands that operate on or get * the values of Tcl object-valued variables. varPtr[i] is the i-th * variable's Tcl_Obj *. */ |
| ︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | static int CheckIfVarUnset _ANSI_ARGS_((Tcl_Interp *interp, int varIndex)); static int GetVariableIndex _ANSI_ARGS_((Tcl_Interp *interp, char *string, int *indexPtr)); static void SetVarToObj _ANSI_ARGS_((int varIndex, Tcl_Obj *objPtr)); int TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp)); static int TestbooleanobjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestconvertobjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestdoubleobjCmd _ANSI_ARGS_((ClientData dummy, | > > > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | static int CheckIfVarUnset _ANSI_ARGS_((Tcl_Interp *interp, int varIndex)); static int GetVariableIndex _ANSI_ARGS_((Tcl_Interp *interp, char *string, int *indexPtr)); static void SetVarToObj _ANSI_ARGS_((int varIndex, Tcl_Obj *objPtr)); int TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp)); static int TestbignumobjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestbooleanobjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestconvertobjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestdoubleobjCmd _ANSI_ARGS_((ClientData dummy, |
| ︙ | ︙ | |||
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 |
{
register int i;
for (i = 0; i < NUMBER_OF_OBJECT_VARS; i++) {
varPtr[i] = NULL;
}
Tcl_CreateObjCommand(interp, "testbooleanobj", TestbooleanobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testconvertobj", TestconvertobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testdoubleobj", TestdoubleobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testintobj", TestintobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testindexobj", TestindexobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testobj", TestobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "teststringobj", TeststringobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TestbooleanobjCmd --
*
* This procedure implements the "testbooleanobj" command. It is used
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 |
{
register int i;
for (i = 0; i < NUMBER_OF_OBJECT_VARS; i++) {
varPtr[i] = NULL;
}
Tcl_CreateObjCommand( interp, "testbignumobj", TestbignumobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc*) NULL );
Tcl_CreateObjCommand(interp, "testbooleanobj", TestbooleanobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testconvertobj", TestconvertobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testdoubleobj", TestdoubleobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testintobj", TestintobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testindexobj", TestindexobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testobj", TestobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "teststringobj", TeststringobjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TestbignumobjCmd --
*
* This procedure implmenets the "testbignumobj" command. It is used
* to exercise the bignum Tcl object type implementation.
*
* Results:
* Returns a standard Tcl object result.
*
* Side effects:
* Creates and frees bignum objects; converts objects to have bignum
* type.
*
*----------------------------------------------------------------------
*/
static int
TestbignumobjCmd( clientData, interp, objc, objv )
ClientData clientData; /* unused */
Tcl_Interp* interp; /* Tcl interpreter */
int objc; /* Argument count */
Tcl_Obj* CONST objv[]; /* Argument vector */
{
const char * subcmds[] = {
"set", "get", "mult10", "div10",
NULL
};
enum options {
BIGNUM_SET, BIGNUM_GET, BIGNUM_MULT10, BIGNUM_DIV10
};
int index, varIndex;
char* string;
mp_int bignumValue, newValue;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg?...");
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[1], subcmds, "option", 0,
&index) != TCL_OK) {
return TCL_ERROR;
}
string = Tcl_GetString(objv[2]);
if (GetVariableIndex(interp, string, &varIndex) != TCL_OK) {
return TCL_ERROR;
}
switch (index) {
case BIGNUM_SET:
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,
Tcl_NewStringObj("error in mp_init", -1));
return TCL_ERROR;
}
if (mp_read_radix(&bignumValue, string, 10) != MP_OKAY) {
mp_clear(&bignumValue);
Tcl_SetObjResult(interp,
Tcl_NewStringObj("error in mp_read_radix", -1));
return TCL_ERROR;
}
/*
* If the object currently bound to the variable with index
* 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".
*/
if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) {
Tcl_SetBignumObj(varPtr[varIndex], &bignumValue);
} else {
SetVarToObj(varIndex, Tcl_NewBignumObj(&bignumValue));
}
break;
case BIGNUM_GET:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "varIndex");
return TCL_ERROR;
}
if (CheckIfVarUnset(interp, varIndex)) {
return TCL_ERROR;
}
break;
case BIGNUM_MULT10:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "varIndex");
return TCL_ERROR;
}
if (CheckIfVarUnset(interp, varIndex)) {
return TCL_ERROR;
}
if (Tcl_GetBignumFromObj(interp, varPtr[varIndex],
&bignumValue) != TCL_OK) {
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,
Tcl_NewStringObj("error in mp_mul_d", -1));
return TCL_ERROR;
}
mp_clear(&bignumValue);
if (!Tcl_IsShared(varPtr[varIndex])) {
Tcl_SetBignumObj(varPtr[varIndex], &newValue);
} else {
SetVarToObj(varIndex, Tcl_NewBignumObj(&newValue));
}
break;
case BIGNUM_DIV10:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "varIndex");
return TCL_ERROR;
}
if (CheckIfVarUnset(interp, varIndex)) {
return TCL_ERROR;
}
if (Tcl_GetBignumFromObj(interp, varPtr[varIndex],
&bignumValue) != TCL_OK) {
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,
Tcl_NewStringObj("error in mp_div_d", -1));
return TCL_ERROR;
}
mp_clear(&bignumValue);
if (!Tcl_IsShared(varPtr[varIndex])) {
Tcl_SetBignumObj(varPtr[varIndex], &newValue);
} else {
SetVarToObj(varIndex, Tcl_NewBignumObj(&newValue));
}
}
Tcl_SetObjResult(interp, varPtr[varIndex]);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TestbooleanobjCmd --
*
* This procedure implements the "testbooleanobj" command. It is used
|
| ︙ | ︙ |
Changes to generic/tclThread.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclThread.c -- * * This file implements Platform independent thread operations. * Most of the real work is done in the platform dependent files. * * Copyright (c) 1998 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclThread.c -- * * This file implements Platform independent thread operations. * Most of the real work is done in the platform dependent files. * * Copyright (c) 1998 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclThread.c,v 1.10.2.1 2005/06/13 01:46:17 msofer Exp $ */ #include "tclInt.h" /* * There are three classes of synchronization objects: * mutexes, thread data keys, and condition variables. |
| ︙ | ︙ |
Changes to generic/tclThreadAlloc.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclThreadAlloc.c -- * * This is a very fast storage allocator for used with threads (designed * avoid lock contention). The basic strategy is to allocate memory in * fixed size blocks from block caches. * * The Initial Developer of the Original Code is America Online, Inc. * Portions created by AOL are Copyright (C) 1999 America Online, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclThreadAlloc.c -- * * This is a very fast storage allocator for used with threads (designed * avoid lock contention). The basic strategy is to allocate memory in * fixed size blocks from block caches. * * The Initial Developer of the Original Code is America Online, Inc. * Portions created by AOL are Copyright (C) 1999 America Online, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclThreadAlloc.c,v 1.14.4.1 2005/06/13 01:46:18 msofer Exp $ */ #include "tclInt.h" #if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) /* * If range checking is enabled, an additional byte will be allocated |
| ︙ | ︙ | |||
984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
}
TclpFreeAllocMutex(objLockPtr);
objLockPtr = NULL;
TclpFreeAllocMutex(listLockPtr);
listLockPtr = NULL;
}
#else
/*
*----------------------------------------------------------------------
*
| > > | 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 |
}
TclpFreeAllocMutex(objLockPtr);
objLockPtr = NULL;
TclpFreeAllocMutex(listLockPtr);
listLockPtr = NULL;
TclpFreeAllocCache(NULL);
}
#else
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ |
Changes to generic/tclThreadTest.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclThreadTest.c -- * * This file implements the testthread command. Eventually this * should be tclThreadCmd.c * Some of this code is based on work done by Richard Hipp on behalf of * Conservation Through Innovation, Limited, with their permission. * * Copyright (c) 1998 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclThreadTest.c -- * * This file implements the testthread command. Eventually this * should be tclThreadCmd.c * Some of this code is based on work done by Richard Hipp on behalf of * Conservation Through Innovation, Limited, with their permission. * * Copyright (c) 1998 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclThreadTest.c,v 1.17.4.1 2005/06/13 01:46:18 msofer Exp $ */ #include "tclInt.h" #ifdef TCL_THREADS /* * Each thread has an single instance of the following structure. There |
| ︙ | ︙ | |||
156 157 158 159 160 161 162 |
int
TclThread_Init(interp)
Tcl_Interp *interp; /* The current Tcl interpreter */
{
Tcl_CreateObjCommand(interp,"testthread", Tcl_ThreadObjCmd,
(ClientData)NULL ,NULL);
| < < < | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
int
TclThread_Init(interp)
Tcl_Interp *interp; /* The current Tcl interpreter */
{
Tcl_CreateObjCommand(interp,"testthread", Tcl_ThreadObjCmd,
(ClientData)NULL ,NULL);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ |
Changes to generic/tclTimer.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclTimer.c -- * * This file provides timer event management facilities for Tcl, * including the "after" command. * * Copyright (c) 1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclTimer.c -- * * This file provides timer event management facilities for Tcl, * including the "after" command. * * Copyright (c) 1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclTimer.c,v 1.13.2.1 2005/06/13 01:46:18 msofer Exp $ */ #include "tclInt.h" /* * For each timer callback that's pending there is one record of the following * type. The normal handlers (created by Tcl_CreateTimerHandler) are chained |
| ︙ | ︙ | |||
780 781 782 783 784 785 786 |
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
/*
* Create the "after" information associated for this interpreter,
| | < < | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
/*
* Create the "after" information associated for this interpreter,
* if it doesn't already exist.
*/
assocPtr = Tcl_GetAssocData( interp, "tclAfter", NULL );
if (assocPtr == NULL) {
assocPtr = (AfterAssocData *) ckalloc(sizeof(AfterAssocData));
assocPtr->interp = interp;
assocPtr->firstAfterPtr = NULL;
|
| ︙ | ︙ |
Added generic/tclTomMath.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 100 101 102 103 104 105 106 107 108 109 | /* * tclTomMath.h -- * * Interface information that comes in at the head of * <tommath.h> to adapt the API to Tcl's linkage conventions. * * Copyright (c) 2005 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclTomMath.h,v 1.2.4.2 2005/06/13 01:46:18 msofer Exp $ */ #ifndef TCLTOMMATH_H #define TCLTOMMATH_H 1 #include <tcl.h> #include <stdlib.h> /* Define TOMMATH_DLLIMPORT and TOMMATH_DLLEXPORT to suit the compiler */ #ifdef STATIC_BUILD # define TOMMATH_DLLIMPORT # define TOMMATH_DLLEXPORT #else # if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec)))) # define TOMMATH_DLLIMPORT __declspec(dllimport) # define TOMMATH_DLLEXPORT __declspec(dllexport) # else # define TOMMATH_DLLIMPORT # define TOMMATH_DLLEXPORT # endif #endif /* Define TOMMATH_STORAGE_CLASS according to the build options. */ #undef TOMMATH_STORAGE_CLASS #ifdef BUILD_tcl # define TOMMATH_STORAGE_CLASS TOMMATH_DLLEXPORT #else # ifdef USE_TCL_STUBS # define TOMMATH_STORAGE_CLASS # else # define TOMMATH_STORAGE_CLASS TOMMATH_DLLIMPORT # endif #endif /* Define custom memory allocation for libtommath */ #define XMALLOC(x) TclBNAlloc(x) #define XFREE(x) TclBNFree(x) #define XREALLOC(x,n) TclBNRealloc(x,n) #define XCALLOC(n,x) TclBNCalloc(n,x) void* TclBNAlloc( size_t ); void* TclBNRealloc( void*, size_t ); void TclBNFree( void* ); void* TclBNCalloc( size_t, size_t ); /* Rename all global symboles in libtommath to avoid linkage conflicts */ #define KARATSUBA_MUL_CUTOFF TclBNKaratsubaMulCutoff #define KARATSUBA_SQR_CUTOFF TclBNKaratsubaSqrCutoff #define TOOM_MUL_CUTOFF TclBNToomMulCutoff #define TOOM_SQR_CUTOFF TclBNToomSqrCutoff #define mp_s_rmap TclBNMpSRmap #define bn_reverse TclBN_reverse #define fast_s_mp_mul_digs TclBN_fast_s_mp_mul_digs #define mp_add TclBN_mp_add #define mp_clamp TclBN_mp_clamp #define mp_clear TclBN_mp_clear #define mp_clear_multi TclBN_mp_clear_multi #define mp_cmp TclBN_mp_cmp #define mp_cmp_mag TclBN_mp_cmp_mag #define mp_copy TclBN_mp_copy #define mp_count_bits TclBN_mp_count_bits #define mp_div TclBN_mp_div #define mp_div_d TclBN_mp_div_d #define mp_div_2 TclBN_mp_div_2 #define mp_div_2d TclBN_mp_div_2d #define mp_div_3 TclBN_mp_div_3 #define mp_exch TclBN_mp_exch #define mp_grow TclBN_mp_grow #define mp_init TclBN_mp_init #define mp_init_copy TclBN_mp_init_copy #define mp_init_multi TclBN_mp_init_multi #define mp_init_size TclBN_mp_init_size #define mp_karatsuba_mul TclBN_mp_karatsuba_mul #define mp_lshd TclBN_mp_lshd #define mp_mod_2d TclBN_mp_mod_2d #define mp_mul TclBN_mp_mul #define mp_mul_2 TclBN_mp_mul_2 #define mp_mul_2d TclBN_mp_mul_2d #define mp_mul_d TclBN_mp_mul_d #define mp_radix_size TclBN_mp_radix_size #define mp_read_radix TclBN_mp_read_radix #define mp_rshd TclBN_mp_rshd #define mp_sub TclBN_mp_sub #define mp_toom_mul TclBN_mp_toom_mul #define mp_toradix_n TclBN_mp_toradix_n #define mp_zero TclBN_mp_zero #define s_mp_add TclBN_s_mp_add #define s_mp_mul_digs TclBN_s_mp_mul_digs #define s_mp_sub TclBN_s_mp_sub #endif |
Added generic/tclTomMathInterface.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 |
/*
*----------------------------------------------------------------------
*
* tclTomMathInterface.c --
*
* This file contains procedures that are used as a 'glue'
* layer between Tcl and libtommath.
*
* Copyright (c) 2005 by Kevin B. Kenny. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclTomMathInterface.c,v 1.2.4.2 2005/06/13 01:46:18 msofer Exp $
*/
#include "tclInt.h"
#include "tommath.h"
#include <limits.h>
/*
*----------------------------------------------------------------------
*
* TclBNAlloc --
*
* Allocate memory for libtommath.
*
* Results:
* Returns a pointer to the allocated block.
*
* This procedure is a wrapper around Tcl_Alloc, needed because of
* a mismatched type signature between Tcl_Alloc and malloc.
*
*----------------------------------------------------------------------
*/
extern void *
TclBNAlloc( size_t x )
{
return (void*) Tcl_Alloc( (unsigned int) x );
}
/*
*----------------------------------------------------------------------
*
* TclBNAlloc --
*
* Change the size of an allocated block of memory in libtommath
*
* Results:
* Returns a pointer to the allocated block.
*
* This procedure is a wrapper around Tcl_Realloc, needed because of
* a mismatched type signature between Tcl_Realloc and realloc.
*
*----------------------------------------------------------------------
*/
extern void *
TclBNRealloc( void* p, size_t s )
{
return (void*) Tcl_Realloc( (char*) p, (unsigned int) s );
}
/*
*----------------------------------------------------------------------
*
* TclBNFree --
*
* Free allocated memory in libtommath.
*
* Results:
* None.
*
* Side effects:
* Memory is freed.
*
* This function is simply a wrapper around Tcl_Free, needed in
* libtommath because of a type mismatch between free and Tcl_Free.
*
*----------------------------------------------------------------------
*/
extern void
TclBNFree( void* p )
{
Tcl_Free( (char*) p);
}
/*
*----------------------------------------------------------------------
*
* TclBNInitBignumFromLong --
*
* Allocate and initialize a 'bignum' from a native 'long'.
*
* Results:
* None.
*
* Side effects:
* The 'bignum' is constructed.
*
*----------------------------------------------------------------------
*/
extern void
TclBNInitBignumFromLong( mp_int* a, long initVal )
{
int status;
unsigned long v;
mp_digit* p;
/*
* Allocate enough memory to hold the largest possible long
*/
status = mp_init_size( a, ( ( CHAR_BIT * sizeof( long ) + DIGIT_BIT - 1 )
/ DIGIT_BIT ) );
if ( status != MP_OKAY ) {
Tcl_Panic( "initialization failure in TclBNInitBignumFromLong" );
}
/* Convert arg to sign and magnitude */
if ( initVal < 0 ) {
a->sign = MP_NEG;
v = -initVal;
} else {
a->sign = MP_ZPOS;
v = initVal;
}
/* Store the magnitude in the bignum. */
p = a->dp;
while ( v ) {
*p++ = (mp_digit) ( v & MP_MASK );
v >>= MP_DIGIT_BIT;
}
a->used = p - a->dp;
}
|
Changes to generic/tclTrace.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclTrace.c -- * * This file contains code to handle most trace management. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Scriptics Corporation. * Copyright (c) 2002 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclTrace.c -- * * This file contains code to handle most trace management. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Scriptics Corporation. * Copyright (c) 2002 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclTrace.c,v 1.21.4.3 2005/06/13 01:46:18 msofer Exp $ */ #include "tclInt.h" /* * Structure used to hold information about variable traces: */ |
| ︙ | ︙ | |||
58 59 60 61 62 63 64 | * hold command. This field must be the * last in the structure, so that it can * be larger than 4 bytes. */ } TraceCommandInfo; /* * Used by command execution traces. Note that we assume in the code | | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | * hold command. This field must be the * last in the structure, so that it can * be larger than 4 bytes. */ } TraceCommandInfo; /* * Used by command execution traces. Note that we assume in the code * that TCL_TRACE_ENTER_DURING_EXEC == 4 * TCL_TRACE_ENTER_EXEC and * that TCL_TRACE_LEAVE_DURING_EXEC == 4 * TCL_TRACE_LEAVE_EXEC. * * TCL_TRACE_ENTER_DURING_EXEC - Trace each command inside the command * currently being traced, before execution. * TCL_TRACE_LEAVE_DURING_EXEC - Trace each command inside the command * currently being traced, after execution. * TCL_TRACE_ANY_EXEC - OR'd combination of all EXEC flags. * TCL_TRACE_EXEC_IN_PROGRESS - The callback procedure on this trace |
| ︙ | ︙ | |||
1458 1459 1460 1461 1462 1463 1464 |
Tcl_Obj *CONST objv[]; /* Pointers to Tcl_Obj of each argument. */
{
Interp *iPtr = (Interp *) interp;
Trace *tracePtr, *lastTracePtr;
ActiveInterpTrace active;
int curLevel;
int traceCode = TCL_OK;
| < | 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 |
Tcl_Obj *CONST objv[]; /* Pointers to Tcl_Obj of each argument. */
{
Interp *iPtr = (Interp *) interp;
Trace *tracePtr, *lastTracePtr;
ActiveInterpTrace active;
int curLevel;
int traceCode = TCL_OK;
Tcl_InterpState state = NULL;
if (command == NULL || iPtr->tracePtr == NULL ||
(iPtr->flags & INTERP_TRACE_IN_PROGRESS)) {
return(traceCode);
}
|
| ︙ | ︙ | |||
1512 1513 1514 1515 1516 1517 1518 |
tracePtr->flags |= TCL_TRACE_EXEC_IN_PROGRESS;
if (state == NULL) {
state = Tcl_SaveInterpState(interp, code);
}
if (tracePtr->flags & (TCL_TRACE_ENTER_EXEC | TCL_TRACE_LEAVE_EXEC)) {
/* New style trace */
| < | > > | | | > | < | < | | 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 |
tracePtr->flags |= TCL_TRACE_EXEC_IN_PROGRESS;
if (state == NULL) {
state = Tcl_SaveInterpState(interp, code);
}
if (tracePtr->flags & (TCL_TRACE_ENTER_EXEC | TCL_TRACE_LEAVE_EXEC)) {
/* New style trace */
if (tracePtr->flags & traceFlags) {
if (tracePtr->proc == TraceExecutionProc) {
TraceCommandInfo* tcmdPtr =
(TraceCommandInfo *) tracePtr->clientData;
tcmdPtr->curFlags = traceFlags;
tcmdPtr->curCode = code;
}
traceCode = (tracePtr->proc)(tracePtr->clientData,
interp, curLevel, command, (Tcl_Command) cmdPtr,
objc, objv);
}
} else {
/* Old-style trace */
if (traceFlags & TCL_TRACE_ENTER_EXEC) {
/*
* Old-style interpreter-wide traces only trigger
|
| ︙ | ︙ | |||
2297 2298 2299 2300 2301 2302 2303 |
varPtr = TclLookupVar(interp, varName, (char *) NULL,
0, "access", /*createPart1*/ 0, /*createPart2*/ 1, &arrayPtr);
if (varPtr == NULL) {
return NULL;
}
| | | | 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 |
varPtr = TclLookupVar(interp, varName, (char *) NULL,
0, "access", /*createPart1*/ 0, /*createPart2*/ 1, &arrayPtr);
if (varPtr == NULL) {
return NULL;
}
if (TclIsVarTraced(varPtr)
|| (arrayPtr && TclIsVarTraced(arrayPtr))) {
TclCallVarTraces((Interp *)interp, arrayPtr, varPtr, varName, NULL,
TCL_TRACE_READS, /* leaveErrMsg */ 0);
}
/*
* If the variable doesn't exist anymore and no-one's using
* it, then free up the relevant structures and hash table entries.
|
| ︙ | ︙ | |||
2378 2379 2380 2381 2382 2383 2384 |
* variable, don't call them again.
*/
if (TclIsVarTraceActive(varPtr)) {
return code;
}
TclSetVarTraceActive(varPtr);
| > > | > | | 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 |
* variable, don't call them again.
*/
if (TclIsVarTraceActive(varPtr)) {
return code;
}
TclSetVarTraceActive(varPtr);
if (!TclIsVarShort(varPtr)) {
varPtr->refCount++;
}
if (arrayPtr && !TclIsVarShort(arrayPtr)) {
arrayPtr->refCount++;
}
/*
* If the variable name hasn't been parsed into array name and
* element, do it here. If there really is an array element,
* make a copy of the original name so that NULLs can be
|
| ︙ | ︙ | |||
2425 2426 2427 2428 2429 2430 2431 |
* Invoke traces on the array containing the variable, if relevant.
*/
result = NULL;
active.nextPtr = iPtr->activeVarTracePtr;
iPtr->activeVarTracePtr = &active;
Tcl_Preserve((ClientData) iPtr);
| > | | 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 |
* Invoke traces on the array containing the variable, if relevant.
*/
result = NULL;
active.nextPtr = iPtr->activeVarTracePtr;
iPtr->activeVarTracePtr = &active;
Tcl_Preserve((ClientData) iPtr);
if (arrayPtr && !TclIsVarShort(arrayPtr)
&& !TclIsVarTraceActive(arrayPtr)) {
active.varPtr = arrayPtr;
for (tracePtr = arrayPtr->tracePtr; tracePtr != NULL;
tracePtr = active.nextTracePtr) {
active.nextTracePtr = tracePtr->nextPtr;
if (!(tracePtr->flags & flags)) {
continue;
}
|
| ︙ | ︙ | |||
2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 |
/*
* Invoke traces on the variable itself.
*/
if (flags & TCL_TRACE_UNSETS) {
flags |= TCL_TRACE_DESTROYED;
}
active.varPtr = varPtr;
for (tracePtr = varPtr->tracePtr; tracePtr != NULL;
tracePtr = active.nextTracePtr) {
active.nextTracePtr = tracePtr->nextPtr;
if (!(tracePtr->flags & flags)) {
continue;
}
| > > > > > | 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 |
/*
* Invoke traces on the variable itself.
*/
if (flags & TCL_TRACE_UNSETS) {
flags |= TCL_TRACE_DESTROYED;
}
if (TclIsVarShort(varPtr)) {
goto done;
}
active.varPtr = varPtr;
for (tracePtr = varPtr->tracePtr; tracePtr != NULL;
tracePtr = active.nextTracePtr) {
active.nextTracePtr = tracePtr->nextPtr;
if (!(tracePtr->flags & flags)) {
continue;
}
|
| ︙ | ︙ | |||
2559 2560 2561 2562 2563 2564 2565 |
if (code == TCL_OK) {
code = Tcl_RestoreInterpState((Tcl_Interp *)iPtr, state);
} else {
Tcl_DiscardInterpState(state);
}
}
| | > | > | 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 |
if (code == TCL_OK) {
code = Tcl_RestoreInterpState((Tcl_Interp *)iPtr, state);
} else {
Tcl_DiscardInterpState(state);
}
}
if (arrayPtr && !TclIsVarShort(arrayPtr)) {
arrayPtr->refCount--;
}
if (copiedName) {
Tcl_DStringFree(&nameCopy);
}
TclClearVarTraceActive(varPtr);
if (!TclIsVarShort(varPtr)) {
varPtr->refCount--;
}
iPtr->activeVarTracePtr = active.nextPtr;
Tcl_Release((ClientData) iPtr);
return code;
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 |
varPtr = TclLookupVar(interp, part1, part2, flags & flagMask,
/*msg*/ (char *) NULL,
/*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
if (varPtr == NULL) {
return;
}
/*
* Set up a mask to mask out the parts of the flags that we are not
* interested in now.
*/
flagMask = TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS |
TCL_TRACE_ARRAY | TCL_TRACE_RESULT_DYNAMIC | TCL_TRACE_RESULT_OBJECT;
#ifndef TCL_REMOVE_OBSOLETE_TRACES
| > > > > > > > > | 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 |
varPtr = TclLookupVar(interp, part1, part2, flags & flagMask,
/*msg*/ (char *) NULL,
/*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
if (varPtr == NULL) {
return;
}
/*
* Nothing to be done for short vars
*/
if (TclIsVarShort(varPtr)) {
return;
}
/*
* Set up a mask to mask out the parts of the flags that we are not
* interested in now.
*/
flagMask = TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS |
TCL_TRACE_ARRAY | TCL_TRACE_RESULT_DYNAMIC | TCL_TRACE_RESULT_OBJECT;
#ifndef TCL_REMOVE_OBSOLETE_TRACES
|
| ︙ | ︙ | |||
2735 2736 2737 2738 2739 2740 2741 |
Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);
/*
* If this is the last trace on the variable, and the variable is
* unset and unused, then free up the variable.
*/
| > | | > > > > > > | 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 |
Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);
/*
* If this is the last trace on the variable, and the variable is
* unset and unused, then free up the variable.
*/
if (!varPtr->tracePtr) {
if (TclIsVarUndefined(varPtr)) {
TclCleanupVar(varPtr, (Var *) NULL);
} else if (TclIsVarScalar(varPtr)) {
if (!((varPtr->flags & VAR_IN_HASHTABLE)
&& (varPtr->id.hPtr == NULL))) {
varPtr->flags |= (VAR_DIRECT_READABLE|VAR_DIRECT_WRITABLE);
}
}
}
}
/*
*----------------------------------------------------------------------
*
* Tcl_VarTraceInfo --
|
| ︙ | ︙ | |||
2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 |
flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY),
/*msg*/ (char *) NULL,
/*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
if (varPtr == NULL) {
return NULL;
}
/*
* Find the relevant trace, if any, and return its clientData.
*/
tracePtr = varPtr->tracePtr;
if (prevClientData != NULL) {
for ( ; tracePtr != NULL; tracePtr = tracePtr->nextPtr) {
| > > > > > > > > | 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 |
flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY),
/*msg*/ (char *) NULL,
/*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
if (varPtr == NULL) {
return NULL;
}
/*
* Nothing to be done for short vars
*/
if (TclIsVarShort(varPtr)) {
return NULL;
}
/*
* Find the relevant trace, if any, and return its clientData.
*/
tracePtr = varPtr->tracePtr;
if (prevClientData != NULL) {
for ( ; tracePtr != NULL; tracePtr = tracePtr->nextPtr) {
|
| ︙ | ︙ | |||
2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 |
* Tcl_Panic() because there should be no code path that ever sets
* both flags.
*/
if ((flags&TCL_TRACE_RESULT_DYNAMIC) && (flags&TCL_TRACE_RESULT_OBJECT)) {
Tcl_Panic("bad result flag combination");
}
/*
* Set up trace information.
*/
flagMask = TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS |
TCL_TRACE_ARRAY | TCL_TRACE_RESULT_DYNAMIC | TCL_TRACE_RESULT_OBJECT;
#ifndef TCL_REMOVE_OBSOLETE_TRACES
flagMask |= TCL_TRACE_OLD_STYLE;
#endif
tracePtr = (VarTrace *) ckalloc(sizeof(VarTrace));
tracePtr->traceProc = proc;
tracePtr->clientData = clientData;
tracePtr->flags = flags & flagMask;
tracePtr->nextPtr = varPtr->tracePtr;
varPtr->tracePtr = tracePtr;
return TCL_OK;
}
| > > > > > > > > > > | 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 |
* Tcl_Panic() because there should be no code path that ever sets
* both flags.
*/
if ((flags&TCL_TRACE_RESULT_DYNAMIC) && (flags&TCL_TRACE_RESULT_OBJECT)) {
Tcl_Panic("bad result flag combination");
}
/*
* Short vars have to be extended in order to record the traces.
*/
if (TclIsVarShort(varPtr)) {
varPtr = TclExtendVar(varPtr);
}
/*
* Set up trace information.
*/
flagMask = TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS |
TCL_TRACE_ARRAY | TCL_TRACE_RESULT_DYNAMIC | TCL_TRACE_RESULT_OBJECT;
#ifndef TCL_REMOVE_OBSOLETE_TRACES
flagMask |= TCL_TRACE_OLD_STYLE;
#endif
tracePtr = (VarTrace *) ckalloc(sizeof(VarTrace));
tracePtr->traceProc = proc;
tracePtr->clientData = clientData;
tracePtr->flags = flags & flagMask;
tracePtr->nextPtr = varPtr->tracePtr;
varPtr->tracePtr = tracePtr;
varPtr->flags &= ~(VAR_DIRECT_READABLE|VAR_DIRECT_WRITABLE);
return TCL_OK;
}
|
Changes to generic/tclUtf.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclUtf.c -- * * Routines for manipulating UTF-8 strings. * * Copyright (c) 1997-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclUtf.c -- * * Routines for manipulating UTF-8 strings. * * Copyright (c) 1997-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUtf.c,v 1.32.4.1 2005/06/13 01:46:18 msofer Exp $ */ #include "tclInt.h" /* * Include the static character classification tables and macros. */ |
| ︙ | ︙ | |||
153 154 155 156 157 158 159 | * Side effects: * None. * *--------------------------------------------------------------------------- */ INLINE int | | | | | | | | | | | | | | | | | | | | | | | | | 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 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
INLINE int
Tcl_UniCharToUtf(ch, buf)
int ch; /* The Tcl_UniChar to be stored in the
* buffer. */
char *buf; /* Buffer in which the UTF-8 representation
* of the Tcl_UniChar is stored. Buffer must
* be large enough to hold the UTF-8 character
* (at most TCL_UTF_MAX bytes). */
{
if ((ch > 0) && (ch < UNICODE_SELF)) {
buf[0] = (char) ch;
return 1;
}
if (ch <= 0x7FF) {
buf[1] = (char) ((ch | 0x80) & 0xBF);
buf[0] = (char) ((ch >> 6) | 0xC0);
return 2;
}
if (ch <= 0xFFFF) {
three:
buf[2] = (char) ((ch | 0x80) & 0xBF);
buf[1] = (char) (((ch >> 6) | 0x80) & 0xBF);
buf[0] = (char) ((ch >> 12) | 0xE0);
return 3;
}
#if TCL_UTF_MAX > 3
if (ch <= 0x1FFFFF) {
buf[3] = (char) ((ch | 0x80) & 0xBF);
buf[2] = (char) (((ch >> 6) | 0x80) & 0xBF);
buf[1] = (char) (((ch >> 12) | 0x80) & 0xBF);
buf[0] = (char) ((ch >> 18) | 0xF0);
return 4;
}
if (ch <= 0x3FFFFFF) {
buf[4] = (char) ((ch | 0x80) & 0xBF);
buf[3] = (char) (((ch >> 6) | 0x80) & 0xBF);
buf[2] = (char) (((ch >> 12) | 0x80) & 0xBF);
buf[1] = (char) (((ch >> 18) | 0x80) & 0xBF);
buf[0] = (char) ((ch >> 24) | 0xF8);
return 5;
}
if (ch <= 0x7FFFFFFF) {
buf[5] = (char) ((ch | 0x80) & 0xBF);
buf[4] = (char) (((ch >> 6) | 0x80) & 0xBF);
buf[3] = (char) (((ch >> 12) | 0x80) & 0xBF);
buf[2] = (char) (((ch >> 18) | 0x80) & 0xBF);
buf[1] = (char) (((ch >> 24) | 0x80) & 0xBF);
buf[0] = (char) ((ch >> 30) | 0xFC);
return 6;
}
#endif
ch = 0xFFFD;
goto three;
}
|
| ︙ | ︙ | |||
228 229 230 231 232 233 234 | * Side effects: * None. * *--------------------------------------------------------------------------- */ char * | | | | | | | | 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 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
char *
Tcl_UniCharToUtfDString(uniStr, uniLength, dsPtr)
CONST Tcl_UniChar *uniStr; /* Unicode string to convert to UTF-8. */
int uniLength; /* Length of Unicode string in Tcl_UniChars
* (must be >= 0). */
Tcl_DString *dsPtr; /* UTF-8 representation of string is
* appended to this previously initialized
* DString. */
{
CONST Tcl_UniChar *w, *wEnd;
char *p, *string;
int oldLength;
/*
* UTF-8 string length in bytes will be <= Unicode string length *
* TCL_UTF_MAX.
*/
oldLength = Tcl_DStringLength(dsPtr);
Tcl_DStringSetLength(dsPtr, (oldLength + uniLength + 1) * TCL_UTF_MAX);
string = Tcl_DStringValue(dsPtr) + oldLength;
p = string;
wEnd = uniStr + uniLength;
for (w = uniStr; w < wEnd; ) {
p += Tcl_UniCharToUtf(*w, p);
w++;
}
Tcl_DStringSetLength(dsPtr, oldLength + (p - string));
return string;
}
|
| ︙ | ︙ | |||
287 288 289 290 291 292 293 | * Side effects: * None. * *--------------------------------------------------------------------------- */ int | | | | | | | | | | | | 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 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
int
Tcl_UtfToUniChar(src, chPtr)
register CONST char *src; /* The UTF-8 string. */
register Tcl_UniChar *chPtr; /* Filled with the Tcl_UniChar represented
* by the UTF-8 string. */
{
register int byte;
/*
* Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones.
*/
byte = *((unsigned char *) src);
if (byte < 0xC0) {
/*
* Handles properly formed UTF-8 characters between 0x01 and 0x7F.
* Also treats \0 and naked trail bytes 0x80 to 0xBF as valid
* characters representing themselves.
*/
*chPtr = (Tcl_UniChar) byte;
return 1;
} else if (byte < 0xE0) {
if ((src[1] & 0xC0) == 0x80) {
/*
* Two-byte-character lead-byte followed by a trail-byte.
*/
*chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (src[1] & 0x3F));
return 2;
}
/*
* A two-byte-character lead-byte not followed by trail-byte
* represents itself.
*/
*chPtr = (Tcl_UniChar) byte;
return 1;
} else if (byte < 0xF0) {
if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80)) {
/*
* Three-byte-character lead byte followed by two trail bytes.
*/
*chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12)
| ((src[1] & 0x3F) << 6) | (src[2] & 0x3F));
return 3;
}
/*
* A three-byte-character lead-byte not followed by two trail-bytes
* represents itself.
*/
*chPtr = (Tcl_UniChar) byte;
return 1;
}
#if TCL_UTF_MAX > 3
else {
int ch, total, trail;
total = totalBytes[byte];
trail = total - 1;
if (trail > 0) {
ch = byte & (0x3F >> trail);
do {
src++;
if ((*src & 0xC0) != 0x80) {
*chPtr = byte;
return 1;
}
ch <<= 6;
ch |= (*src & 0x3F);
trail--;
} while (trail > 0);
*chPtr = ch;
return total;
}
}
#endif
|
| ︙ | ︙ | |||
390 391 392 393 394 395 396 | * Side effects: * None. * *--------------------------------------------------------------------------- */ Tcl_UniChar * | | | | | | | 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 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
Tcl_UniChar *
Tcl_UtfToUniCharDString(src, length, dsPtr)
CONST char *src; /* UTF-8 string to convert to Unicode. */
int length; /* Length of UTF-8 string in bytes, or -1
* for strlen(). */
Tcl_DString *dsPtr; /* Unicode representation of string is
* appended to this previously initialized
* DString. */
{
Tcl_UniChar *w, *wString;
CONST char *p, *end;
int oldLength;
if (length < 0) {
length = strlen(src);
}
/*
* Unicode string length in Tcl_UniChars will be <= UTF-8 string length
* in bytes.
*/
oldLength = Tcl_DStringLength(dsPtr);
Tcl_DStringSetLength(dsPtr,
(int) ((oldLength + length + 1) * sizeof(Tcl_UniChar)));
wString = (Tcl_UniChar *) (Tcl_DStringValue(dsPtr) + oldLength);
w = wString;
end = src + length;
for (p = src; p < end; ) {
p += TclUtfToUniChar(p, w);
w++;
}
*w = '\0';
Tcl_DStringSetLength(dsPtr,
(oldLength + ((char *) w - (char *) wString)));
|
| ︙ | ︙ | |||
449 450 451 452 453 454 455 | * Side effects: * None. * *--------------------------------------------------------------------------- */ int | | | | | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
int
Tcl_UtfCharComplete(src, length)
CONST char *src; /* String to check if first few bytes
* contain a complete UTF-8 character. */
int length; /* Length of above string in bytes. */
{
int ch;
ch = *((unsigned char *) src);
return length >= totalBytes[ch];
}
/*
*---------------------------------------------------------------------------
*
* Tcl_NumUtfChars --
*
|
| ︙ | ︙ | |||
479 480 481 482 483 484 485 | * Side effects: * None. * *--------------------------------------------------------------------------- */ int | | | | | | | | | | | | | | | 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 513 514 515 516 517 518 519 520 521 522 523 524 525 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
int
Tcl_NumUtfChars(src, length)
register CONST char *src; /* The UTF-8 string to measure. */
int length; /* The length of the string in bytes, or -1
* for strlen(string). */
{
Tcl_UniChar ch;
register Tcl_UniChar *chPtr = &ch;
register int i;
/*
* The separate implementations are faster.
*
* Since this is a time-sensitive function, we also do the check for
* the single-byte char case specially.
*/
i = 0;
if (length < 0) {
while (*src != '\0') {
src += TclUtfToUniChar(src, chPtr);
i++;
}
} else {
register int n;
while (length > 0) {
if (UCHAR(*src) < 0xC0) {
length--;
src++;
} else {
n = Tcl_UtfToUniChar(src, chPtr);
length -= n;
src += n;
}
i++;
}
}
return i;
}
|
| ︙ | ︙ | |||
539 540 541 542 543 544 545 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ CONST char * | | | | | | | | 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 |
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
CONST char *
Tcl_UtfFindFirst(src, ch)
CONST char *src; /* The UTF-8 string to be searched. */
int ch; /* The Tcl_UniChar to search for. */
{
int len;
Tcl_UniChar find;
while (1) {
len = TclUtfToUniChar(src, &find);
if (find == ch) {
return src;
}
if (*src == '\0') {
return NULL;
}
src += len;
}
}
/*
*---------------------------------------------------------------------------
*
* Tcl_UtfFindLast --
|
| ︙ | ︙ | |||
579 580 581 582 583 584 585 | * Side effects: * None. * *--------------------------------------------------------------------------- */ CONST char * | | | | | | | | 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 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
CONST char *
Tcl_UtfFindLast(src, ch)
CONST char *src; /* The UTF-8 string to be searched. */
int ch; /* The Tcl_UniChar to search for. */
{
int len;
Tcl_UniChar find;
CONST char *last;
last = NULL;
while (1) {
len = TclUtfToUniChar(src, &find);
if (find == ch) {
last = src;
}
if (*src == '\0') {
break;
}
src += len;
}
return last;
}
/*
*---------------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
622 623 624 625 626 627 628 | * Side effects: * None. * *--------------------------------------------------------------------------- */ CONST char * | | | | | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
CONST char *
Tcl_UtfNext(src)
CONST char *src; /* The current location in the string. */
{
Tcl_UniChar ch;
return src + TclUtfToUniChar(src, &ch);
}
/*
*---------------------------------------------------------------------------
*
* Tcl_UtfPrev --
*
|
| ︙ | ︙ | |||
652 653 654 655 656 657 658 | * Side effects: * None. * *--------------------------------------------------------------------------- */ CONST char * | | | | | | | | | 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 693 |
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
CONST char *
Tcl_UtfPrev(src, start)
CONST char *src; /* The current location in the string. */
CONST char *start; /* Pointer to the beginning of the
* string, to avoid going backwards too
* far. */
{
CONST char *look;
int i, byte;
src--;
look = src;
for (i = 0; i < TCL_UTF_MAX; i++) {
if (look < start) {
if (src < start) {
src = start;
}
break;
}
byte = *((unsigned char *) look);
if (byte < 0x80) {
break;
}
if (byte >= 0xC0) {
return look;
}
look--;
}
return src;
}
/*
*---------------------------------------------------------------------------
*
* Tcl_UniCharAtIndex --
*
|
| ︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | } /* *---------------------------------------------------------------------- * * Tcl_UtfNcmp -- * | | | | | | | | | | | | 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 |
}
/*
*----------------------------------------------------------------------
*
* Tcl_UtfNcmp --
*
* Compare at most numChars UTF chars of string cs to string ct.
* Both cs and ct are assumed to be at least numChars UTF chars long.
*
* Results:
* Return <0 if cs < ct, 0 if cs == ct, or >0 if cs > ct.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_UtfNcmp(cs, ct, numChars)
CONST char *cs; /* UTF string to compare to ct. */
CONST char *ct; /* UTF string cs is compared to. */
unsigned long numChars; /* Number of UTF chars to compare. */
{
Tcl_UniChar ch1, ch2;
/*
* Cannot use 'memcmp(cs, ct, n);' as byte representation of
* \u0000 (the pair of bytes 0xc0,0x80) is larger than byte
* representation of \u0001 (the byte 0x01.)
*/
while (numChars-- > 0) {
/*
* n must be interpreted as chars, not bytes.
* This should be called only when both strings are of
* at least n chars long (no need for \0 check)
*/
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
return (ch1 - ch2);
}
}
return 0;
}
/*
*----------------------------------------------------------------------
*
* Tcl_UtfNcasecmp --
*
* Compare at most numChars UTF chars of string cs to string ct case
* insensitive. Both cs and ct are assumed to be at least numChars
* UTF chars long.
*
* Results:
* Return <0 if cs < ct, 0 if cs == ct, or >0 if cs > ct.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_UtfNcasecmp(cs, ct, numChars)
CONST char *cs; /* UTF string to compare to ct. */
CONST char *ct; /* UTF string cs is compared to. */
unsigned long numChars; /* Number of UTF chars to compare. */
{
Tcl_UniChar ch1, ch2;
while (numChars-- > 0) {
/*
* n must be interpreted as chars, not bytes.
* This should be called only when both strings are of
* at least n chars long (no need for \0 check)
*/
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
|
| ︙ | ︙ | |||
1208 1209 1210 1211 1212 1213 1214 | * Side effects: * None. * *---------------------------------------------------------------------- */ int | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_UniCharLen(uniStr)
CONST Tcl_UniChar *uniStr; /* Unicode string to find length of. */
{
int len = 0;
while (*uniStr != '\0') {
len++;
uniStr++;
}
return len;
}
/*
*----------------------------------------------------------------------
*
* Tcl_UniCharNcmp --
*
* Compare at most numChars unichars of string ucs to string uct.
* Both ucs and uct are assumed to be at least numChars unichars long.
*
* Results:
* Return <0 if ucs < uct, 0 if ucs == uct, or >0 if ucs > uct.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_UniCharNcmp(ucs, uct, numChars)
CONST Tcl_UniChar *ucs; /* Unicode string to compare to uct. */
CONST Tcl_UniChar *uct; /* Unicode string ucs is compared to. */
unsigned long numChars; /* Number of unichars to compare. */
{
#ifdef WORDS_BIGENDIAN
/*
* We are definitely on a big-endian machine; memcmp() is safe
*/
return memcmp(ucs, uct, numChars*sizeof(Tcl_UniChar));
#else /* !WORDS_BIGENDIAN */
/*
* We can't simply call memcmp() because that is not lexically correct.
*/
for ( ; numChars != 0; ucs++, uct++, numChars--) {
if (*ucs != *uct) {
return (*ucs - *uct);
}
}
return 0;
#endif /* WORDS_BIGENDIAN */
}
/*
*----------------------------------------------------------------------
*
* Tcl_UniCharNcasecmp --
*
* Compare at most numChars unichars of string ucs to string uct case
* insensitive. Both ucs and uct are assumed to be at least numChars
* unichars long.
*
* Results:
* Return <0 if ucs < uct, 0 if ucs == uct, or >0 if ucs > uct.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_UniCharNcasecmp(ucs, uct, numChars)
CONST Tcl_UniChar *ucs; /* Unicode string to compare to uct. */
CONST Tcl_UniChar *uct; /* Unicode string ucs is compared to. */
unsigned long numChars; /* Number of unichars to compare. */
{
for ( ; numChars != 0; numChars--, ucs++, uct++) {
if (*ucs != *uct) {
Tcl_UniChar lcs = Tcl_UniCharToLower(*ucs);
Tcl_UniChar lct = Tcl_UniCharToLower(*uct);
if (lcs != lct) {
return (lcs - lct);
}
}
}
return 0;
}
|
| ︙ | ︙ | |||
1598 1599 1600 1601 1602 1603 1604 | * Side effects: * None. * *---------------------------------------------------------------------- */ int | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 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 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 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_UniCharCaseMatch(uniStr, uniPattern, nocase)
CONST Tcl_UniChar *uniStr; /* Unicode String. */
CONST Tcl_UniChar *uniPattern; /* Pattern, which may contain special
* characters. */
int nocase; /* 0 for case sensitive, 1 for insensitive */
{
Tcl_UniChar ch1, p;
while (1) {
p = *uniPattern;
/*
* See if we're at the end of both the pattern and the string. If
* so, we succeeded. If we're at the end of the pattern but not at
* the end of the string, we failed.
*/
if (p == 0) {
return (*uniStr == 0);
}
if ((*uniStr == 0) && (p != '*')) {
return 0;
}
/*
* Check for a "*" as the next pattern character. It matches any
* substring. We handle this by skipping all the characters up to the
* next matching one in the pattern, and then calling ourselves
* recursively for each postfix of string, until either we match or we
* reach the end of the string.
*/
if (p == '*') {
/*
* Skip all successive *'s in the pattern
*/
while (*(++uniPattern) == '*') {}
p = *uniPattern;
if (p == 0) {
return 1;
}
if (nocase) {
p = Tcl_UniCharToLower(p);
}
while (1) {
/*
* Optimization for matching - cruise through the string
* quickly if the next char in the pattern isn't a special
* character
*/
if ((p != '[') && (p != '?') && (p != '\\')) {
if (nocase) {
while (*uniStr && (p != *uniStr)
&& (p != Tcl_UniCharToLower(*uniStr))) {
uniStr++;
}
} else {
while (*uniStr && (p != *uniStr)) { uniStr++; }
}
}
if (Tcl_UniCharCaseMatch(uniStr, uniPattern, nocase)) {
return 1;
}
if (*uniStr == 0) {
return 0;
}
uniStr++;
}
}
/*
* Check for a "?" as the next pattern character. It matches
* any single character.
*/
if (p == '?') {
uniPattern++;
uniStr++;
continue;
}
/*
* Check for a "[" as the next pattern character. It is followed
* by a list of characters that are acceptable, or by a range
* (two characters separated by "-").
*/
if (p == '[') {
Tcl_UniChar startChar, endChar;
uniPattern++;
ch1 = (nocase ? Tcl_UniCharToLower(*uniStr) : *uniStr);
uniStr++;
while (1) {
if ((*uniPattern == ']') || (*uniPattern == 0)) {
return 0;
}
startChar = (nocase ? Tcl_UniCharToLower(*uniPattern) : *uniPattern);
uniPattern++;
if (*uniPattern == '-') {
uniPattern++;
if (*uniPattern == 0) {
return 0;
}
endChar = (nocase ? Tcl_UniCharToLower(*uniPattern)
: *uniPattern);
uniPattern++;
if (((startChar <= ch1) && (ch1 <= endChar))
|| ((endChar <= ch1) && (ch1 <= startChar))) {
/*
* Matches ranges of form [a-z] or [z-a].
*/
break;
}
} else if (startChar == ch1) {
break;
}
}
while (*uniPattern != ']') {
if (*uniPattern == 0) {
uniPattern--;
break;
}
uniPattern++;
}
uniPattern++;
continue;
}
/*
* If the next pattern character is '\', just strip off the '\'
* so we do exact matching on the character that follows.
*/
if (p == '\\') {
if (*(++uniPattern) == '\0') {
return 0;
}
}
/*
* There's no special character. Just make sure that the next
* bytes of each string match.
*/
if (nocase) {
if (Tcl_UniCharToLower(*uniStr) != Tcl_UniCharToLower(*uniPattern)) {
return 0;
}
} else if (*uniStr != *uniPattern) {
return 0;
}
uniStr++;
uniPattern++;
}
}
/*
*----------------------------------------------------------------------
*
* TclUniCharMatch --
|
| ︙ | ︙ |
Changes to generic/tclUtil.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclUtil.c -- * * This file contains utility procedures that are used by many Tcl * commands. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
/*
* tclUtil.c --
*
* This file contains utility procedures that are used by many Tcl
* commands.
*
* Copyright (c) 1987-1993 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclUtil.c,v 1.53.2.1 2005/06/13 01:46:18 msofer Exp $
*/
#include "tclInt.h"
#include <float.h>
#include <math.h>
/*
* Define test for NaN
*/
#ifdef _MSC_VER
#define IS_NAN(f) (_isnan((f)))
#else
#define IS_NAN(f) ((f) != (f))
#endif
/*
* Define test for Inf
*/
#ifdef _MSC_VER
#define IS_INF(f) ( ! (_finite((f))))
#else
#define IS_INF(f) ( (f) > DBL_MAX || (f) < -DBL_MAX )
#endif
/*
* The absolute pathname of the executable in which this Tcl library
* is running.
*/
static ProcessGlobalValue executableName = {0, 0, NULL, NULL, NULL, NULL, NULL};
|
| ︙ | ︙ | |||
52 53 54 55 56 57 58 | /* * The following values determine the precision used when converting * floating-point values to strings. This information is linked to all * of the tcl_precision variables in all interpreters via the procedure * TclPrecTraceProc. */ | | < | | < < | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | /* * The following values determine the precision used when converting * floating-point values to strings. This information is linked to all * of the tcl_precision variables in all interpreters via the procedure * TclPrecTraceProc. */ static int precision = 0; /* Precision of floating point conversions, * in the range 0-17 inclusive. */ TCL_DECLARE_MUTEX(precisionMutex) /* * Prototypes for procedures defined later in this file. */ static void ClearHash _ANSI_ARGS_((Tcl_HashTable *tablePtr)); |
| ︙ | ︙ | |||
1173 1174 1175 1176 1177 1178 1179 | * Side effects: * None. * *---------------------------------------------------------------------- */ int | | | | | 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_StringMatch(str, pattern)
CONST char *str; /* String. */
CONST char *pattern; /* Pattern, which may contain special
* characters. */
{
return Tcl_StringCaseMatch(str, pattern, 0);
}
/*
*----------------------------------------------------------------------
*
* Tcl_StringCaseMatch --
*
|
| ︙ | ︙ | |||
1202 1203 1204 1205 1206 1207 1208 | * Side effects: * None. * *---------------------------------------------------------------------- */ int | | | | | | 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 |
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
Tcl_StringCaseMatch(str, pattern, nocase)
CONST char *str; /* String. */
CONST char *pattern; /* Pattern, which may contain special
* characters. */
int nocase; /* 0 for case sensitive, 1 for insensitive */
{
int p, charLen;
CONST char *pstart = pattern;
Tcl_UniChar ch1, ch2;
while (1) {
p = *pattern;
/*
* See if we're at the end of both the pattern and the string. If
* so, we succeeded. If we're at the end of the pattern but not at
* the end of the string, we failed.
*/
if (p == '\0') {
return (*str == '\0');
}
if ((*str == '\0') && (p != '*')) {
return 0;
}
/*
* Check for a "*" as the next pattern character. It matches
* any substring. We handle this by calling ourselves
* recursively for each postfix of string, until either we
|
| ︙ | ︙ | |||
1264 1265 1266 1267 1268 1269 1270 |
/*
* Optimization for matching - cruise through the string
* quickly if the next char in the pattern isn't a special
* character
*/
if ((p != '[') && (p != '?') && (p != '\\')) {
if (nocase) {
| | | | | | | | | | | | | | | | 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 |
/*
* Optimization for matching - cruise through the string
* quickly if the next char in the pattern isn't a special
* character
*/
if ((p != '[') && (p != '?') && (p != '\\')) {
if (nocase) {
while (*str) {
charLen = TclUtfToUniChar(str, &ch1);
if (ch2==ch1 || ch2==Tcl_UniCharToLower(ch1)) {
break;
}
str += charLen;
}
} else {
/*
* There's no point in trying to make this code
* shorter, as the number of bytes you want to
* compare each time is non-constant.
*/
while (*str) {
charLen = TclUtfToUniChar(str, &ch1);
if (ch2 == ch1) {
break;
}
str += charLen;
}
}
}
if (Tcl_StringCaseMatch(str, pattern, nocase)) {
return 1;
}
if (*str == '\0') {
return 0;
}
str += TclUtfToUniChar(str, &ch1);
}
}
/*
* Check for a "?" as the next pattern character. It matches
* any single character.
*/
if (p == '?') {
pattern++;
str += TclUtfToUniChar(str, &ch1);
continue;
}
/*
* Check for a "[" as the next pattern character. It is followed
* by a list of characters that are acceptable, or by a range
* (two characters separated by "-").
*/
if (p == '[') {
Tcl_UniChar startChar, endChar;
pattern++;
if (UCHAR(*str) < 0x80) {
ch1 = (Tcl_UniChar)
(nocase ? tolower(UCHAR(*str)) : UCHAR(*str));
str++;
} else {
str += Tcl_UtfToUniChar(str, &ch1);
if (nocase) {
ch1 = Tcl_UniCharToLower(ch1);
}
}
while (1) {
if ((*pattern == ']') || (*pattern == '\0')) {
return 0;
|
| ︙ | ︙ | |||
1397 1398 1399 1400 1401 1402 1403 | } /* * There's no special character. Just make sure that the next * bytes of each string match. */ | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 |
}
/*
* There's no special character. Just make sure that the next
* bytes of each string match.
*/
str += TclUtfToUniChar(str, &ch1);
pattern += TclUtfToUniChar(pattern, &ch2);
if (nocase) {
if (Tcl_UniCharToLower(ch1) != Tcl_UniCharToLower(ch2)) {
return 0;
}
} else if (ch1 != ch2) {
return 0;
}
}
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
1479 1480 1481 1482 1483 1484 1485 | } /* *---------------------------------------------------------------------- * * Tcl_DStringAppend -- * | | | | | | | | | 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 |
}
/*
*----------------------------------------------------------------------
*
* Tcl_DStringAppend --
*
* Append more bytes to the current value of a dynamic string.
*
* Results:
* The return value is a pointer to the dynamic string's new value.
*
* Side effects:
* Length bytes from "bytes" (or all of "bytes" if length is less
* than zero) are added to the current value of the string. Memory
* gets reallocated if needed to accomodate the string's new size.
*
*----------------------------------------------------------------------
*/
char *
Tcl_DStringAppend(dsPtr, bytes, length)
Tcl_DString *dsPtr; /* Structure describing dynamic string. */
CONST char *bytes; /* String to append. If length is -1 then
* this must be null-terminated. */
int length; /* Number of bytes from "bytes" to
* append. If < 0, then append all of bytes,
* up to null at end. */
{
int newSize;
char *dst;
CONST char *end;
if (length < 0) {
length = strlen(bytes);
}
newSize = length + dsPtr->length;
/*
* Allocate a larger buffer for the string if the current one isn't
* large enough. Allocate extra space in the new buffer so that there
* will be room to grow before we have to allocate again.
|
| ︙ | ︙ | |||
1536 1537 1538 1539 1540 1541 1542 |
}
/*
* Copy the new string into the buffer at the end of the old
* one.
*/
| | | | | 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 |
}
/*
* Copy the new string into the buffer at the end of the old
* one.
*/
for (dst = dsPtr->string + dsPtr->length, end = bytes+length;
bytes < end; bytes++, dst++) {
*dst = *bytes;
}
*dst = '\0';
dsPtr->length += length;
return dsPtr->string;
}
/*
|
| ︙ | ︙ | |||
1564 1565 1566 1567 1568 1569 1570 | * value of the string. Memory gets reallocated if needed to * accomodate the string's new size. * *---------------------------------------------------------------------- */ char * | | | | | | 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 |
* value of the string. Memory gets reallocated if needed to
* accomodate the string's new size.
*
*----------------------------------------------------------------------
*/
char *
Tcl_DStringAppendElement(dsPtr, element)
Tcl_DString *dsPtr; /* Structure describing dynamic string. */
CONST char *element; /* String to append. Must be
* null-terminated. */
{
int newSize, flags, strSize;
char *dst;
strSize = ((element== NULL) ? 0 : strlen(element));
newSize = Tcl_ScanCountedElement(element, strSize, &flags)
+ dsPtr->length + 1;
/*
* Allocate a larger buffer for the string if the current one isn't
* large enough. Allocate extra space in the new buffer so that there
* will be room to grow before we have to allocate again.
* SPECIAL NOTE: must use memcpy, not strcpy, to copy the string
|
| ︙ | ︙ | |||
1617 1618 1619 1620 1621 1622 1623 |
/*
* 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;
}
| | | 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 |
/*
* 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;
}
dsPtr->length += Tcl_ConvertCountedElement(element, strSize, dst, flags);
return dsPtr->string;
}
/*
*----------------------------------------------------------------------
*
* Tcl_DStringSetLength --
|
| ︙ | ︙ | |||
1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 |
* printing. It's ignored now. */
double value; /* Value to print as string. */
char *dst; /* Where to store converted value;
* must have at least TCL_DOUBLE_SPACE
* characters. */
{
char *p, c;
Tcl_UniChar ch;
Tcl_MutexLock(&precisionMutex);
| > > > > | | | | | > | > | > > > > | > > > > > | < < > | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > | 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 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 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 |
* printing. It's ignored now. */
double value; /* Value to print as string. */
char *dst; /* Where to store converted value;
* must have at least TCL_DOUBLE_SPACE
* characters. */
{
char *p, c;
int prec;
int exp;
int signum;
char buffer[TCL_DOUBLE_SPACE];
Tcl_UniChar ch;
Tcl_MutexLock(&precisionMutex);
prec = precision;
Tcl_MutexUnlock(&precisionMutex);
/*
* If prec == 0, then use TclDoubleDigits to develop a decimal
* significand and exponent, then format it in E or F format as
* appropriate. If prec != 0, use the native sprintf and then
* add a trailing ".0" if there is no decimal point in the rep.
*/
if ( prec == 0 ) {
/* Handle NaN */
if ( IS_NAN( value ) ) {
TclFormatNaN( value, dst );
return;
}
/* Handle infinities */
if ( IS_INF( value ) ) {
if ( value < 0 ) {
strcpy( dst, "-Inf" );
} else {
strcpy( dst, "Inf" );
}
return;
}
/* Ordinary (normal and denormal) values */
exp = TclDoubleDigits( buffer, value, &signum );
if ( signum ) {
*dst++ = '-';
}
prec = strlen( buffer );
p = buffer;
if ( exp < -3 || exp > 17 ) {
/* E format for numbers < 1e-3 or >= 1e17 */
*dst++ = *p++;
c = *p;
if ( c != '\0' ) {
*dst++ = '.';
while ( c != '\0' ) {
*dst++ = c;
c = *++p;
}
}
sprintf( dst, "e%+d", exp-1 );
} else {
/* F format for others */
if ( exp <= 0 ) {
*dst++ = '0';
}
c = *p;
while ( exp-- > 0 ) {
if ( c != '\0' ) {
*dst++ = c;
c = *++p;
} else {
*dst++ = '0';
}
}
*dst++ = '.';
if ( c == '\0' ) {
*dst++ = '0';
} else {
while ( ++exp < 0 ) {
*dst++ = '0';
}
while ( c != '\0' ) {
*dst++ = c;
c = *++p;
}
}
*dst++ = '\0';
}
} else {
/* tcl_precision is supplied, pass it to the native sprintf */
sprintf( dst, "%.*g", prec, value );
/*
* If the ASCII result looks like an integer, add ".0" so that it
* doesn't look like an integer anymore. This prevents floating-point
* values from being converted to integers unintentionally.
* Check for ASCII specifically to speed up the function.
*/
for (p = dst; *p != 0; ) {
if (UCHAR(*p) < 0x80) {
c = *p++;
} else {
p += Tcl_UtfToUniChar(p, &ch);
c = UCHAR(ch);
}
if ((c == '.') || isalpha(UCHAR(c))) { /* INTL: ISO only. */
return;
}
}
p[0] = '.';
p[1] = '0';
p[2] = 0;
}
}
/*
*----------------------------------------------------------------------
*
* TclPrecTraceProc --
*
|
| ︙ | ︙ | |||
1970 1971 1972 1973 1974 1975 1976 |
TclPrecTraceProc(clientData, interp, name1, name2, flags)
ClientData clientData; /* Not used. */
Tcl_Interp *interp; /* Interpreter containing variable. */
CONST char *name1; /* Name of variable. */
CONST char *name2; /* Second part of variable name. */
int flags; /* Information about what happened. */
{
| | < | 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 |
TclPrecTraceProc(clientData, interp, name1, name2, flags)
ClientData clientData; /* Not used. */
Tcl_Interp *interp; /* Interpreter containing variable. */
CONST char *name1; /* Name of variable. */
CONST char *name2; /* Second part of variable name. */
int flags; /* Information about what happened. */
{
Tcl_Obj* value;
int prec;
/*
* If the variable is unset, then recreate the trace.
*/
if (flags & TCL_TRACE_UNSETS) {
|
| ︙ | ︙ | |||
1994 1995 1996 1997 1998 1999 2000 |
/*
* When the variable is read, reset its value from our shared
* value. This is needed in case the variable was modified in
* some other interpreter so that this interpreter's value is
* out of date.
*/
| < > | | > | | | | | < | | < < < < | | | 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 |
/*
* When the variable is read, reset its value from our shared
* value. This is needed in case the variable was modified in
* some other interpreter so that this interpreter's value is
* out of date.
*/
if (flags & TCL_TRACE_READS) {
Tcl_MutexLock(&precisionMutex);
Tcl_SetVar2Ex( interp, name1, name2, Tcl_NewIntObj( precision ),
flags & TCL_GLOBAL_ONLY );
Tcl_MutexUnlock(&precisionMutex);
return (char *) NULL;
}
/*
* The variable is being written. Check the new value and disallow
* it if it isn't reasonable or if this is a safe interpreter (we
* don't want safe interpreters messing up the precision of other
* interpreters).
*/
if (Tcl_IsSafe(interp)) {
Tcl_MutexLock(&precisionMutex);
Tcl_SetVar2Ex( interp, name1, name2, Tcl_NewIntObj( precision ),
flags & TCL_GLOBAL_ONLY );
Tcl_MutexUnlock(&precisionMutex);
return "can't modify precision from a safe interpreter";
}
value = Tcl_GetVar2Ex(interp, name1, name2, flags & TCL_GLOBAL_ONLY);
if ( value == NULL
|| Tcl_GetIntFromObj( (Tcl_Interp*) NULL, value, &prec ) != TCL_OK
|| prec < 0
|| prec > TCL_MAX_PREC ) {
return "improper value for precision";
}
Tcl_MutexLock( &precisionMutex );
precision = prec;
Tcl_MutexUnlock(&precisionMutex);
return (char *) NULL;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
2265 2266 2267 2268 2269 2270 2271 | /* *---------------------------------------------------------------------- * * TclGetIntForIndex -- * * This procedure returns an integer corresponding to the list index * held in a Tcl object. The Tcl object's value is expected to be | | | < | | 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 | /* *---------------------------------------------------------------------- * * TclGetIntForIndex -- * * This procedure returns an integer corresponding to the list index * held in a Tcl object. The Tcl object's value is expected to be * in the format integer([+-]integer)? or the format end([+-]integer)?. * * Results: * The return value is normally TCL_OK, which means that the index was * successfully stored into the location referenced by "indexPtr". If * the Tcl object referenced by "objPtr" has the value "end", the * value stored is "endValue". If "objPtr"s values is not of one * of the expected formats, TCL_ERROR is returned and, if * "interp" is non-NULL, an error message is left in the interpreter's * result object. * * Side effects: * The object referenced by "objPtr" might be converted to an * integer, wide integer, or end-based-index object. * |
| ︙ | ︙ | |||
2296 2297 2298 2299 2300 2301 2302 |
Tcl_Obj *objPtr; /* Points to an object containing either
* "end" or an integer. */
int endValue; /* The value to be stored at "indexPtr" if
* "objPtr" holds "end". */
int *indexPtr; /* Location filled in with an integer
* representing an index. */
{
| < < < | < < < < < < < < < < < < < < < < < < < | > > | | > | < | > > > > > > | | < < < > > > | < > > > > | | > > > | > | | > > | > > > > > > | > | | 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 |
Tcl_Obj *objPtr; /* Points to an object containing either
* "end" or an integer. */
int endValue; /* The value to be stored at "indexPtr" if
* "objPtr" holds "end". */
int *indexPtr; /* Location filled in with an integer
* representing an index. */
{
if (Tcl_GetIntFromObj(NULL, objPtr, indexPtr) == TCL_OK) {
return TCL_OK;
}
if (SetEndOffsetFromAny(NULL, objPtr) == TCL_OK) {
/*
* If the object is already an offset from the end of the
* list, or can be converted to one, use it.
*/
*indexPtr = endValue + objPtr->internalRep.longValue;
} else {
int opIdx, length;
char *bytes = Tcl_GetStringFromObj(objPtr, &length);
char *p = bytes;
while (length && isspace(UCHAR(*p))) { /* INTL: ISO space. */
length--; p++;
}
if (length == 0) {
goto parseError;
}
if ((*p == '+') || (*p == '-')) {
p++; length--;
}
opIdx = TclParseInteger(p, length) + (int) (p-bytes);
if (opIdx) {
int code, first, second;
char savedOp = bytes[opIdx];
if ((savedOp != '+') && (savedOp != '-')) {
goto parseError;
}
if (isspace(UCHAR(bytes[opIdx+1]))) {
goto parseError;
}
bytes[opIdx] = '\0';
code = Tcl_GetInt(interp, bytes, &first);
bytes[opIdx] = savedOp;
if (code == TCL_ERROR) {
goto parseError;
}
if (TCL_ERROR == Tcl_GetInt(interp, bytes+opIdx+1, &second)) {
goto parseError;
}
if (savedOp == '+') {
*indexPtr = first + second;
} else {
*indexPtr = first - second;
}
return TCL_OK;
}
/*
* Report a parse error.
*/
parseError:
if (interp != NULL) {
char *bytes = Tcl_GetString(objPtr);
/*
* The result might not be empty; this resets it which
* should be both a cheap operation, and of little problem
* because this is an error-generation path anyway.
*/
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad index \"", bytes,
"\": must be integer?[+-]integer? or end?[+-]integer?",
(char *) NULL);
if (!strncmp(bytes, "end-", 3)) {
bytes += 3;
}
TclCheckBadOctal(interp, bytes);
}
return TCL_ERROR;
|
| ︙ | ︙ | |||
2419 2420 2421 2422 2423 2424 2425 | } /* *---------------------------------------------------------------------- * * SetEndOffsetFromAny -- * | | | 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 | } /* *---------------------------------------------------------------------- * * SetEndOffsetFromAny -- * * Look for a string of the form "end[+-]offset" and convert it * to an internal representation holding the offset. * * Results: * Returns TCL_OK if ok, TCL_ERROR if the string was badly formed. * * Side effects: * If interp is not NULL, stores an error message in the |
| ︙ | ︙ | |||
2455 2456 2457 2458 2459 2460 2461 |
bytes = Tcl_GetStringFromObj(objPtr, &length);
if ((*bytes != 'e') || (strncmp(bytes, "end",
(size_t)((length > 3) ? 3 : length)) != 0)) {
if (interp != NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad index \"", bytes,
| | | > > > > | > | | 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 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 |
bytes = Tcl_GetStringFromObj(objPtr, &length);
if ((*bytes != 'e') || (strncmp(bytes, "end",
(size_t)((length > 3) ? 3 : length)) != 0)) {
if (interp != NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad index \"", bytes,
"\": must be end?[+-]integer?", (char*) NULL);
}
return TCL_ERROR;
}
/* Convert the string rep */
if (length <= 3) {
offset = 0;
} else if ((length > 4) && ((bytes[3] == '-') || (bytes[3] == '+'))) {
/*
* This is our limited string expression evaluator. Pass everything
* after "end-" to Tcl_GetInt, then reverse for offset.
*/
if (isspace(UCHAR(bytes[4]))) {
return TCL_ERROR;
}
if (Tcl_GetInt(interp, bytes+4, &offset) != TCL_OK) {
return TCL_ERROR;
}
if (bytes[3] == '-') {
offset = -offset;
}
} else {
/*
* Conversion failed. Report the error.
*/
if (interp != NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad index \"", bytes,
"\": must be end?[+-]integer?", (char *) NULL);
}
return TCL_ERROR;
}
/*
* The conversion succeeded. Free the old internal rep and set
* the new one.
|
| ︙ | ︙ | |||
2781 2782 2783 2784 2785 2786 2787 | /* No cache for the current epoch - must be a new one */ /* First, clear the cacheMap, as anything in it must * refer to some expired epoch.*/ ClearHash(cacheMap); /* If no thread has set the shared value, call the initializer */ Tcl_MutexLock(&pgvPtr->mutex); | | < | | | < | > > | 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 |
/* No cache for the current epoch - must be a new one */
/* First, clear the cacheMap, as anything in it must
* refer to some expired epoch.*/
ClearHash(cacheMap);
/* If no thread has set the shared value, call the initializer */
Tcl_MutexLock(&pgvPtr->mutex);
if ((NULL == pgvPtr->value) && (pgvPtr->proc)) {
pgvPtr->epoch++;
(*(pgvPtr->proc))(&pgvPtr->value, &pgvPtr->numBytes,
&pgvPtr->encoding);
if (pgvPtr->value == NULL) {
Tcl_Panic("PGV Initializer did not initialize.");
}
Tcl_CreateExitHandler(FreeProcessGlobalValue, (ClientData) pgvPtr);
}
/* Store a copy of the shared value in our epoch-indexed cache */
value = Tcl_NewStringObj(pgvPtr->value, pgvPtr->numBytes);
hPtr = Tcl_CreateHashEntry(cacheMap, (char *)pgvPtr->epoch, &dummy);
Tcl_MutexUnlock(&pgvPtr->mutex);
Tcl_SetHashValue(hPtr, (ClientData) value);
|
| ︙ | ︙ | |||
2914 2915 2916 2917 2918 2919 2920 |
void
TclpGetTime(timePtr)
Tcl_Time* timePtr;
{
Tcl_GetTime(timePtr);
}
| > > > > > > > > > > > > > > > > > > > > > > > | 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 |
void
TclpGetTime(timePtr)
Tcl_Time* timePtr;
{
Tcl_GetTime(timePtr);
}
/*
*----------------------------------------------------------------------
*
* TclGetPlatform --
*
* This is a kludge that allows the test library to get access
* the internal tclPlatform variable.
*
* Results:
* Returns a pointer to the tclPlatform variable.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
TclPlatformType *
TclGetPlatform()
{
return &tclPlatform;
}
|
Changes to generic/tclVar.c.
| ︙ | ︙ | |||
11 12 13 14 15 16 17 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclVar.c,v 1.101.2.11 2005/06/13 01:46:19 msofer Exp $ */ #include "tclInt.h" /* * The strings below are used to indicate what went wrong when a * variable access is denied. |
| ︙ | ︙ | |||
90 91 92 93 94 95 96 | * twoPtrValue.ptr1 = pointer to the array name Tcl_Obj, * or NULL if it is a scalar variable * twoPtrValue.ptr2 = pointer to the element name string * (owned by this Tcl_Obj), or NULL if * it is a scalar variable */ | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
* twoPtrValue.ptr1 = pointer to the array name Tcl_Obj,
* or NULL if it is a scalar variable
* twoPtrValue.ptr2 = pointer to the element name string
* (owned by this Tcl_Obj), or NULL if
* it is a scalar variable
*/
static Tcl_ObjType localVarNameType = {
"localVarName",
NULL, DupLocalVarName, PanicOnUpdateVarName, PanicOnSetVarName
};
/*
* Caching of namespace variables disabled: no simple way was found to
* avoid interfering with the resolver's idea of variable existence.
|
| ︙ | ︙ | |||
154 155 156 157 158 159 160 | * Results: * The return value is a pointer to the variable structure indicated by * part1 and part2, or NULL if the variable couldn't be found. If the * variable is found, *arrayPtrPtr is filled in with the address of the * variable structure for the array that contains the variable (or NULL * if the variable is a scalar). If the variable can't be found and * either createPart1 or createPart2 are 1, a new as-yet-undefined | | | | | | 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 | * Results: * The return value is a pointer to the variable structure indicated by * part1 and part2, or NULL if the variable couldn't be found. If the * variable is found, *arrayPtrPtr is filled in with the address of the * variable structure for the array that contains the variable (or NULL * if the variable is a scalar). If the variable can't be found and * either createPart1 or createPart2 are 1, a new as-yet-undefined * variable structure is created, entered into a hash table, and * returned. * * If the variable isn't found and creation wasn't specified, or some * other error occurs, NULL is returned and an error message is left in * the interp's result if TCL_LEAVE_ERR_MSG is set in flags. * * Note: it's possible for the variable returned to be undefined * even if createPart1 or createPart2 are 1 (these only cause the hash * table entry or array to be created). For example, the variable might * be a global that has been unset but is still referenced by a * procedure, or a variable that has been unset but it only being kept * in existence by a trace. * * Side effects: * New hashtable entries may be created if createPart1 or createPart2 * are 1. * *---------------------------------------------------------------------- */ |
| ︙ | ︙ | |||
303 304 305 306 307 308 309 | * Results: * The return value is a pointer to the variable structure indicated by * part1Ptr and part2, or NULL if the variable couldn't be found. If * the variable is found, *arrayPtrPtr is filled with the address of the * variable structure for the array that contains the variable (or NULL * if the variable is a scalar). If the variable can't be found and * either createPart1 or createPart2 are 1, a new as-yet-undefined | | | | | | | 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 | * Results: * The return value is a pointer to the variable structure indicated by * part1Ptr and part2, or NULL if the variable couldn't be found. If * the variable is found, *arrayPtrPtr is filled with the address of the * variable structure for the array that contains the variable (or NULL * if the variable is a scalar). If the variable can't be found and * either createPart1 or createPart2 are 1, a new as-yet-undefined * variable structure is created, entered into a hash table, and * returned. * * If the variable isn't found and creation wasn't specified, or some * other error occurs, NULL is returned and an error message is left in * the interp's result if TCL_LEAVE_ERR_MSG is set in flags. * * Note: it's possible for the variable returned to be undefined * even if createPart1 or createPart2 are 1 (these only cause the hash * table entry or array to be created). For example, the variable might * be a global that has been unset but is still referenced by a * procedure, or a variable that has been unset but it only being kept * in existence by a trace. * * Side effects: * New hashtable entries may be created if createPart1 or createPart2 * are 1. * The object part1Ptr is converted to one of localVarNameType, * tclNsVarNameType or tclParsedVarNameType and caches as much of the * lookup as it can. * *---------------------------------------------------------------------- */ Var * TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, |
| ︙ | ︙ | |||
396 397 398 399 400 401 402 |
part1 = Tcl_GetStringFromObj(part1Ptr, &len1);
nsPtr = ((varFramePtr == NULL)? iPtr->globalNsPtr : varFramePtr->nsPtr);
if (nsPtr->varResProc != NULL || iPtr->resolverPtr != NULL) {
goto doParse;
}
| | > | | | > | > | | 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 |
part1 = Tcl_GetStringFromObj(part1Ptr, &len1);
nsPtr = ((varFramePtr == NULL)? iPtr->globalNsPtr : varFramePtr->nsPtr);
if (nsPtr->varResProc != NULL || iPtr->resolverPtr != NULL) {
goto doParse;
}
if (typePtr == &localVarNameType) {
int localIndex = (int) part1Ptr->internalRep.longValue;
char *varName;
if ((varFramePtr != NULL)
&& (varFramePtr->isProcCallFrame & FRAME_IS_PROC)
&& !(flags & (TCL_GLOBAL_ONLY | TCL_NAMESPACE_ONLY))
&& (localIndex < varFramePtr->numCompiledLocals)) {
/*
* use the cached index if the names coincide.
*/
varPtr = (Var *) &(varFramePtr->compiledLocals[localIndex]);
varName = localIndex + ((char *) (varFramePtr->compiledLocals
+ varFramePtr->numCompiledLocals));
if (varName && (varName[0] == part1[0])
&& !strcmp(part1, varName)) {
goto donePart1;
}
}
goto doneParsing;
#if ENABLE_NS_VARNAME_CACHING
} else if (typePtr == &tclNsVarNameType) {
Namespace *cachedNsPtr;
|
| ︙ | ︙ | |||
435 436 437 438 439 440 441 | && ((flags & TCL_NAMESPACE_ONLY) || (varFramePtr && !(varFramePtr->isProcCallFrame & FRAME_IS_PROC) && !(flags & TCL_GLOBAL_ONLY) /* careful: an undefined ns variable could * be hiding a valid global reference. */ && !TclIsVarUndefined(varPtr)))); | | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
&& ((flags & TCL_NAMESPACE_ONLY)
|| (varFramePtr
&& !(varFramePtr->isProcCallFrame & FRAME_IS_PROC)
&& !(flags & TCL_GLOBAL_ONLY)
/* careful: an undefined ns variable could
* be hiding a valid global reference. */
&& !TclIsVarUndefined(varPtr))));
if (useReference && (varPtr->id.hPtr != NULL)) {
/*
* A straight global or namespace reference, use it. It isn't
* so simple to deal with 'implicit' namespace references, i.e.,
* those where the reference could be to either a namespace
* or a global variable. Those we lookup again.
*
* If (varPtr->id.hPtr == NULL), this might be a reference to a
* variable in a deleted namespace, kept alive by e.g. part1Ptr.
* We could conceivably be so unlucky that a new namespace was
* created at the same address as the deleted one, so to be
* safe we test for a valid hPtr.
*/
goto donePart1;
}
|
| ︙ | ︙ | |||
500 501 502 503 504 505 506 | /* * Define a new string object to hold the new part1Ptr, i.e., * the array name. Set the internal rep of objPtr, reset * typePtr and part1 to contain the references to the * array name. */ | | | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | /* * Define a new string object to hold the new part1Ptr, i.e., * the array name. Set the internal rep of objPtr, reset * typePtr and part1 to contain the references to the * array name. */ TclNewStringObj(part1Ptr, part1, len1); Tcl_IncrRefCount(part1Ptr); objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) part1Ptr; objPtr->internalRep.twoPtrValue.ptr2 = (VOID *) part2; typePtr = part1Ptr->typePtr; part1 = TclGetString(part1Ptr); |
| ︙ | ︙ | |||
540 541 542 543 544 545 546 |
*/
if (index >= 0) {
/*
* An indexed local variable.
*/
| | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
*/
if (index >= 0) {
/*
* An indexed local variable.
*/
part1Ptr->typePtr = &localVarNameType;
part1Ptr->internalRep.longValue = (long) index;
#if ENABLE_NS_VARNAME_CACHING
} else if (index > -3) {
/*
* A cacheable namespace or global variable.
*/
Namespace *nsPtr;
|
| ︙ | ︙ | |||
617 618 619 620 621 622 623 | * * This procedure is used by to locate a simple variable (i.e., not * an array element) given its name. * * Results: * The return value is a pointer to the variable structure indicated by * varName, or NULL if the variable couldn't be found. If the variable | | | | | < | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | * * This procedure is used by to locate a simple variable (i.e., not * an array element) given its name. * * Results: * The return value is a pointer to the variable structure indicated by * varName, or NULL if the variable couldn't be found. If the variable * can't be found and create is 1, a new as-yet-undefined variable * structure is created, entered into a hash table, and returned. * * If the current CallFrame corresponds to a proc and the variable found is * one of the compiledLocals, its index is placed in *indexPtr. Otherwise, * *indexPtr will be set to (according to the needs of TclObjLookupVar): * -1 a global reference * -2 a reference to a namespace variable * -3 a non-cachable reference, i.e., one of: * . non-indexed local var * . a reference of unknown origin; * . resolution by a namespace or interp resolver * * If the variable isn't found and creation wasn't specified, or some * other error occurs, NULL is returned and the corresponding error * message is left in *errMsgPtr. * * Note: it's possible for the variable returned to be undefined * even if create is 1 (this only causes the hash table entry to be * created). For example, the variable might be a global that has been * unset but is still referenced by a procedure, or a variable that has * been unset but it only being kept in existence by a trace. * * Side effects: * A new hashtable entry may be created if create is 1. * *---------------------------------------------------------------------- */ |
| ︙ | ︙ | |||
783 784 785 786 787 788 789 |
*errMsgPtr = badNamespace;
return NULL;
}
if (tail == NULL) {
*errMsgPtr = missingName;
return NULL;
}
| | > | < | > < | | > | < | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
*errMsgPtr = badNamespace;
return NULL;
}
if (tail == NULL) {
*errMsgPtr = missingName;
return NULL;
}
hPtr = Tcl_CreateHashEntry((Tcl_HashTable *)&varNsPtr->varTable,
tail, &new);
varPtr = NewVar();
Tcl_SetHashValue(hPtr, varPtr);
varPtr->id.hPtr = hPtr;
if (lookGlobal) {
/*
* The variable was created starting from the global
* namespace: a global reference is returned even if
* it wasn't explicitly requested.
*/
*indexPtr = -1;
} else {
*indexPtr = -2;
}
} else { /* var wasn't found and not to create it */
*errMsgPtr = noSuchVar;
return NULL;
}
}
} else { /* local var: look in frame varFramePtr */
Proc *procPtr = varFramePtr->procPtr;
int localCt = procPtr->numCompiledLocals;
CompiledLocal *localPtr = procPtr->firstLocalPtr;
ShortVar *localVarPtr = varFramePtr->compiledLocals;
int varNameLen = strlen(varName);
for (i = 0; i < localCt; i++) {
register char *localName = localPtr->name;
if (!TclIsVarTemporary(localPtr)) {
if ((varName[0] == localName[0])
&& (varNameLen == localPtr->nameLength)
&& (strcmp(varName, localName) == 0)) {
*indexPtr = i;
return (Var *) localVarPtr;
}
}
localVarPtr++;
localPtr = localPtr->nextPtr;
}
tablePtr = varFramePtr->varTablePtr;
if (create) {
if (tablePtr == NULL) {
tablePtr = (Tcl_HashTable *)
ckalloc(sizeof(TclNSVarHashTable));
((TclNSVarHashTable *)tablePtr)->nsPtr = NULL;
Tcl_InitHashTable(tablePtr, TCL_STRING_KEYS);
varFramePtr->varTablePtr = tablePtr;
}
hPtr = Tcl_CreateHashEntry(tablePtr, varName, &new);
if (new) {
varPtr = NewVar();
Tcl_SetHashValue(hPtr, varPtr);
varPtr->id.hPtr = hPtr;
} else {
varPtr = (Var *) Tcl_GetHashValue(hPtr);
}
} else {
hPtr = NULL;
if (tablePtr != NULL) {
hPtr = Tcl_FindHashEntry(tablePtr, varName);
|
| ︙ | ︙ | |||
877 878 879 880 881 882 883 | * Otherwise, NULL is returned and an error message is left in * the interp's result if TCL_LEAVE_ERR_MSG is set in flags. * * If the variable is not found and createPart2 is 1, the variable is * created. Otherwise, NULL is returned and an error message is left in * the interp's result if TCL_LEAVE_ERR_MSG is set in flags. * | | | | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | * Otherwise, NULL is returned and an error message is left in * the interp's result if TCL_LEAVE_ERR_MSG is set in flags. * * If the variable is not found and createPart2 is 1, the variable is * created. Otherwise, NULL is returned and an error message is left in * the interp's result if TCL_LEAVE_ERR_MSG is set in flags. * * Note: it's possible for the variable returned to be undefined * even if createPart1 or createPart2 are 1 (these only cause the hash * table entry or array to be created). For example, the variable might * be a global that has been unset but is still referenced by a * procedure, or a variable that has been unset but it only being kept * in existence by a trace. * * Side effects: * The variable at arrayPtr may be converted to be an array if * createPart1 is 1. A new hashtable entry may be created if createPart2 * is 1. * *---------------------------------------------------------------------- |
| ︙ | ︙ | |||
931 932 933 934 935 936 937 | return NULL; } /* * Make sure we are not resurrecting a namespace variable from a * deleted namespace! */ | | < | | < | 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 |
return NULL;
}
/*
* Make sure we are not resurrecting a namespace variable from a
* deleted namespace!
*/
if ((arrayPtr->flags & VAR_IN_HASHTABLE) && (arrayPtr->id.hPtr == NULL)) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclVarErrMsg(interp, arrayName, elName, msg, danglingVar);
}
return NULL;
}
TclSetVarArray(arrayPtr);
arrayPtr->value.tablePtr =
(Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(arrayPtr->value.tablePtr, TCL_STRING_KEYS);
} else if (!TclIsVarArray(arrayPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclVarErrMsg(interp, arrayName, elName, msg, needArray);
}
return NULL;
}
if (createElem) {
hPtr = Tcl_CreateHashEntry(arrayPtr->value.tablePtr, elName, &new);
if (new) {
if (!TclIsVarShort(arrayPtr) && arrayPtr->searchPtr) {
DeleteSearches(arrayPtr);
}
varPtr = NewVar();
Tcl_SetHashValue(hPtr, varPtr);
varPtr->id.hPtr = hPtr;
TclSetVarArrayElement(varPtr);
}
} else {
hPtr = Tcl_FindHashEntry(arrayPtr->value.tablePtr, elName);
if (hPtr == NULL) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclVarErrMsg(interp, arrayName, elName, msg, noSuchElement);
|
| ︙ | ︙ | |||
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 |
CONST char *part2; /* If non-NULL, gives the name of an element
* in the array part1. */
CONST int flags; /* OR-ed combination of TCL_GLOBAL_ONLY,
* and TCL_LEAVE_ERR_MSG bits. */
{
Interp *iPtr = (Interp *) interp;
CONST char *msg;
/*
* Invoke any traces that have been set for the variable.
*/
| > > > > > > > > > > > > | < | 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 |
CONST char *part2; /* If non-NULL, gives the name of an element
* in the array part1. */
CONST int flags; /* OR-ed combination of TCL_GLOBAL_ONLY,
* and TCL_LEAVE_ERR_MSG bits. */
{
Interp *iPtr = (Interp *) interp;
CONST char *msg;
int checkTraces;
checkTraces = TclIsVarTraced(varPtr)
|| (arrayPtr && TclIsVarTraced(arrayPtr));
/*
* Shortcut for direct readable variables
*/
if (!checkTraces && (varPtr->flags & VAR_DIRECT_READABLE)) {
return varPtr->value.objPtr;
}
/*
* Invoke any traces that have been set for the variable.
*/
if (checkTraces) {
if (TCL_ERROR == TclCallVarTraces(iPtr, arrayPtr, varPtr, part1, part2,
(flags & (TCL_NAMESPACE_ONLY|TCL_GLOBAL_ONLY))
| TCL_TRACE_READS, (flags & TCL_LEAVE_ERR_MSG))) {
goto errorReturn;
}
}
|
| ︙ | ︙ | |||
1557 1558 1559 1560 1561 1562 1563 1564 1565 |
CONST int flags; /* OR-ed combination of TCL_GLOBAL_ONLY,
* and TCL_LEAVE_ERR_MSG bits. */
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *oldValuePtr;
Tcl_Obj *resultPtr = NULL;
int result;
/*
| > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | > > < | | | 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 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 |
CONST int flags; /* OR-ed combination of TCL_GLOBAL_ONLY,
* and TCL_LEAVE_ERR_MSG bits. */
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *oldValuePtr;
Tcl_Obj *resultPtr = NULL;
int result;
int checkTraces;
checkTraces = TclIsVarTraced(varPtr)
|| (arrayPtr && TclIsVarTraced(arrayPtr));
/*
* Avoid all the checks for direct writable variables
*/
if (checkTraces || !(varPtr->flags & VAR_DIRECT_WRITABLE)) {
/*
* If the variable is in a hashtable and its hPtr field is NULL, then
* we may have an upvar to an array element where the array was
* deleted or an upvar to a namespace variable whose namespace was
* deleted. Generate an error (allowing the variable to be reset would
* screw up our storage allocation and is meaningless anyway).
*/
if ((varPtr->flags & VAR_IN_HASHTABLE) && (varPtr->id.hPtr == NULL)) {
if (flags & TCL_LEAVE_ERR_MSG) {
if (TclIsVarArrayElement(varPtr)) {
TclVarErrMsg(interp, part1, part2, "set", danglingElement);
} else {
TclVarErrMsg(interp, part1, part2, "set", danglingVar);
}
}
return NULL;
}
/*
* It's an error to try to set an array variable itself.
*/
if (TclIsVarArray(varPtr) && !TclIsVarUndefined(varPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclVarErrMsg(interp, part1, part2, "set", isArray);
}
return NULL;
}
/*
* Invoke any read traces that have been set for the variable if it
* is requested; this is only done in the core when lappending.
*/
if (checkTraces && (flags & TCL_TRACE_READS)) {
if (TCL_ERROR == TclCallVarTraces(iPtr, arrayPtr, varPtr, part1, part2,
TCL_TRACE_READS, (flags & TCL_LEAVE_ERR_MSG))) {
return NULL;
}
}
}
/*
* Set the variable's new value. If appending, append the new value to
* the variable, either as a list element or as a string. Also, if
* appending, then if the variable's old value is unshared we can modify
* it directly, otherwise we must create a new copy to modify: this is
* "copy on write".
*/
oldValuePtr = varPtr->value.objPtr;
if (flags & TCL_LIST_ELEMENT && !(flags & TCL_APPEND_VALUE)) {
TclSetVarUndefined(varPtr);
}
if (flags & (TCL_APPEND_VALUE|TCL_LIST_ELEMENT)) {
if (TclIsVarUndefined(varPtr) && (oldValuePtr != NULL)) {
TclDecrRefCount(oldValuePtr); /* discard old value */
varPtr->value.objPtr = NULL;
oldValuePtr = NULL;
}
if (flags & TCL_LIST_ELEMENT) { /* append list element */
if (oldValuePtr == NULL) {
TclNewObj(oldValuePtr);
varPtr->value.objPtr = oldValuePtr;
Tcl_IncrRefCount(oldValuePtr); /* since var is referenced */
} else if (Tcl_IsShared(oldValuePtr)) {
varPtr->value.objPtr = Tcl_DuplicateObj(oldValuePtr);
TclDecrRefCount(oldValuePtr);
oldValuePtr = varPtr->value.objPtr;
Tcl_IncrRefCount(oldValuePtr); /* since var is referenced */
}
result = Tcl_ListObjAppendElement(interp, oldValuePtr,
newValuePtr);
if (result != TCL_OK) {
return NULL;
|
| ︙ | ︙ | |||
1665 1666 1667 1668 1669 1670 1671 |
varPtr->value.objPtr = newValuePtr;
Tcl_IncrRefCount(newValuePtr); /* var is another ref */
if (oldValuePtr != NULL) {
TclDecrRefCount(oldValuePtr); /* discard old value */
}
}
| | | > | | | | > > | > | < < < < < < < < < | < < < | | | | | < < < < < < | | | | | > > > > > > > > > > > > | 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 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 |
varPtr->value.objPtr = newValuePtr;
Tcl_IncrRefCount(newValuePtr); /* var is another ref */
if (oldValuePtr != NULL) {
TclDecrRefCount(oldValuePtr); /* discard old value */
}
}
if (varPtr->flags & VAR_DIRECT_WRITABLE) {
varPtr->flags |= VAR_DIRECT_READABLE;
if (!checkTraces) {
return varPtr->value.objPtr;
}
}
/*
* Invoke any write traces for the variable.
*/
if (checkTraces) {
TclSetVarScalar(varPtr);
if (TCL_ERROR == TclCallVarTraces(iPtr, arrayPtr, varPtr, part1, part2,
(flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY))
| TCL_TRACE_WRITES, (flags & TCL_LEAVE_ERR_MSG))) {
goto cleanup;
}
if (!TclIsVarScalar(varPtr) || TclIsVarUndefined(varPtr)) {
/*
* A trace changed the value in some gross way. Return an empty
* string object.
*/
resultPtr = iPtr->emptyObjPtr;
cleanup:
if (TclIsVarUndefined(varPtr)) {
TclCleanupVar(varPtr, arrayPtr);
}
return resultPtr;
} else {
if (TclIsVarUntraced(varPtr)) {
TclSetVarDirectScalar(varPtr);
} else {
TclSetVarScalar(varPtr);
}
return varPtr->value.objPtr;
}
}
TclSetVarDirectScalar(varPtr);
return varPtr->value.objPtr;
}
/*
*----------------------------------------------------------------------
*
* TclIncrVar2 --
*
|
| ︙ | ︙ | |||
1845 1846 1847 1848 1849 1850 1851 |
if (Tcl_IsShared(varValuePtr)) {
varValuePtr = Tcl_DuplicateObj(varValuePtr);
createdNewObj = 1;
}
if (varValuePtr->typePtr == &tclWideIntType) {
Tcl_WideInt wide;
TclGetWide(wide,varValuePtr);
| | | | | | | 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 |
if (Tcl_IsShared(varValuePtr)) {
varValuePtr = Tcl_DuplicateObj(varValuePtr);
createdNewObj = 1;
}
if (varValuePtr->typePtr == &tclWideIntType) {
Tcl_WideInt wide;
TclGetWide(wide,varValuePtr);
TclSetWideIntObj(varValuePtr, wide + Tcl_LongAsWide(incrAmount));
} else if (varValuePtr->typePtr == &tclIntType) {
i = varValuePtr->internalRep.longValue;
TclSetIntObj(varValuePtr, i + incrAmount);
} else {
/*
* Not an integer or wide internal-rep...
*/
Tcl_WideInt wide;
if (Tcl_GetWideIntFromObj(interp, varValuePtr, &wide) != TCL_OK) {
if (createdNewObj) {
TclDecrRefCount(varValuePtr); /* free unneeded copy */
}
return NULL;
}
if (wide <= Tcl_LongAsWide(LONG_MAX)
&& wide >= Tcl_LongAsWide(LONG_MIN)) {
TclSetLongObj(varValuePtr, Tcl_WideAsLong(wide) + incrAmount);
} else {
TclSetWideIntObj(varValuePtr, wide + Tcl_LongAsWide(incrAmount));
}
}
/*
* Store the variable's new value and run any write traces.
*/
|
| ︙ | ︙ | |||
2008 2009 2010 2011 2012 2013 2014 |
createdNewObj = 0;
if (Tcl_IsShared(varValuePtr)) {
varValuePtr = Tcl_DuplicateObj(varValuePtr);
createdNewObj = 1;
}
if (varValuePtr->typePtr == &tclWideIntType) {
TclGetWide(wide, varValuePtr);
| | | | | 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 |
createdNewObj = 0;
if (Tcl_IsShared(varValuePtr)) {
varValuePtr = Tcl_DuplicateObj(varValuePtr);
createdNewObj = 1;
}
if (varValuePtr->typePtr == &tclWideIntType) {
TclGetWide(wide, varValuePtr);
TclSetWideIntObj(varValuePtr, wide + incrAmount);
} else if (varValuePtr->typePtr == &tclIntType) {
long i = varValuePtr->internalRep.longValue;
TclSetWideIntObj(varValuePtr, Tcl_LongAsWide(i) + incrAmount);
} else {
/*
* Not an integer or wide internal-rep...
*/
if (Tcl_GetWideIntFromObj(interp, varValuePtr, &wide) != TCL_OK) {
if (createdNewObj) {
Tcl_DecrRefCount(varValuePtr); /* free unneeded copy */
}
return NULL;
}
TclSetWideIntObj(varValuePtr, wide + incrAmount);
}
/*
* Store the variable's new value and run any write traces.
*/
return TclPtrSetVar(interp, varPtr, arrayPtr, part1, part2,
|
| ︙ | ︙ | |||
2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 |
Var *varPtr, *dummyVarPtr;
Interp *iPtr = (Interp *) interp;
Var *arrayPtr;
ActiveVarTrace *activePtr;
Tcl_Obj *objPtr;
int result;
char *part1;
part1 = TclGetString(part1Ptr);
varPtr = TclObjLookupVar(interp, part1Ptr, part2, flags, "unset",
/*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
if (varPtr == NULL) {
return TCL_ERROR;
}
result = (TclIsVarUndefined(varPtr)? TCL_ERROR : TCL_OK);
| > | < | < < < < < < < < | > > > > > > > > > > > > > > | | > | < | 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 |
Var *varPtr, *dummyVarPtr;
Interp *iPtr = (Interp *) interp;
Var *arrayPtr;
ActiveVarTrace *activePtr;
Tcl_Obj *objPtr;
int result;
char *part1;
int checkTraces;
part1 = TclGetString(part1Ptr);
varPtr = TclObjLookupVar(interp, part1Ptr, part2, flags, "unset",
/*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
if (varPtr == NULL) {
return TCL_ERROR;
}
result = (TclIsVarUndefined(varPtr)? TCL_ERROR : TCL_OK);
if (arrayPtr && !TclIsVarShort(arrayPtr) && arrayPtr->searchPtr) {
DeleteSearches(arrayPtr);
}
/*
* The code below is tricky, because of the possibility that
* a trace procedure might try to access a variable being
* deleted. To handle this situation gracefully, do things
* in three steps:
* 1. Copy the contents of the variable to a dummy variable
* structure, and mark the original Var structure as undefined.
* 2. Invoke traces and clean up the variable, using the dummy copy.
* 3. If at the end of this the original variable is still
* undefined and has no outstanding references, then delete
* it (but it could have gotten recreated by a trace).
*
* Keep the variable alive until we're done with it. We used to
* increase/decrease the refCount for each operation, making it
* hard to find [Bug 735335] - caused by unsetting the variable
* whose value was the variable's name.
*/
checkTraces = TclIsVarTraced(varPtr)
|| (arrayPtr && TclIsVarTraced(arrayPtr));
if (TclIsVarShort(varPtr)) {
dummyVar.flags = varPtr->flags;
dummyVar.value = varPtr->value;
dummyVar.id = varPtr->id;
dummyVar.refCount = 1;
dummyVar.tracePtr = NULL;
dummyVar.searchPtr = NULL;
} else {
dummyVar = *varPtr;
varPtr->tracePtr = NULL;
varPtr->searchPtr = NULL;
varPtr->refCount++;
}
TclSetVarUndefined(varPtr);
/*
* Call trace procedures for the variable being deleted. Then delete
* its traces. Be sure to abort any other traces for the variable
* that are still pending. Special tricks:
* 1. We need to increment varPtr's refCount around this: TclCallVarTraces
* will use dummyVar so it won't increment varPtr's refCount itself.
* 2. Turn off the VAR_TRACE_ACTIVE flag in dummyVar: we want to
* call unset traces even if other traces are pending.
*/
if (checkTraces) {
dummyVar.flags &= ~VAR_TRACE_ACTIVE;
TclCallVarTraces(iPtr, arrayPtr, &dummyVar, part1, part2,
(flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY))
| TCL_TRACE_UNSETS, /* leaveErrMsg */ 0);
while (dummyVar.tracePtr != NULL) {
VarTrace *tracePtr = dummyVar.tracePtr;
dummyVar.tracePtr = tracePtr->nextPtr;
|
| ︙ | ︙ | |||
2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 |
* array is about to be removed anyway, that shouldn't really matter.
*/
DeleteArray(iPtr, part1, dummyVarPtr,
(flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY))
| TCL_TRACE_UNSETS);
/* Decr ref count */
}
if (TclIsVarScalar(dummyVarPtr)
&& (dummyVarPtr->value.objPtr != NULL)) {
objPtr = dummyVarPtr->value.objPtr;
TclDecrRefCount(objPtr);
dummyVarPtr->value.objPtr = NULL;
}
| > | 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 |
* array is about to be removed anyway, that shouldn't really matter.
*/
DeleteArray(iPtr, part1, dummyVarPtr,
(flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY))
| TCL_TRACE_UNSETS);
/* Decr ref count */
}
if (TclIsVarScalar(dummyVarPtr)
&& (dummyVarPtr->value.objPtr != NULL)) {
objPtr = dummyVarPtr->value.objPtr;
TclDecrRefCount(objPtr);
dummyVarPtr->value.objPtr = NULL;
}
|
| ︙ | ︙ | |||
2294 2295 2296 2297 2298 2299 2300 |
/*
* Finally, if the variable is truly not in use then free up its Var
* structure and remove it from its hash table, if any. The ref count of
* its value object, if any, was decremented above.
*/
| > | | > | 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 |
/*
* Finally, if the variable is truly not in use then free up its Var
* structure and remove it from its hash table, if any. The ref count of
* its value object, if any, was decremented above.
*/
if (!TclIsVarShort(varPtr)) {
varPtr->refCount--;
TclCleanupVar(varPtr, arrayPtr);
}
return result;
}
/*
*----------------------------------------------------------------------
*
* Tcl_UnsetObjCmd --
|
| ︙ | ︙ | |||
2464 2465 2466 2467 2468 2469 2470 |
Tcl_LappendObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
Tcl_Obj *varValuePtr, *newValuePtr;
| < < | > | | 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 |
Tcl_LappendObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
Tcl_Obj *varValuePtr, *newValuePtr;
int numElems, createdNewObj, createVar;
Var *varPtr, *arrayPtr;
char *part1;
int result;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "varName ?value value ...?");
return TCL_ERROR;
}
if (objc == 2) {
newValuePtr = Tcl_ObjGetVar2(interp, objv[1], (Tcl_Obj *) NULL, 0);
if (newValuePtr == NULL) {
/*
* The variable doesn't exist yet. Just create it with an empty
* initial value.
*/
TclNewObj(varValuePtr);
newValuePtr = Tcl_ObjSetVar2(interp, objv[1], NULL, varValuePtr,
TCL_LEAVE_ERR_MSG);
if (newValuePtr == NULL) {
Tcl_DecrRefCount(varValuePtr); /* free unneeded object */
return TCL_ERROR;
}
}
|
| ︙ | ︙ | |||
2518 2519 2520 2521 2522 2523 2524 |
*/
varPtr = TclObjLookupVar(interp, objv[1], NULL, TCL_LEAVE_ERR_MSG,
"set", /*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr);
if (varPtr == NULL) {
return TCL_ERROR;
}
| > | > | > | > | | < > | < > > | < < | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 |
*/
varPtr = TclObjLookupVar(interp, objv[1], NULL, TCL_LEAVE_ERR_MSG,
"set", /*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr);
if (varPtr == NULL) {
return TCL_ERROR;
}
if (!TclIsVarShort(varPtr)) {
varPtr->refCount++;
}
if (arrayPtr && !TclIsVarShort(arrayPtr)) {
arrayPtr->refCount++;
}
part1 = TclGetString(objv[1]);
varValuePtr = TclPtrGetVar(interp, varPtr, arrayPtr, part1, NULL,
(TCL_TRACE_READS | TCL_LEAVE_ERR_MSG));
if (!TclIsVarShort(varPtr)) {
varPtr->refCount--;
}
if (arrayPtr && !TclIsVarShort(arrayPtr)) {
arrayPtr->refCount--;
}
if (varValuePtr == NULL) {
/*
* We couldn't read the old value: either the var doesn't yet
* exist or it's an array element. If it's new, we will try to
* create it with Tcl_ObjSetVar2 below.
*/
createVar = (TclIsVarUndefined(varPtr));
TclNewObj(varValuePtr);
createdNewObj = 1;
} else if (Tcl_IsShared(varValuePtr)) {
varValuePtr = Tcl_DuplicateObj(varValuePtr);
createdNewObj = 1;
}
result = Tcl_ListObjLength(interp, varValuePtr, &numElems);
if (result == TCL_OK) {
result = Tcl_ListObjReplace(interp, varValuePtr, numElems, 0,
(objc-2), (objv+2));
}
if (result != TCL_OK) {
if (createdNewObj) {
Tcl_DecrRefCount(varValuePtr); /* free unneeded obj. */
}
return result;
}
/*
* Now store the list object back into the variable. If there is an
* error setting the new value, decrement its ref count if it
* was new and we didn't create the variable.
*/
|
| ︙ | ︙ | |||
2694 2695 2696 2697 2698 2699 2700 |
/*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
/*
* Special array trace used to keep the env array in sync for
* array names, array get, etc.
*/
| | | 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 |
/*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
/*
* Special array trace used to keep the env array in sync for
* array names, array get, etc.
*/
if (varPtr && TclIsVarTraced(varPtr)
&& (TclIsVarArray(varPtr) || TclIsVarUndefined(varPtr))) {
if (TCL_ERROR == TclCallVarTraces(iPtr, arrayPtr, varPtr, varName,
NULL, (TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY|TCL_GLOBAL_ONLY|
TCL_TRACE_ARRAY), /* leaveErrMsg */ 1)) {
return TCL_ERROR;
}
}
|
| ︙ | ︙ | |||
2741 2742 2743 2744 2745 2746 2747 |
varPtr2 = (Var *) Tcl_GetHashValue(searchPtr->nextEntry);
if (!TclIsVarUndefined(varPtr2)) {
break;
}
}
searchPtr->nextEntry = Tcl_NextHashEntry(&searchPtr->search);
if (searchPtr->nextEntry == NULL) {
| | | | 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 |
varPtr2 = (Var *) Tcl_GetHashValue(searchPtr->nextEntry);
if (!TclIsVarUndefined(varPtr2)) {
break;
}
}
searchPtr->nextEntry = Tcl_NextHashEntry(&searchPtr->search);
if (searchPtr->nextEntry == NULL) {
Tcl_SetObjResult(interp, iPtr->execEnvPtr->constants[0]);
return TCL_OK;
}
}
Tcl_SetObjResult(interp, iPtr->execEnvPtr->constants[1]);
break;
}
case ARRAY_DONESEARCH: {
ArraySearch *searchPtr, *prevPtr;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "arrayName searchId");
|
| ︙ | ︙ | |||
2781 2782 2783 2784 2785 2786 2787 |
break;
}
case ARRAY_EXISTS: {
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "arrayName");
return TCL_ERROR;
}
| | | 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 |
break;
}
case ARRAY_EXISTS: {
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "arrayName");
return TCL_ERROR;
}
Tcl_SetObjResult(interp, iPtr->execEnvPtr->constants[!notArray]);
break;
}
case ARRAY_GET: {
Tcl_HashSearch search;
Var *varPtr2;
char *pattern = NULL;
char *name;
|
| ︙ | ︙ | |||
2807 2808 2809 2810 2811 2812 2813 | pattern = TclGetString(objv[3]); } /* * Store the array names in a new object. */ | | > > > > | > > > > > > > > > > > > > > | > | | 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 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 |
pattern = TclGetString(objv[3]);
}
/*
* Store the array names in a new object.
*/
TclNewObj(nameLstPtr);
Tcl_IncrRefCount(nameLstPtr);
if ((pattern != NULL) && TclMatchIsTrivial(pattern)) {
hPtr = Tcl_FindHashEntry(varPtr->value.tablePtr, pattern);
if (hPtr == NULL) {
goto searchDone;
}
varPtr2 = (Var *) Tcl_GetHashValue(hPtr);
if (TclIsVarUndefined(varPtr2)) {
goto searchDone;
}
result = Tcl_ListObjAppendElement(interp, nameLstPtr,
Tcl_NewStringObj(pattern, -1));
if (result != TCL_OK) {
Tcl_DecrRefCount(nameLstPtr);
return result;
}
goto searchDone;
}
for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
varPtr2 = (Var *) Tcl_GetHashValue(hPtr);
if (TclIsVarUndefined(varPtr2)) {
continue;
}
name = Tcl_GetHashKey(varPtr->value.tablePtr, hPtr);
if ((objc == 4) && !Tcl_StringMatch(name, pattern)) {
continue; /* element name doesn't match pattern */
}
namePtr = Tcl_NewStringObj(name, -1);
result = Tcl_ListObjAppendElement(interp, nameLstPtr,
namePtr);
if (result != TCL_OK) {
Tcl_DecrRefCount(namePtr); /* free unneeded name obj */
Tcl_DecrRefCount(nameLstPtr);
return result;
}
}
searchDone:
/*
* Make sure the Var structure of the array is not removed by
* a trace while we're working.
*/
if (!TclIsVarShort(varPtr)) {
varPtr->refCount++;
}
/*
* Get the array values corresponding to each element name
*/
TclNewObj(tmpResPtr);
result = Tcl_ListObjGetElements(interp, nameLstPtr,
&count, &namePtrPtr);
if (result != TCL_OK) {
goto errorInArrayGet;
}
for (i = 0; i < count; i++) {
|
| ︙ | ︙ | |||
2877 2878 2879 2880 2881 2882 2883 |
}
}
result = Tcl_DictObjPut(interp, tmpResPtr, namePtr, valuePtr);
if (result != TCL_OK) {
goto errorInArrayGet;
}
}
| > | > | > | > | 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 |
}
}
result = Tcl_DictObjPut(interp, tmpResPtr, namePtr, valuePtr);
if (result != TCL_OK) {
goto errorInArrayGet;
}
}
if (!TclIsVarShort(varPtr)) {
varPtr->refCount--;
}
Tcl_SetObjResult(interp, tmpResPtr);
TclDecrRefCount(nameLstPtr);
break;
errorInArrayGet:
if (!TclIsVarShort(varPtr)) {
varPtr->refCount--;
}
Tcl_DecrRefCount(nameLstPtr);
Tcl_DecrRefCount(tmpResPtr); /* free unneeded temp result obj */
return result;
}
case ARRAY_NAMES: {
Tcl_HashSearch search;
Var *varPtr2;
|
| ︙ | ︙ | |||
2918 2919 2920 2921 2922 2923 2924 |
} else if (objc == 5) {
pattern = TclGetString(objv[4]);
if (Tcl_GetIndexFromObj(interp, objv[3], options, "option",
0, &mode) != TCL_OK) {
return TCL_ERROR;
}
}
| | > > > > > > > > > > > > > | 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 |
} else if (objc == 5) {
pattern = TclGetString(objv[4]);
if (Tcl_GetIndexFromObj(interp, objv[3], options, "option",
0, &mode) != TCL_OK) {
return TCL_ERROR;
}
}
TclNewObj(resultPtr);
if ((((enum options) mode) == OPT_GLOB) && (pattern != NULL)
&& TclMatchIsTrivial(pattern)) {
hPtr = Tcl_FindHashEntry(varPtr->value.tablePtr, pattern);
if ((hPtr != NULL)
&& !TclIsVarUndefined((Var *) Tcl_GetHashValue(hPtr))
&& (result = Tcl_ListObjAppendElement(interp,
resultPtr, Tcl_NewStringObj(pattern, -1))) != TCL_OK) {
Tcl_DecrRefCount(resultPtr);
return result;
}
Tcl_SetObjResult(interp, resultPtr);
return TCL_OK;
}
for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
varPtr2 = (Var *) Tcl_GetHashValue(hPtr);
if (TclIsVarUndefined(varPtr2)) {
continue;
}
name = Tcl_GetHashKey(varPtr->value.tablePtr, hPtr);
|
| ︙ | ︙ | |||
2955 2956 2957 2958 2959 2960 2961 |
namePtr = Tcl_NewStringObj(name, -1);
result = Tcl_ListObjAppendElement(interp, resultPtr, namePtr);
if (result != TCL_OK) {
Tcl_DecrRefCount(resultPtr);
Tcl_DecrRefCount(namePtr); /* free unneeded name obj */
return result;
}
| < > | 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 |
namePtr = Tcl_NewStringObj(name, -1);
result = Tcl_ListObjAppendElement(interp, resultPtr, namePtr);
if (result != TCL_OK) {
Tcl_DecrRefCount(resultPtr);
Tcl_DecrRefCount(namePtr); /* free unneeded name obj */
return result;
}
}
Tcl_SetObjResult(interp, resultPtr);
break;
}
case ARRAY_NEXTELEMENT: {
ArraySearch *searchPtr;
Tcl_HashEntry *hPtr;
if (objc != 4) {
|
| ︙ | ︙ | |||
3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 |
Tcl_WrongNumArgs(interp, 2, objv, "arrayName");
return TCL_ERROR;
}
if (notArray) {
goto error;
}
searchPtr = (ArraySearch *) ckalloc(sizeof(ArraySearch));
if (varPtr->searchPtr == NULL) {
searchPtr->id = 1;
Tcl_AppendResult(interp, "s-1-", varName, NULL);
} else {
char string[TCL_INTEGER_SPACE];
searchPtr->id = varPtr->searchPtr->id + 1;
| > > > | 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 |
Tcl_WrongNumArgs(interp, 2, objv, "arrayName");
return TCL_ERROR;
}
if (notArray) {
goto error;
}
searchPtr = (ArraySearch *) ckalloc(sizeof(ArraySearch));
if (!TclIsVarShort(varPtr)) {
varPtr = TclExtendVar(varPtr);
}
if (varPtr->searchPtr == NULL) {
searchPtr->id = 1;
Tcl_AppendResult(interp, "s-1-", varName, NULL);
} else {
char string[TCL_INTEGER_SPACE];
searchPtr->id = varPtr->searchPtr->id + 1;
|
| ︙ | ︙ | |||
3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 |
*/
if (TclObjUnsetVar2(interp, varNamePtr, NULL, 0)
!= TCL_OK) {
return TCL_ERROR;
}
} else {
pattern = TclGetString(objv[3]);
for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr,
&search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
varPtr2 = (Var *) Tcl_GetHashValue(hPtr);
if (TclIsVarUndefined(varPtr2)) {
continue;
}
| > > > > > > > > > | 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 |
*/
if (TclObjUnsetVar2(interp, varNamePtr, NULL, 0)
!= TCL_OK) {
return TCL_ERROR;
}
} else {
pattern = TclGetString(objv[3]);
if (TclMatchIsTrivial(pattern)) {
hPtr = Tcl_FindHashEntry(varPtr->value.tablePtr, pattern);
result = TCL_OK;
(hPtr != NULL)
&& !TclIsVarUndefined((Var *) Tcl_GetHashValue(hPtr))
&& (result
= TclObjUnsetVar2(interp, varNamePtr, pattern, 0));
return result;
}
for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr,
&search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
varPtr2 = (Var *) Tcl_GetHashValue(hPtr);
if (TclIsVarUndefined(varPtr2)) {
continue;
}
|
| ︙ | ︙ | |||
3284 3285 3286 3287 3288 3289 3290 |
TclVarErrMsg(interp, varName, (char *)NULL, "array set",
needArray);
return TCL_ERROR;
}
}
TclSetVarArray(varPtr);
| < | 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 |
TclVarErrMsg(interp, varName, (char *)NULL, "array set",
needArray);
return TCL_ERROR;
}
}
TclSetVarArray(varPtr);
varPtr->value.tablePtr =
(Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(varPtr->value.tablePtr, TCL_STRING_KEYS);
return TCL_OK;
}
/*
|
| ︙ | ︙ | |||
3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 |
if (!(otherFlags & TCL_NAMESPACE_ONLY)) {
iPtr->varFramePtr = varFramePtr;
}
if (otherPtr == NULL) {
return TCL_ERROR;
}
if (index >= 0) {
if (!(varFramePtr->isProcCallFrame & FRAME_IS_PROC)) {
Tcl_Panic("ObjMakeUpvar called with an index outside from a proc.\n");
}
| > > > > > > > > | | > > > | > > > > > | 3391 3392 3393 3394 3395 3396 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 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 |
if (!(otherFlags & TCL_NAMESPACE_ONLY)) {
iPtr->varFramePtr = varFramePtr;
}
if (otherPtr == NULL) {
return TCL_ERROR;
}
if (TclIsVarExtension(otherPtr)) {
/*
* Do not make links to extension variables, go back to the original.
*/
otherPtr = otherPtr->id.shortPtr;
}
if (index >= 0) {
if (!(varFramePtr->isProcCallFrame & FRAME_IS_PROC)) {
Tcl_Panic("ObjMakeUpvar called with an index outside from a proc.\n");
}
varPtr = (Var *) &(varFramePtr->compiledLocals[index]);
} else {
/*
* Check that we are not trying to create a namespace var linked to
* a local variable in a procedure. If we allowed this, the local
* variable in the shorter-lived procedure frame could go away
* leaving the namespace var's reference invalid.
*/
Tcl_HashEntry *hPtr;
if (arrayPtr) {
hPtr = (arrayPtr->flags & VAR_IN_HASHTABLE)?
arrayPtr->id.hPtr : NULL;
} else {
hPtr = (otherPtr->flags & VAR_IN_HASHTABLE)?
otherPtr->id.hPtr : NULL;
}
if ((!hPtr || !((TclNSVarHashTable *)(hPtr->tablePtr))->nsPtr)
&& ((myFlags & (TCL_GLOBAL_ONLY | TCL_NAMESPACE_ONLY))
|| (varFramePtr == NULL)
|| !(varFramePtr->isProcCallFrame & FRAME_IS_PROC)
|| (strstr(myName, "::") != NULL))) {
Tcl_AppendResult((Tcl_Interp *) iPtr, "bad variable name \"",
myName, "\": upvar won't create namespace variable that ",
"refers to procedure variable", (char *) NULL);
|
| ︙ | ︙ | |||
3424 3425 3426 3427 3428 3429 3430 |
if (varPtr == otherPtr) {
Tcl_SetResult((Tcl_Interp *) iPtr,
"can't upvar from variable to itself", TCL_STATIC);
return TCL_ERROR;
}
| > > > > > | > > > > > | | | > < > | > | 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 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 |
if (varPtr == otherPtr) {
Tcl_SetResult((Tcl_Interp *) iPtr,
"can't upvar from variable to itself", TCL_STATIC);
return TCL_ERROR;
}
if (TclIsVarShort(varPtr) && TclIsVarLink(varPtr)
&& TclIsVarExtension(varPtr->value.linkPtr)) {
/*
* Link to the extension instead
*/
varPtr = varPtr->value.linkPtr;
}
if (TclIsVarTraced(varPtr)) {
Tcl_AppendResult((Tcl_Interp *) iPtr, "variable \"", myName,
"\" has traces: can't use for upvar", (char *) NULL);
return TCL_ERROR;
} else if (!TclIsVarUndefined(varPtr)) {
/*
* The variable already existed. Make sure this variable "varPtr"
* isn't the same as "otherPtr" (avoid circular links). Also, if
* it's not an upvar then it's an error. If it is an upvar, then
* just disconnect it from the thing it currently refers to.
*/
if (TclIsVarLink(varPtr)) {
Var *linkPtr = varPtr->value.linkPtr;
if (linkPtr == otherPtr) {
return TCL_OK;
}
if (!TclIsVarShort(linkPtr)) {
linkPtr->refCount--;
if (TclIsVarUndefined(linkPtr)) {
TclCleanupVar(linkPtr, (Var *) NULL);
}
}
} else {
Tcl_AppendResult((Tcl_Interp *) iPtr, "variable \"", myName,
"\" already exists", (char *) NULL);
return TCL_ERROR;
}
}
TclSetVarLink(varPtr);
varPtr->value.linkPtr = otherPtr;
if (!TclIsVarShort(otherPtr)) {
otherPtr->refCount++;
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tcl_UpVar --
|
| ︙ | ︙ | |||
3577 3578 3579 3580 3581 3582 3583 |
Tcl_Obj *objPtr; /* Points to the object onto which the
* variable's full name is appended. */
{
Interp *iPtr = (Interp *) interp;
register Var *varPtr = (Var *) variable;
char *name;
| > > | > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | < < < | > | < | 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 |
Tcl_Obj *objPtr; /* Points to the object onto which the
* variable's full name is appended. */
{
Interp *iPtr = (Interp *) interp;
register Var *varPtr = (Var *) variable;
char *name;
if (varPtr && !TclIsVarArrayElement(varPtr)) {
if (TclIsVarExtension(varPtr)) {
/*
* Retrieve the original local variable
*/
varPtr = varPtr->id.shortPtr;
}
if (TclIsVarShort(varPtr)) {
/*
* Find the index of this var - which FramePtr? Assume the current
* one (although it could be an uplevel one? Do check the index
* for safety!
*/
CallFrame *framePtr = iPtr->varFramePtr;
ShortVar *compiledLocals = framePtr->compiledLocals;
int index = ((ShortVar *) varPtr) - compiledLocals;
int localCt = framePtr->numCompiledLocals;
char **varNames = (char **) &(compiledLocals[localCt]);
if ((index < localCt)
&& (varPtr == (Var *) &compiledLocals[index])) {
Tcl_AppendToObj(objPtr, varNames[index], -1);
}
} else if (varPtr->id.hPtr) {
/*
* Add the full name of the containing namespace (if any),
* followed by the "::" separator, then the variable name.
*/
Namespace *nsPtr =
((TclNSVarHashTable *)(varPtr->id.hPtr->tablePtr))->nsPtr;
if (nsPtr) {
Tcl_AppendToObj(objPtr, nsPtr->fullName, -1);
if (nsPtr != iPtr->globalNsPtr) {
Tcl_AppendToObj(objPtr, "::", 2);
}
}
name = Tcl_GetHashKey(
(Tcl_HashTable *)varPtr->id.hPtr->tablePtr, varPtr->id.hPtr);
Tcl_AppendToObj(objPtr, name, -1);
}
}
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
3921 3922 3923 3924 3925 3926 3927 |
*----------------------------------------------------------------------
*/
static Var *
NewVar()
{
register Var *varPtr;
| > | > | > < < | < | 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 |
*----------------------------------------------------------------------
*/
static Var *
NewVar()
{
register Var *varPtr;
Tcl_Obj *objPtr;
TclAllocObjStorage(objPtr);
varPtr = (Var *) objPtr;
varPtr->flags = (VAR_IN_HASHTABLE|VAR_DIRECT_WRITABLE);
varPtr->value.objPtr = NULL;
varPtr->id.hPtr = NULL;
varPtr->refCount = 0;
varPtr->tracePtr = NULL;
varPtr->searchPtr = NULL;
return varPtr;
}
/*
*----------------------------------------------------------------------
*
* SetArraySearchObj --
|
| ︙ | ︙ | |||
4067 4068 4069 4070 4071 4072 4073 |
* to see if the desired one exists.
*
* Note that we cannot store the searchPtr directly in the Tcl_Obj
* as that would run into trouble when DeleteSearches() was called
* so we must scan this list every time.
*/
| > | | | | > | 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 |
* to see if the desired one exists.
*
* Note that we cannot store the searchPtr directly in the Tcl_Obj
* as that would run into trouble when DeleteSearches() was called
* so we must scan this list every time.
*/
if (!TclIsVarShort(varPtr)) {
for (searchPtr = varPtr->searchPtr; searchPtr != NULL;
searchPtr = searchPtr->nextPtr) {
if (searchPtr->id == id) {
return searchPtr;
}
}
}
Tcl_AppendResult(interp, "couldn't find search \"", string, "\"",
(char *) NULL);
return NULL;
}
|
| ︙ | ︙ | |||
4102 4103 4104 4105 4106 4107 4108 |
static void
DeleteSearches(arrayVarPtr)
register Var *arrayVarPtr; /* Variable whose searches are
* to be deleted. */
{
ArraySearch *searchPtr;
| > | | | | > | 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 |
static void
DeleteSearches(arrayVarPtr)
register Var *arrayVarPtr; /* Variable whose searches are
* to be deleted. */
{
ArraySearch *searchPtr;
if (!TclIsVarShort(arrayVarPtr)) {
while (arrayVarPtr->searchPtr) {
searchPtr = arrayVarPtr->searchPtr;
arrayVarPtr->searchPtr = searchPtr->nextPtr;
ckfree((char *) searchPtr);
}
}
}
/*
*----------------------------------------------------------------------
*
* TclDeleteVars --
|
| ︙ | ︙ | |||
4151 4152 4153 4154 4155 4156 4157 |
Namespace *currNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
/*
* Determine what flags to pass to the trace callback procedures.
*/
flags = TCL_TRACE_UNSETS;
| | | > | | | | | | | | | > > > | | < < > | < | | > | 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 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 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 |
Namespace *currNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
/*
* Determine what flags to pass to the trace callback procedures.
*/
flags = TCL_TRACE_UNSETS;
if (tablePtr == (Tcl_HashTable *)&iPtr->globalNsPtr->varTable) {
flags |= TCL_GLOBAL_ONLY;
} else if (tablePtr == (Tcl_HashTable *)&currNsPtr->varTable) {
flags |= TCL_NAMESPACE_ONLY;
}
if (Tcl_InterpDeleted(interp)) {
flags |= TCL_INTERP_DESTROYED;
}
for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&search)) {
varPtr = (Var *) Tcl_GetHashValue(hPtr);
/*
* For global/upvar variables referenced in procedures, decrement
* the reference count on the variable referred to, and free
* the referenced variable if it's no longer needed. Don't delete
* the hash entry for the other variable if it's in the same table
* as us: this will happen automatically later on.
*/
if (TclIsVarLink(varPtr)) {
linkPtr = varPtr->value.linkPtr;
if (!TclIsVarShort(linkPtr)) {
linkPtr->refCount--;
if ((linkPtr->refCount == 0) && TclIsVarUndefined(linkPtr)
&& (linkPtr->tracePtr == NULL)
&& (linkPtr->flags & VAR_IN_HASHTABLE)) {
if (linkPtr->id.hPtr == NULL) {
TclFreeObjStorage((Tcl_Obj *)linkPtr);
} else if (linkPtr->id.hPtr->tablePtr != tablePtr) {
Tcl_DeleteHashEntry(linkPtr->id.hPtr);
TclFreeObjStorage((Tcl_Obj *)linkPtr);
}
}
}
}
/*
* Invoke traces on the variable that is being deleted, then
* free up the variable's space (no need to free the hash
* entry here, unless we're dealing with a global variable:
* the hash entries will be deleted automatically when the
* whole table is deleted). Note that we give TclCallVarTraces
* the variable's fully-qualified name so that any called
* trace procedures can refer to these variables being
* deleted.
*
* Note that a variable in a table is never short.
*/
if (varPtr->tracePtr != NULL) {
TclNewObj(objPtr);
Tcl_IncrRefCount(objPtr); /* until done with traces */
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, objPtr);
TclCallVarTraces(iPtr, (Var *) NULL, varPtr, TclGetString(objPtr),
NULL, flags, /* leaveErrMsg */ 0);
TclDecrRefCount(objPtr); /* free no longer needed obj */
while (varPtr->tracePtr != NULL) {
VarTrace *tracePtr = varPtr->tracePtr;
varPtr->tracePtr = tracePtr->nextPtr;
Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);
}
for (activePtr = iPtr->activeVarTracePtr; activePtr != NULL;
activePtr = activePtr->nextPtr) {
if (activePtr->varPtr == varPtr) {
activePtr->nextTracePtr = NULL;
}
}
}
if (TclIsVarArray(varPtr)) {
DeleteArray(iPtr, Tcl_GetHashKey(tablePtr, hPtr), varPtr,
flags);
}
if (TclIsVarScalar(varPtr) && (varPtr->value.objPtr != NULL)) {
objPtr = varPtr->value.objPtr;
TclDecrRefCount(objPtr);
}
TclSetVarUndefined(varPtr);
varPtr->id.hPtr = NULL;
varPtr->tracePtr = NULL;
varPtr->flags &= ~VAR_DIRECT_WRITABLE;
/*
* If the variable was a namespace variable, decrement its
* reference count. We are in the process of destroying its
* namespace so that namespace will no longer "refer" to the
* variable.
*/
if (TclIsVarNamespaceVar(varPtr)) {
TclClearVarNamespaceVar(varPtr);
varPtr->refCount--;
}
/*
* Recycle the variable's memory space if there aren't any upvar's
* pointing to it. If there are upvars to this variable, then the
* variable will get freed when the last upvar goes away.
*/
if (varPtr->refCount == 0) {
/* this Var must be VAR_IN_HASHTABLE */
TclFreeObjStorage((Tcl_Obj *)varPtr);
}
}
Tcl_DeleteHashTable(tablePtr);
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
4289 4290 4291 4292 4293 4294 4295 |
void
TclDeleteCompiledLocalVars(iPtr, framePtr)
Interp *iPtr; /* Interpreter to which variables belong. */
CallFrame *framePtr; /* Procedure call frame containing
* compiler-assigned local variables to
* delete. */
{
| | | > > | > > > > > > > > > > > > > > > > | | | | | | | | | > | | | | | | > | > > > | > | > | | < | | 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 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 |
void
TclDeleteCompiledLocalVars(iPtr, framePtr)
Interp *iPtr; /* Interpreter to which variables belong. */
CallFrame *framePtr; /* Procedure call frame containing
* compiler-assigned local variables to
* delete. */
{
register ShortVar *shortPtr;
int flags; /* Flags passed to trace procedures. */
Var *varPtr, *linkPtr;
ActiveVarTrace *activePtr;
int numLocals, i;
int isExtended;
char **varNames;
flags = TCL_TRACE_UNSETS;
numLocals = framePtr->numCompiledLocals;
shortPtr = framePtr->compiledLocals;
varNames = (char **) &(framePtr->compiledLocals[framePtr->numCompiledLocals]);
for (i = 0; i < numLocals; i++) {
/*
* If this variable is extended, we have to operate on the extension,
* and then free it.
*/
if (TclIsVarLink(shortPtr)
&& TclIsVarExtension(shortPtr->value.linkPtr)) {
isExtended = 1;
varPtr = shortPtr->value.linkPtr;
} else {
isExtended = 0;
varPtr = (Var *) shortPtr;
}
/*
* For global/upvar variables referenced in procedures, decrement
* the reference count on the variable referred to, and free
* the referenced variable if it's no longer needed. Don't delete
* the hash entry for the other variable if it's in the same table
* as us: this will happen automatically later on.
*/
if (TclIsVarLink(varPtr)) {
linkPtr = varPtr->value.linkPtr;
if (!TclIsVarShort(linkPtr)) {
linkPtr->refCount--;
if ((linkPtr->refCount == 0) && TclIsVarUndefined(linkPtr)
&& (linkPtr->tracePtr == NULL)
&& (linkPtr->flags & VAR_IN_HASHTABLE)) {
if (linkPtr->id.hPtr == NULL) {
TclFreeObjStorage((Tcl_Obj *)linkPtr);
} else {
Tcl_DeleteHashEntry(linkPtr->id.hPtr);
TclFreeObjStorage((Tcl_Obj *)linkPtr);
}
}
}
}
/*
* Invoke traces on the variable that is being deleted. Then delete
* the variable's trace records.
*/
if (isExtended && varPtr->tracePtr) {
TclCallVarTraces(iPtr, (Var *) NULL, varPtr, varNames[i], NULL,
flags, /* leaveErrMsg */ 0);
while (varPtr->tracePtr) {
VarTrace *tracePtr = varPtr->tracePtr;
varPtr->tracePtr = tracePtr->nextPtr;
Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);
}
for (activePtr = iPtr->activeVarTracePtr; activePtr != NULL;
activePtr = activePtr->nextPtr) {
if (activePtr->varPtr == varPtr) {
activePtr->nextTracePtr = NULL;
}
}
}
/*
* Now if the variable is an array, delete its element hash table.
* Otherwise, if it's a scalar variable, decrement the ref count
* of its value.
*/
if (TclIsVarArray(varPtr) && varPtr->value.tablePtr) {
DeleteArray(iPtr, varNames[i], varPtr, flags);
}
if (TclIsVarScalar(varPtr) && varPtr->value.objPtr) {
TclDecrRefCount(varPtr->value.objPtr);
}
/*
* Now delete the extension if there was any
*/
if (isExtended) {
TclFreeObjStorage((Tcl_Obj *)varPtr);
}
TclSetVarUndefined(shortPtr);
shortPtr++;
}
}
/*
*----------------------------------------------------------------------
*
* DeleteArray --
|
| ︙ | ︙ | |||
4411 4412 4413 4414 4415 4416 4417 |
DeleteSearches(varPtr);
for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
elPtr = (Var *) Tcl_GetHashValue(hPtr);
if (TclIsVarScalar(elPtr) && (elPtr->value.objPtr != NULL)) {
objPtr = elPtr->value.objPtr;
TclDecrRefCount(objPtr);
| | | > > > > > > < | > | 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 |
DeleteSearches(varPtr);
for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
elPtr = (Var *) Tcl_GetHashValue(hPtr);
if (TclIsVarScalar(elPtr) && (elPtr->value.objPtr != NULL)) {
objPtr = elPtr->value.objPtr;
TclDecrRefCount(objPtr);
TclSetVarUndefined(elPtr);
}
elPtr->id.hPtr = NULL;
elPtr->flags &= ~VAR_DIRECT_WRITABLE;
/*
* Note that an array element is never a short variable.
*/
if (elPtr->tracePtr != NULL) {
elPtr->flags &= ~VAR_TRACE_ACTIVE;
TclCallVarTraces(iPtr, (Var *) NULL, elPtr, arrayName,
Tcl_GetHashKey(varPtr->value.tablePtr, hPtr), flags,
/* leaveErrMsg */ 0);
while (elPtr->tracePtr != NULL) {
VarTrace *tracePtr = elPtr->tracePtr;
elPtr->tracePtr = tracePtr->nextPtr;
Tcl_EventuallyFree((ClientData) tracePtr,TCL_DYNAMIC);
}
for (activePtr = iPtr->activeVarTracePtr; activePtr != NULL;
activePtr = activePtr->nextPtr) {
if (activePtr->varPtr == elPtr) {
activePtr->nextTracePtr = NULL;
}
}
}
TclSetVarUndefined(elPtr);
/*
* Even though array elements are not supposed to be namespace
* variables, some combinations of [upvar] and [variable] may
* create such beasts - see [Bug 604239]. This is necessary to
* avoid leaking the corresponding Var struct, and is otherwise
* harmless.
*/
if (TclIsVarNamespaceVar(elPtr)) {
TclClearVarNamespaceVar(elPtr);
elPtr->refCount--;
}
if (elPtr->refCount == 0) {
/* element Vars are VAR_IN_HASHTABLE */
TclFreeObjStorage((Tcl_Obj *)elPtr);
}
}
Tcl_DeleteHashTable(varPtr->value.tablePtr);
ckfree((char *) varPtr->value.tablePtr);
}
/*
|
| ︙ | ︙ | |||
4484 4485 4486 4487 4488 4489 4490 |
TclCleanupVar(varPtr, arrayPtr)
Var *varPtr; /* Pointer to variable that may be a
* candidate for being expunged. */
Var *arrayPtr; /* Array that contains the variable, or
* NULL if this variable isn't an array
* element. */
{
| > | | | | | | | | | 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 |
TclCleanupVar(varPtr, arrayPtr)
Var *varPtr; /* Pointer to variable that may be a
* candidate for being expunged. */
Var *arrayPtr; /* Array that contains the variable, or
* NULL if this variable isn't an array
* element. */
{
if (!TclIsVarShort(varPtr)
&& TclIsVarUndefined(varPtr) && (varPtr->refCount == 0)
&& (varPtr->tracePtr == NULL)
&& (varPtr->flags & VAR_IN_HASHTABLE)) {
if (varPtr->id.hPtr != NULL) {
Tcl_DeleteHashEntry(varPtr->id.hPtr);
}
TclFreeObjStorage((Tcl_Obj *)varPtr);
}
if (arrayPtr && !TclIsVarShort(arrayPtr)) {
if (TclIsVarUndefined(arrayPtr) && (arrayPtr->refCount == 0)
&& (arrayPtr->tracePtr == NULL)
&& (arrayPtr->flags & VAR_IN_HASHTABLE)) {
if (arrayPtr->id.hPtr != NULL) {
Tcl_DeleteHashEntry(arrayPtr->id.hPtr);
}
TclFreeObjStorage((Tcl_Obj *)arrayPtr);
}
}
}
/*
*----------------------------------------------------------------------
*
* TclVarErrMsg --
|
| ︙ | ︙ | |||
4584 4585 4586 4587 4588 4589 4590 |
static void
DupLocalVarName(srcPtr, dupPtr)
Tcl_Obj *srcPtr;
Tcl_Obj *dupPtr;
{
dupPtr->internalRep.longValue = srcPtr->internalRep.longValue;
| | | 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 |
static void
DupLocalVarName(srcPtr, dupPtr)
Tcl_Obj *srcPtr;
Tcl_Obj *dupPtr;
{
dupPtr->internalRep.longValue = srcPtr->internalRep.longValue;
dupPtr->typePtr = &localVarNameType;
}
#if ENABLE_NS_VARNAME_CACHING
/*
* nsVarName -
*
* INTERNALREP DEFINITION:
|
| ︙ | ︙ | |||
4706 4707 4708 4709 4710 4711 4712 |
p += len1;
*p++ = '(';
memcpy(p, part2, (unsigned int) len2);
p += len2;
*p++ = ')';
*p = '\0';
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 |
p += len1;
*p++ = '(';
memcpy(p, part2, (unsigned int) len2);
p += len2;
*p++ = ')';
*p = '\0';
}
/*
*----------------------------------------------------------------------
*
* TclExtendVar --
*
* Creates a new heap allocated Var struct, and links the ShortVar
* argument to it. This is called when a ShortVar is traced or searched
* for the first time, and remains alive as long as the original ShortVar
* is in existence. All properties are copied from the argument to the
* new struct.
*
* Results:
* The return value is a pointer to the new variable structure,
* initialised to hold the same contents as the argument.
*
* Side effects:
* Storage gets allocated. The argument ShortVar is transformed to be a
* link to the new Var.
*
*----------------------------------------------------------------------
*/
Var *
TclExtendVar(oldPtr)
Var *oldPtr;
{
Var *newPtr;
if (!TclIsVarShort(oldPtr)) {
return oldPtr;
}
newPtr = NewVar();
newPtr->flags = (oldPtr->flags & ~VAR_SHORT)|VAR_EXTENSION;
newPtr->value = oldPtr->value;
newPtr->id.shortPtr = oldPtr;
newPtr->refCount = 1; /* new link! */
TclSetVarLink(oldPtr);
oldPtr->value.linkPtr = newPtr;
return newPtr;
}
|
Added generic/tommath.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#ifndef BN_H_
#define BN_H_
#ifdef TCL_TOMMATH
#include <tclTomMath.h>
#endif
#ifndef TOMMATH_STORAGE_CLASS
#define TOMMATH_STORAGE_CLASS extern
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include <tommath_class.h>
#undef MIN
#define MIN(x,y) ((x)<(y)?(x):(y))
#undef MAX
#define MAX(x,y) ((x)>(y)?(x):(y))
#ifdef __cplusplus
extern "C" {
/* C++ compilers don't like assigning void * to mp_digit * */
#define OPT_CAST(x) (x *)
#else
/* C on the other hand doesn't care */
#define OPT_CAST(x)
#endif
/* detect 64-bit mode if possible */
#if defined(__x86_64__)
#if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT))
#define MP_64BIT
#endif
#endif
/* some default configurations.
*
* A "mp_digit" must be able to hold DIGIT_BIT + 1 bits
* A "mp_word" must be able to hold 2*DIGIT_BIT + 1 bits
*
* At the very least a mp_digit must be able to hold 7 bits
* [any size beyond that is ok provided it doesn't overflow the data type]
*/
#ifdef MP_8BIT
#ifndef MP_DIGIT_DECLARED
typedef unsigned char mp_digit;
#define MP_DIGIT_DECLARED
#endif
typedef unsigned short mp_word;
#elif defined(MP_16BIT)
#ifndef MP_DIGIT_DECLARED
typedef unsigned short mp_digit;
#define MP_DIGIT_DECLARED
#endif
typedef unsigned long mp_word;
#elif defined(MP_64BIT)
/* for GCC only on supported platforms */
#ifndef CRYPT
typedef unsigned long long ulong64;
typedef signed long long long64;
#endif
#ifndef MP_DIGIT_DECLARED
typedef unsigned long mp_digit;
#define MP_DIGIT_DECLARED
#endif
typedef unsigned long mp_word __attribute__ ((mode(TI)));
#define DIGIT_BIT 60
#else
/* this is the default case, 28-bit digits */
/* this is to make porting into LibTomCrypt easier :-) */
#ifndef CRYPT
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ulong64;
typedef signed __int64 long64;
#else
typedef unsigned long long ulong64;
typedef signed long long long64;
#endif
#endif
#ifndef MP_DIGIT_DECLARED
typedef unsigned long mp_digit;
#define MP_DIGIT_DECLARED
#endif
typedef ulong64 mp_word;
#ifdef MP_31BIT
/* this is an extension that uses 31-bit digits */
#define DIGIT_BIT 31
#else
/* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */
#define DIGIT_BIT 28
#define MP_28BIT
#endif
#endif
/* define heap macros */
#ifndef CRYPT
/* default to libc stuff */
#ifndef XMALLOC
#define XMALLOC malloc
#define XFREE free
#define XREALLOC realloc
#define XCALLOC calloc
#else
/* prototypes for our heap functions */
extern void *XMALLOC(size_t n);
extern void *REALLOC(void *p, size_t n);
extern void *XCALLOC(size_t n, size_t s);
extern void XFREE(void *p);
#endif
#endif
/* otherwise the bits per digit is calculated automatically from the size of a mp_digit */
#ifndef DIGIT_BIT
#define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */
#endif
#define MP_DIGIT_BIT DIGIT_BIT
#define MP_MASK ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))
#define MP_DIGIT_MAX MP_MASK
/* equalities */
#define MP_LT -1 /* less than */
#define MP_EQ 0 /* equal to */
#define MP_GT 1 /* greater than */
#define MP_ZPOS 0 /* positive integer */
#define MP_NEG 1 /* negative */
#define MP_OKAY 0 /* ok result */
#define MP_MEM -2 /* out of mem */
#define MP_VAL -3 /* invalid input */
#define MP_RANGE MP_VAL
#define MP_YES 1 /* yes response */
#define MP_NO 0 /* no response */
/* Primality generation flags */
#define LTM_PRIME_BBS 0x0001 /* BBS style prime */
#define LTM_PRIME_SAFE 0x0002 /* Safe prime (p-1)/2 == prime */
#define LTM_PRIME_2MSB_OFF 0x0004 /* force 2nd MSB to 0 */
#define LTM_PRIME_2MSB_ON 0x0008 /* force 2nd MSB to 1 */
typedef int mp_err;
/* you'll have to tune these... */
extern int KARATSUBA_MUL_CUTOFF,
KARATSUBA_SQR_CUTOFF,
TOOM_MUL_CUTOFF,
TOOM_SQR_CUTOFF;
/* define this to use lower memory usage routines (exptmods mostly) */
/* #define MP_LOW_MEM */
/* default precision */
#ifndef MP_PREC
#ifndef MP_LOW_MEM
#define MP_PREC 64 /* default digits of precision */
#else
#define MP_PREC 8 /* default digits of precision */
#endif
#endif
/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
#define MP_WARRAY (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))
/* the infamous mp_int structure */
#ifndef MP_INT_DECLARED
#define MP_INT_DECLARED
typedef struct mp_int mp_int;
#endif
struct mp_int {
int used, alloc, sign;
mp_digit *dp;
};
/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */
typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);
#define USED(m) ((m)->used)
#define DIGIT(m,k) ((m)->dp[(k)])
#define SIGN(m) ((m)->sign)
/* error code to char* string */
TOMMATH_STORAGE_CLASS char *mp_error_to_string(int code);
/* ---> init and deinit bignum functions <--- */
/* init a bignum */
TOMMATH_STORAGE_CLASS int mp_init(mp_int *a);
/* free a bignum */
TOMMATH_STORAGE_CLASS void mp_clear(mp_int *a);
/* init a null terminated series of arguments */
TOMMATH_STORAGE_CLASS int mp_init_multi(mp_int *mp, ...);
/* clear a null terminated series of arguments */
TOMMATH_STORAGE_CLASS void mp_clear_multi(mp_int *mp, ...);
/* exchange two ints */
TOMMATH_STORAGE_CLASS void mp_exch(mp_int *a, mp_int *b);
/* shrink ram required for a bignum */
TOMMATH_STORAGE_CLASS int mp_shrink(mp_int *a);
/* grow an int to a given size */
TOMMATH_STORAGE_CLASS int mp_grow(mp_int *a, int size);
/* init to a given number of digits */
TOMMATH_STORAGE_CLASS int mp_init_size(mp_int *a, int size);
/* ---> Basic Manipulations <--- */
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
#define mp_iseven(a) (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
#define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
/* set to zero */
TOMMATH_STORAGE_CLASS void mp_zero(mp_int *a);
/* set to a digit */
TOMMATH_STORAGE_CLASS void mp_set(mp_int *a, mp_digit b);
/* set a 32-bit const */
TOMMATH_STORAGE_CLASS int mp_set_int(mp_int *a, unsigned long b);
/* get a 32-bit value */
unsigned long mp_get_int(mp_int * a);
/* initialize and set a digit */
TOMMATH_STORAGE_CLASS int mp_init_set (mp_int * a, mp_digit b);
/* initialize and set 32-bit value */
TOMMATH_STORAGE_CLASS int mp_init_set_int (mp_int * a, unsigned long b);
/* copy, b = a */
TOMMATH_STORAGE_CLASS int mp_copy(mp_int *a, mp_int *b);
/* inits and copies, a = b */
TOMMATH_STORAGE_CLASS int mp_init_copy(mp_int *a, mp_int *b);
/* trim unused digits */
TOMMATH_STORAGE_CLASS void mp_clamp(mp_int *a);
/* ---> digit manipulation <--- */
/* right shift by "b" digits */
TOMMATH_STORAGE_CLASS void mp_rshd(mp_int *a, int b);
/* left shift by "b" digits */
TOMMATH_STORAGE_CLASS int mp_lshd(mp_int *a, int b);
/* c = a / 2**b */
TOMMATH_STORAGE_CLASS int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d);
/* b = a/2 */
TOMMATH_STORAGE_CLASS int mp_div_2(mp_int *a, mp_int *b);
/* c = a * 2**b */
TOMMATH_STORAGE_CLASS int mp_mul_2d(mp_int *a, int b, mp_int *c);
/* b = a*2 */
TOMMATH_STORAGE_CLASS int mp_mul_2(mp_int *a, mp_int *b);
/* c = a mod 2**d */
TOMMATH_STORAGE_CLASS int mp_mod_2d(mp_int *a, int b, mp_int *c);
/* computes a = 2**b */
TOMMATH_STORAGE_CLASS int mp_2expt(mp_int *a, int b);
/* Counts the number of lsbs which are zero before the first zero bit */
TOMMATH_STORAGE_CLASS int mp_cnt_lsb(mp_int *a);
/* I Love Earth! */
/* makes a pseudo-random int of a given size */
TOMMATH_STORAGE_CLASS int mp_rand(mp_int *a, int digits);
/* ---> binary operations <--- */
/* c = a XOR b */
TOMMATH_STORAGE_CLASS int mp_xor(mp_int *a, mp_int *b, mp_int *c);
/* c = a OR b */
TOMMATH_STORAGE_CLASS int mp_or(mp_int *a, mp_int *b, mp_int *c);
/* c = a AND b */
TOMMATH_STORAGE_CLASS int mp_and(mp_int *a, mp_int *b, mp_int *c);
/* ---> Basic arithmetic <--- */
/* b = -a */
TOMMATH_STORAGE_CLASS int mp_neg(mp_int *a, mp_int *b);
/* b = |a| */
TOMMATH_STORAGE_CLASS int mp_abs(mp_int *a, mp_int *b);
/* compare a to b */
TOMMATH_STORAGE_CLASS int mp_cmp(mp_int *a, mp_int *b);
/* compare |a| to |b| */
TOMMATH_STORAGE_CLASS int mp_cmp_mag(mp_int *a, mp_int *b);
/* c = a + b */
TOMMATH_STORAGE_CLASS int mp_add(mp_int *a, mp_int *b, mp_int *c);
/* c = a - b */
TOMMATH_STORAGE_CLASS int mp_sub(mp_int *a, mp_int *b, mp_int *c);
/* c = a * b */
TOMMATH_STORAGE_CLASS int mp_mul(mp_int *a, mp_int *b, mp_int *c);
/* b = a*a */
TOMMATH_STORAGE_CLASS int mp_sqr(mp_int *a, mp_int *b);
/* a/b => cb + d == a */
TOMMATH_STORAGE_CLASS int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
/* c = a mod b, 0 <= c < b */
TOMMATH_STORAGE_CLASS int mp_mod(mp_int *a, mp_int *b, mp_int *c);
/* ---> single digit functions <--- */
/* compare against a single digit */
TOMMATH_STORAGE_CLASS int mp_cmp_d(mp_int *a, mp_digit b);
/* c = a + b */
TOMMATH_STORAGE_CLASS int mp_add_d(mp_int *a, mp_digit b, mp_int *c);
/* c = a - b */
TOMMATH_STORAGE_CLASS int mp_sub_d(mp_int *a, mp_digit b, mp_int *c);
/* c = a * b */
TOMMATH_STORAGE_CLASS int mp_mul_d(mp_int *a, mp_digit b, mp_int *c);
/* a/b => cb + d == a */
TOMMATH_STORAGE_CLASS int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d);
/* a/3 => 3c + d == a */
TOMMATH_STORAGE_CLASS int mp_div_3(mp_int *a, mp_int *c, mp_digit *d);
/* c = a**b */
TOMMATH_STORAGE_CLASS int mp_expt_d(mp_int *a, mp_digit b, mp_int *c);
/* c = a mod b, 0 <= c < b */
TOMMATH_STORAGE_CLASS int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c);
/* ---> number theory <--- */
/* d = a + b (mod c) */
TOMMATH_STORAGE_CLASS int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
/* d = a - b (mod c) */
TOMMATH_STORAGE_CLASS int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
/* d = a * b (mod c) */
TOMMATH_STORAGE_CLASS int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
/* c = a * a (mod b) */
TOMMATH_STORAGE_CLASS int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c);
/* c = 1/a (mod b) */
TOMMATH_STORAGE_CLASS int mp_invmod(mp_int *a, mp_int *b, mp_int *c);
/* c = (a, b) */
TOMMATH_STORAGE_CLASS int mp_gcd(mp_int *a, mp_int *b, mp_int *c);
/* produces value such that U1*a + U2*b = U3 */
TOMMATH_STORAGE_CLASS int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3);
/* c = [a, b] or (a*b)/(a, b) */
TOMMATH_STORAGE_CLASS int mp_lcm(mp_int *a, mp_int *b, mp_int *c);
/* finds one of the b'th root of a, such that |c|**b <= |a|
*
* returns error if a < 0 and b is even
*/
TOMMATH_STORAGE_CLASS int mp_n_root(mp_int *a, mp_digit b, mp_int *c);
/* special sqrt algo */
TOMMATH_STORAGE_CLASS int mp_sqrt(mp_int *arg, mp_int *ret);
/* is number a square? */
TOMMATH_STORAGE_CLASS int mp_is_square(mp_int *arg, int *ret);
/* computes the jacobi c = (a | n) (or Legendre if b is prime) */
TOMMATH_STORAGE_CLASS int mp_jacobi(mp_int *a, mp_int *n, int *c);
/* used to setup the Barrett reduction for a given modulus b */
TOMMATH_STORAGE_CLASS int mp_reduce_setup(mp_int *a, mp_int *b);
/* Barrett Reduction, computes a (mod b) with a precomputed value c
*
* Assumes that 0 < a <= b*b, note if 0 > a > -(b*b) then you can merely
* compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code].
*/
TOMMATH_STORAGE_CLASS int mp_reduce(mp_int *a, mp_int *b, mp_int *c);
/* setups the montgomery reduction */
TOMMATH_STORAGE_CLASS int mp_montgomery_setup(mp_int *a, mp_digit *mp);
/* computes a = B**n mod b without division or multiplication useful for
* normalizing numbers in a Montgomery system.
*/
TOMMATH_STORAGE_CLASS int mp_montgomery_calc_normalization(mp_int *a, mp_int *b);
/* computes x/R == x (mod N) via Montgomery Reduction */
TOMMATH_STORAGE_CLASS int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp);
/* returns 1 if a is a valid DR modulus */
TOMMATH_STORAGE_CLASS int mp_dr_is_modulus(mp_int *a);
/* sets the value of "d" required for mp_dr_reduce */
TOMMATH_STORAGE_CLASS void mp_dr_setup(mp_int *a, mp_digit *d);
/* reduces a modulo b using the Diminished Radix method */
TOMMATH_STORAGE_CLASS int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp);
/* returns true if a can be reduced with mp_reduce_2k */
TOMMATH_STORAGE_CLASS int mp_reduce_is_2k(mp_int *a);
/* determines k value for 2k reduction */
TOMMATH_STORAGE_CLASS int mp_reduce_2k_setup(mp_int *a, mp_digit *d);
/* reduces a modulo b where b is of the form 2**p - k [0 <= a] */
TOMMATH_STORAGE_CLASS int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d);
/* d = a**b (mod c) */
TOMMATH_STORAGE_CLASS int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
/* ---> Primes <--- */
/* number of primes */
#ifdef MP_8BIT
#define PRIME_SIZE 31
#else
#define PRIME_SIZE 256
#endif
/* table of first PRIME_SIZE primes */
extern const mp_digit ltm_prime_tab[];
/* result=1 if a is divisible by one of the first PRIME_SIZE primes */
TOMMATH_STORAGE_CLASS int mp_prime_is_divisible(mp_int *a, int *result);
/* performs one Fermat test of "a" using base "b".
* Sets result to 0 if composite or 1 if probable prime
*/
TOMMATH_STORAGE_CLASS int mp_prime_fermat(mp_int *a, mp_int *b, int *result);
/* performs one Miller-Rabin test of "a" using base "b".
* Sets result to 0 if composite or 1 if probable prime
*/
TOMMATH_STORAGE_CLASS int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result);
/* This gives [for a given bit size] the number of trials required
* such that Miller-Rabin gives a prob of failure lower than 2^-96
*/
TOMMATH_STORAGE_CLASS int mp_prime_rabin_miller_trials(int size);
/* performs t rounds of Miller-Rabin on "a" using the first
* t prime bases. Also performs an initial sieve of trial
* division. Determines if "a" is prime with probability
* of error no more than (1/4)**t.
*
* Sets result to 1 if probably prime, 0 otherwise
*/
TOMMATH_STORAGE_CLASS int mp_prime_is_prime(mp_int *a, int t, int *result);
/* finds the next prime after the number "a" using "t" trials
* of Miller-Rabin.
*
* bbs_style = 1 means the prime must be congruent to 3 mod 4
*/
TOMMATH_STORAGE_CLASS int mp_prime_next_prime(mp_int *a, int t, int bbs_style);
/* makes a truly random prime of a given size (bytes),
* call with bbs = 1 if you want it to be congruent to 3 mod 4
*
* You have to supply a callback which fills in a buffer with random bytes. "dat" is a parameter you can
* have passed to the callback (e.g. a state or something). This function doesn't use "dat" itself
* so it can be NULL
*
* The prime generated will be larger than 2^(8*size).
*/
#define mp_prime_random(a, t, size, bbs, cb, dat) mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat)
/* makes a truly random prime of a given size (bits),
*
* Flags are as follows:
*
* LTM_PRIME_BBS - make prime congruent to 3 mod 4
* LTM_PRIME_SAFE - make sure (p-1)/2 is prime as well (implies LTM_PRIME_BBS)
* LTM_PRIME_2MSB_OFF - make the 2nd highest bit zero
* LTM_PRIME_2MSB_ON - make the 2nd highest bit one
*
* You have to supply a callback which fills in a buffer with random bytes. "dat" is a parameter you can
* have passed to the callback (e.g. a state or something). This function doesn't use "dat" itself
* so it can be NULL
*
*/
TOMMATH_STORAGE_CLASS int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat);
/* ---> radix conversion <--- */
TOMMATH_STORAGE_CLASS int mp_count_bits(mp_int *a);
TOMMATH_STORAGE_CLASS int mp_unsigned_bin_size(mp_int *a);
TOMMATH_STORAGE_CLASS int mp_read_unsigned_bin(mp_int *a, unsigned char *b, int c);
TOMMATH_STORAGE_CLASS int mp_to_unsigned_bin(mp_int *a, unsigned char *b);
TOMMATH_STORAGE_CLASS int mp_signed_bin_size(mp_int *a);
TOMMATH_STORAGE_CLASS int mp_read_signed_bin(mp_int *a, unsigned char *b, int c);
TOMMATH_STORAGE_CLASS int mp_to_signed_bin(mp_int *a, unsigned char *b);
TOMMATH_STORAGE_CLASS int mp_read_radix(mp_int *a, const char *str, int radix);
TOMMATH_STORAGE_CLASS int mp_toradix(mp_int *a, char *str, int radix);
TOMMATH_STORAGE_CLASS int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen);
TOMMATH_STORAGE_CLASS int mp_radix_size(mp_int *a, int radix, int *size);
TOMMATH_STORAGE_CLASS int mp_fread(mp_int *a, int radix, FILE *stream);
TOMMATH_STORAGE_CLASS int mp_fwrite(mp_int *a, int radix, FILE *stream);
#define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len))
#define mp_raw_size(mp) mp_signed_bin_size(mp)
#define mp_toraw(mp, str) mp_to_signed_bin((mp), (str))
#define mp_read_mag(mp, str, len) mp_read_unsigned_bin((mp), (str), (len))
#define mp_mag_size(mp) mp_unsigned_bin_size(mp)
#define mp_tomag(mp, str) mp_to_unsigned_bin((mp), (str))
#define mp_tobinary(M, S) mp_toradix((M), (S), 2)
#define mp_tooctal(M, S) mp_toradix((M), (S), 8)
#define mp_todecimal(M, S) mp_toradix((M), (S), 10)
#define mp_tohex(M, S) mp_toradix((M), (S), 16)
/* lowlevel functions, do not call! */
TOMMATH_STORAGE_CLASS int s_mp_add(mp_int *a, mp_int *b, mp_int *c);
TOMMATH_STORAGE_CLASS int s_mp_sub(mp_int *a, mp_int *b, mp_int *c);
#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
TOMMATH_STORAGE_CLASS int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs);
TOMMATH_STORAGE_CLASS int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs);
TOMMATH_STORAGE_CLASS int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs);
TOMMATH_STORAGE_CLASS int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs);
TOMMATH_STORAGE_CLASS int fast_s_mp_sqr(mp_int *a, mp_int *b);
TOMMATH_STORAGE_CLASS int s_mp_sqr(mp_int *a, mp_int *b);
TOMMATH_STORAGE_CLASS int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c);
TOMMATH_STORAGE_CLASS int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c);
TOMMATH_STORAGE_CLASS int mp_karatsuba_sqr(mp_int *a, mp_int *b);
TOMMATH_STORAGE_CLASS int mp_toom_sqr(mp_int *a, mp_int *b);
TOMMATH_STORAGE_CLASS int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c);
TOMMATH_STORAGE_CLASS int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c);
TOMMATH_STORAGE_CLASS int fast_mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp);
TOMMATH_STORAGE_CLASS int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int mode);
TOMMATH_STORAGE_CLASS int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y);
TOMMATH_STORAGE_CLASS void bn_reverse(unsigned char *s, int len);
extern const char *mp_s_rmap;
#ifdef __cplusplus
}
#endif
#endif
|
Changes to library/auto.tcl.
1 2 3 4 5 | # auto.tcl -- # # utility procs formerly in init.tcl dealing with auto execution # of commands and can be auto loaded themselves. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # auto.tcl -- # # utility procs formerly in init.tcl dealing with auto execution # of commands and can be auto loaded themselves. # # RCS: @(#) $Id: auto.tcl,v 1.23.2.1 2005/06/13 01:46:36 msofer Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1998 Sun Microsystems, Inc. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # |
| ︙ | ︙ |
Changes to library/clock.tcl.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | # #---------------------------------------------------------------------- # # Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #---------------------------------------------------------------------- # # Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: clock.tcl,v 1.13.2.1 2005/06/13 01:46:37 msofer Exp $ # #---------------------------------------------------------------------- # We must have message catalogs that support the root locale, and # we need access to the Registry on Windows systems. We also need # Tcl 8.5 dictionaries. |
| ︙ | ︙ | |||
78 79 80 81 82 83 84 85 86 |
namespace export add
# Import the message catalog commands that we use.
namespace import ::msgcat::mcload
namespace import ::msgcat::mclocale
# Define the Greenwich time zone
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 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 |
namespace export add
# Import the message catalog commands that we use.
namespace import ::msgcat::mcload
namespace import ::msgcat::mclocale
}
#----------------------------------------------------------------------
#
# ::tcl::clock::Initialize --
#
# Finish initializing the 'clock' subsystem
#
# Results:
# None.
#
# Side effects:
# Namespace variable in the 'clock' subsystem are initialized.
#
# The '::tcl::clock::Initialize' procedure initializes the namespace
# variables and root locale message catalog for the 'clock' subsystem.
# It is broken into a procedure rather than simply evaluated as a script
# so that it will be able to use local variables, avoiding the dangers
# of 'creative writing' as in Bug 1185933.
#
#----------------------------------------------------------------------
proc ::tcl::clock::Initialize {} {
rename ::tcl::clock::Initialize {}
variable LibDir
# Define the Greenwich time zone
proc InitTZData {} {
variable TZData
array unset TZData
set TZData(:Etc/GMT) {
{-9223372036854775808 0 0 GMT}
}
set TZData(:GMT) $TZData(:Etc/GMT)
set TZData(:Etc/UTC) {
{-9223372036854775808 0 0 UTC}
}
set TZData(:UTC) $TZData(:Etc/UTC)
}
InitTZData
# Define the message catalog for the root locale.
::msgcat::mcmset {} {
AM {am}
BCE {B.C.E.}
CE {C.E.}
|
| ︙ | ︙ | |||
223 224 225 226 227 228 229 |
#
#------------------------------------------------------------------
# Paths at which binary time zone data for the Olson libraries
# are known to reside on various operating systems
variable ZoneinfoPaths {}
| < < < | | | | | | | | | | < < | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
#
#------------------------------------------------------------------
# Paths at which binary time zone data for the Olson libraries
# are known to reside on various operating systems
variable ZoneinfoPaths {}
foreach path {
/usr/share/zoneinfo
/usr/share/lib/zoneinfo
/usr/local/etc/zoneinfo
C:/Progra~1/cygwin/usr/local/etc/zoneinfo
} {
if { [file isdirectory $path] } {
lappend ZoneinfoPaths $path
}
}
# Define the directories for time zone data and message catalogs.
variable DataDir [file join $LibDir tzdata]
variable MsgDir [file join $LibDir msgs]
# Number of days in the months, in common years and leap years.
|
| ︙ | ︙ | |||
260 261 262 263 264 265 266 |
foreach j $DaysInRomanMonthInCommonYear {
lappend DaysInPriorMonthsInCommonYear [incr i $j]
}
set i 0
foreach j $DaysInRomanMonthInLeapYear {
lappend DaysInPriorMonthsInLeapYear [incr i $j]
}
| < | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
foreach j $DaysInRomanMonthInCommonYear {
lappend DaysInPriorMonthsInCommonYear [incr i $j]
}
set i 0
foreach j $DaysInRomanMonthInLeapYear {
lappend DaysInPriorMonthsInLeapYear [incr i $j]
}
# Another epoch (Hi, Jeff!)
variable Roddenberry 1946
# Integer ranges
|
| ︙ | ︙ | |||
594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
# if it is known.
variable TZData; # Array whose keys are time zone names
# and whose values are lists of quads
# comprising start time, UTC offset,
# Daylight Saving Time indicator, and
# time zone abbreviation.
}
#----------------------------------------------------------------------
#
# clock format --
#
# Formats a count of seconds since the Posix Epoch as a time
# of day.
| > | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
# if it is known.
variable TZData; # Array whose keys are time zone names
# and whose values are lists of quads
# comprising start time, UTC offset,
# Daylight Saving Time indicator, and
# time zone abbreviation.
}
::tcl::clock::Initialize
#----------------------------------------------------------------------
#
# clock format --
#
# Formats a count of seconds since the Posix Epoch as a time
# of day.
|
| ︙ | ︙ | |||
703 704 705 706 707 708 709 |
set date [GetYearWeekDay $date[set date {}]]
# Format the result
set state {}
set retval {}
foreach char [split $format {}] {
| | | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
set date [GetYearWeekDay $date[set date {}]]
# Format the result
set state {}
set retval {}
foreach char [split $format {}] {
switch -exact -- $state {
{} {
if { [string equal % $char] } {
set state percent
} else {
append retval $char
}
}
|
| ︙ | ︙ | |||
1300 1301 1302 1303 1304 1305 1306 |
-timezone $timezone -locale $locale]
}
# Do relative weekday
if { [llength $parseWeekday] > 0 } {
| < < < < | 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 |
-timezone $timezone -locale $locale]
}
# Do relative weekday
if { [llength $parseWeekday] > 0 } {
foreach {dayOrdinal dayOfWeek} $parseWeekday break
set date2 [GetJulianDay \
[ConvertUTCToLocal \
[dict create seconds $seconds] \
$timezone]]
dict set date2 era CE
set jdwkday [WeekdayOnOrBefore $dayOfWeek \
|
| ︙ | ︙ | |||
4407 4408 4409 4410 4411 4412 4413 |
proc ::tcl::clock::GetJulianDayFromEraYearMonthDay { date } {
variable DaysInPriorMonthsInCommonYear
variable DaysInPriorMonthsInLeapYear
# Get absolute year number from the civil year
| | | 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 |
proc ::tcl::clock::GetJulianDayFromEraYearMonthDay { date } {
variable DaysInPriorMonthsInCommonYear
variable DaysInPriorMonthsInLeapYear
# Get absolute year number from the civil year
switch -exact -- [dict get $date era] {
BCE {
set year [expr { 1 - [dict get $date year] }]
}
CE {
set year [dict get $date year]
}
}
|
| ︙ | ︙ | |||
4489 4490 4491 4492 4493 4494 4495 |
#
#----------------------------------------------------------------------
proc ::tcl::clock::GetJulianDayFromEraYearDay { date } {
# Get absolute year number from the civil year
| | | 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 |
#
#----------------------------------------------------------------------
proc ::tcl::clock::GetJulianDayFromEraYearDay { date } {
# Get absolute year number from the civil year
switch -exact -- [dict get $date era] {
BCE {
set year [expr { 1 - [dict get $date year] }]
}
CE {
set year [dict get $date year]
}
}
|
| ︙ | ︙ | |||
5038 5039 5040 5041 5042 5043 5044 |
foreach p [info procs [namespace current]::scanproc'*] {
rename $p {}
}
set LocaleNumeralCache {}
set McLoaded {}
catch {unset CachedSystemTimeZone}
| | | 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 |
foreach p [info procs [namespace current]::scanproc'*] {
rename $p {}
}
set LocaleNumeralCache {}
set McLoaded {}
catch {unset CachedSystemTimeZone}
InitTZData
}
|
Changes to library/http/http.tcl.
1 2 3 4 5 6 7 8 9 10 11 | # http.tcl -- # # Client-side HTTP for GET, POST, and HEAD commands. # These routines can be used in untrusted code that uses # the Safesock security policy. These procedures use a # callback interface to avoid using vwait, which is not # defined in the safe base. # # See the file "license.terms" for information on usage and # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # http.tcl -- # # Client-side HTTP for GET, POST, and HEAD commands. # These routines can be used in untrusted code that uses # the Safesock security policy. These procedures use a # callback interface to avoid using vwait, which is not # defined in the safe base. # # See the file "license.terms" for information on usage and # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: http.tcl,v 1.50.2.1 2005/06/13 01:46:37 msofer Exp $ # Rough version history: # 1.0 Old http_get interface # 2.0 http:: namespace and http::geturl # 2.1 Added callbacks to handle arriving data, and timeouts # 2.2 Added ability to fetch into a channel # 2.3 Added SSL support, and ability to post from a channel |
| ︙ | ︙ |
Changes to library/init.tcl.
1 2 3 4 5 | # init.tcl -- # # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # init.tcl -- # # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # # RCS: @(#) $Id: init.tcl,v 1.69.4.1 2005/06/13 01:46:37 msofer Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 Scriptics Corporation. # Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. # # See the file "license.terms" for information on usage and redistribution |
| ︙ | ︙ | |||
44 45 46 47 48 49 50 |
set auto_path $env(TCLLIBPATH)
} else {
set auto_path ""
}
}
namespace eval tcl {
variable Dir
| < | | | < | | | | > > > > > | > > > > > > > > > > > > > > > > > > > > > > | | | < | > > > | > | > > > > > | > | > > > > > > > > > > > > > > > > > > > > | 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 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 |
set auto_path $env(TCLLIBPATH)
} else {
set auto_path ""
}
}
namespace eval tcl {
variable Dir
foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
if {$Dir ni $::auto_path} {
lappend ::auto_path $Dir
}
}
set Dir [file join [file dirname [file dirname \
[info nameofexecutable]]] lib]
if {$Dir ni $::auto_path} {
lappend ::auto_path $Dir
}
catch {
foreach Dir $::tcl_pkgPath {
if {$Dir ni $::auto_path} {
lappend ::auto_path $Dir
}
}
}
variable Path [unsupported::EncodingDirs]
set Dir [file join $::tcl_library encoding]
if {$Dir ni $Path} {
lappend Path $Dir
unsupported::EncodingDirs $Path
}
# Set up the 'chan' ensemble
namespace eval chan {
namespace ensemble create -command ::chan -map {
blocked ::fblocked
close ::close
configure ::fconfigure
copy ::fcopy
eof ::eof
event ::fileevent
flush ::flush
gets ::gets
names {::file channels}
puts ::puts
read ::read
seek ::seek
tell ::tell
truncate ::tcl::chan::Truncate
}
}
}
# Windows specific end of initialization
if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} {
namespace eval tcl {
proc EnvTraceProc {lo n1 n2 op} {
set x $::env($n2)
set ::env($lo) $x
set ::env([string toupper $lo]) $x
}
proc InitWinEnv {} {
global env tcl_platform
foreach p [array names env] {
set u [string toupper $p]
if {$u ne $p} {
switch -- $u {
COMSPEC -
PATH {
if {![info exists env($u)]} {
set env($u) $env($p)
}
trace variable env($p) w \
[namespace code [list EnvTraceProc $p]]
trace variable env($u) w \
[namespace code [list EnvTraceProc $p]]
}
}
}
}
if {![info exists env(COMSPEC)]} {
if {$tcl_platform(os) eq "Windows NT"} {
set env(COMSPEC) cmd.exe
} else {
set env(COMSPEC) command.com
}
}
}
InitWinEnv
}
}
# Setup the unknown package handler
if {[interp issafe]} {
package unknown ::tclPkgUnknown
} else {
# Set up search for Tcl Modules (TIP #189).
# and setup platform specific unknown package handlers
if {$::tcl_platform(os) eq "Darwin"
&& $::tcl_platform(platform) eq "unix"} {
package unknown {::tcl::tm::UnknownHandler \
{::tcl::MacOSXPkgUnknown ::tclPkgUnknown}}
} else {
package unknown {::tcl::tm::UnknownHandler ::tclPkgUnknown}
}
# Set up the 'clock' ensemble
namespace eval ::tcl::clock [list variable TclLibDir $::tcl_library]
proc clock args {
namespace eval ::tcl::clock [list namespace ensemble create -command \
[uplevel 1 [list namespace origin [lindex [info level 0] 0]]] \
-subcommands {
add clicks format microseconds milliseconds scan seconds
}]
# Auto-loading stubs for 'clock.tcl'
foreach cmd {add format scan} {
proc ::tcl::clock::$cmd args {
variable TclLibDir
source -encoding utf-8 [file join $TclLibDir clock.tcl]
return [uplevel 1 [info level 0]]
}
}
return [uplevel 1 [info level 0]]
}
}
# Conditionalize for presence of exec.
if {[llength [info commands exec]] == 0} {
|
| ︙ | ︙ | |||
255 256 257 258 259 260 261 |
if {$errorInfo ne "$einfo$expect"} {
error "Tcl bug: unexpected stack trace in \"unknown\"" {} \
[list CORE UNKNOWN BADTRACE $einfo $expect $errorInfo]
}
return -code error -errorcode $errorCode \
-errorinfo $einfo $msg
} else {
| > | | | | | | | | 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 |
if {$errorInfo ne "$einfo$expect"} {
error "Tcl bug: unexpected stack trace in \"unknown\"" {} \
[list CORE UNKNOWN BADTRACE $einfo $expect $errorInfo]
}
return -code error -errorcode $errorCode \
-errorinfo $einfo $msg
} else {
dict incr opts -level
return -options $opts $msg
}
}
}
if {([info level] == 1) && ([info script] eq "") \
&& [info exists tcl_interactive] && $tcl_interactive} {
if {![info exists auto_noexec]} {
set new [auto_execok $name]
if {$new != ""} {
set redir ""
if {[info commands console] eq ""} {
set redir ">&@stdout <@stdin"
}
return [uplevel 1 exec $redir $new [lrange $args 1 end]]
}
}
if {$name eq "!!"} {
set newcmd [history event]
} elseif {[regexp {^!(.+)$} $name dummy event]} {
set newcmd [history event $event]
} elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $name dummy old new]} {
set newcmd [history event -1]
catch {regsub -all -- $old $newcmd $new newcmd}
}
if {[info exists newcmd]} {
tclLog $newcmd
history change $newcmd 0
return [uplevel 1 $newcmd]
}
set ret [catch {set candidates [info commands $name*]} msg]
if {$name eq "::"} {
set name ""
}
if {$ret != 0} {
dict append opts -errorinfo \
"\n (expanding command prefix \"$name\" in unknown)"
return -options $opts $msg
}
# Filter out bogus matches when $name contained
# a glob-special char [Bug 946952]
set cmds [list]
foreach x $candidates {
if {[string range $x 0 [expr [string length $name]-1]] eq $name} {
lappend cmds $x
}
}
if {[llength $cmds] == 1} {
return [uplevel 1 [lreplace $args 0 0 [lindex $cmds 0]]]
}
if {[llength $cmds]} {
if {$name eq ""} {
return -code error "empty command name \"\""
} else {
return -code error \
"ambiguous command name \"$name\": [lsort $cmds]"
}
}
}
|
| ︙ | ︙ | |||
386 387 388 389 390 391 392 |
# Arguments:
# None.
proc auto_load_index {} {
variable ::tcl::auto_oldpath
global auto_index auto_path
| | < < | | | | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# Arguments:
# None.
proc auto_load_index {} {
variable ::tcl::auto_oldpath
global auto_index auto_path
if {[info exists auto_oldpath] && ($auto_oldpath eq $auto_path)} {
return 0
}
set auto_oldpath $auto_path
# Check if we are a safe interpreter. In that case, we support only
# newer format tclIndex files.
set issafe [interp issafe]
for {set i [expr {[llength $auto_path] - 1}]} {$i >= 0} {incr i -1} {
set dir [lindex $auto_path $i]
set f ""
if {$issafe} {
catch {source [file join $dir tclIndex]}
} elseif {[catch {set f [open [file join $dir tclIndex]]}]} {
continue
} else {
set error [catch {
set id [gets $f]
if {$id eq "# Tcl autoload index file, version 2.0"} {
eval [read $f]
} elseif {$id eq "# Tcl autoload index file: each line identifies a Tcl"]} {
while {[gets $f line] >= 0} {
if {([string index $line 0] eq "#") \
|| ([llength $line] != 2)} {
continue
}
set name [lindex $line 0]
set auto_index($name) \
"source [file join $dir [lindex $line 1]]"
}
|
| ︙ | ︙ | |||
476 477 478 479 480 481 482 |
}
}
# Potentially returning 2 elements to try :
# (if the current namespace is not the global one)
if {$n == 0} {
| | | | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
}
}
# Potentially returning 2 elements to try :
# (if the current namespace is not the global one)
if {$n == 0} {
if {$namespace eq "::"} {
# ( nocolons , :: ) -> nocolons
return [list $cmd]
} else {
# ( nocolons , ::sub ) -> ::sub::nocolons nocolons
return [list ${namespace}::$cmd $cmd]
}
} elseif {$namespace eq "::"} {
# ( foo::bar , :: ) -> ::foo::bar
return [list ::$cmd]
} else {
# ( foo::bar , ::sub ) -> ::sub::foo::bar ::foo::bar
return [list ${namespace}::$cmd ::$cmd]
}
}
|
| ︙ | ︙ | |||
538 539 540 541 542 543 544 | # Windows search path, or "" otherwise. Builds an associative # array auto_execs that caches information about previous checks, # for speed. # # Arguments: # name - Name of a command. | | | | | 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 |
# Windows search path, or "" otherwise. Builds an associative
# array auto_execs that caches information about previous checks,
# for speed.
#
# Arguments:
# name - Name of a command.
if {$tcl_platform(platform) eq "windows"} {
# Windows version.
#
# Note that info executable doesn't work under Windows, so we have to
# look for files with .exe, .com, or .bat extensions. Also, the path
# may be in the Path or PATH environment variables, and path
# components are separated with semicolons, not colons as under Unix.
#
proc auto_execok name {
global auto_execs env tcl_platform
if {[info exists auto_execs($name)]} {
return $auto_execs($name)
}
set auto_execs($name) ""
set shellBuiltins [list cls copy date del erase dir echo mkdir \
md rename ren rmdir rd time type ver vol]
if {$tcl_platform(os) eq "Windows NT"} {
# NT includes the 'start' built-in
lappend shellBuiltins "start"
}
if {[info exists env(PATHEXT)]} {
# Add an initial ; to have the {} extension check first.
set execExtensions [split ";$env(PATHEXT)" ";"]
} else {
set execExtensions [list {} .com .exe .bat]
}
if {$name in $shellBuiltins} {
# When this is command.com for some reason on Win2K, Tcl won't
# exec it unless the case is right, which this corrects. COMSPEC
# may not point to a real file, so do the check.
set cmd $env(COMSPEC)
if {[file exists $cmd]} {
set cmd [file attributes $cmd -shortname]
}
|
| ︙ | ︙ | |||
593 594 595 596 597 598 599 |
}
set path "[file dirname [info nameof]];.;"
if {[info exists env(WINDIR)]} {
set windir $env(WINDIR)
}
if {[info exists windir]} {
| | | | 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 |
}
set path "[file dirname [info nameof]];.;"
if {[info exists env(WINDIR)]} {
set windir $env(WINDIR)
}
if {[info exists windir]} {
if {$tcl_platform(os) eq "Windows NT"} {
append path "$windir/system32;"
}
append path "$windir/system;$windir;"
}
foreach var {PATH Path path} {
if {[info exists env($var)]} {
append path ";$env($var)"
}
}
foreach dir [split $path {;}] {
# Skip already checked directories
if {[info exists checked($dir)] || ($dir eq {})} { continue }
set checked($dir) {}
foreach ext $execExtensions {
set file [file join $dir ${name}${ext}]
if {[file exists $file] && ![file isdirectory $file]} {
return [set auto_execs($name) [list $file]]
}
}
|
| ︙ | ︙ | |||
636 637 638 639 640 641 642 |
if {[llength [file split $name]] != 1} {
if {[file executable $name] && ![file isdirectory $name]} {
set auto_execs($name) [list $name]
}
return $auto_execs($name)
}
foreach dir [split $env(PATH) :] {
| | | 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 |
if {[llength [file split $name]] != 1} {
if {[file executable $name] && ![file isdirectory $name]} {
set auto_execs($name) [list $name]
}
return $auto_execs($name)
}
foreach dir [split $env(PATH) :] {
if {$dir eq ""} {
set dir .
}
set file [file join $dir $name]
if {[file executable $file] && ![file isdirectory $file]} {
set auto_execs($name) [list $file]
return $auto_execs($name)
}
|
| ︙ | ︙ | |||
668 669 670 671 672 673 674 |
# action - "renaming" or "copying"
# src - source directory
# dest - destination directory
proc tcl::CopyDirectory {action src dest} {
set nsrc [file normalize $src]
set ndest [file normalize $dest]
| | | | | 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 |
# action - "renaming" or "copying"
# src - source directory
# dest - destination directory
proc tcl::CopyDirectory {action src dest} {
set nsrc [file normalize $src]
set ndest [file normalize $dest]
if {$action eq "renaming"} {
# Can't rename volumes. We could give a more precise
# error message here, but that would break the test suite.
if {$nsrc in [file volumes]} {
return -code error "error $action \"$src\" to\
\"$dest\": trying to rename a volume or move a directory\
into itself"
}
}
if {[file exists $dest]} {
if {$nsrc == $ndest} {
return -code error "error $action \"$src\" to\
\"$dest\": trying to rename a volume or move a directory\
into itself"
}
if {$action eq "copying"} {
# We used to throw an error here, but, looking more closely
# at the core copy code in tclFCmd.c, if the destination
# exists, then we should only call this function if -force
# is true, which means we just want to over-write. So,
# the following code is now commented out.
#
# return -code error "error $action \"$src\" to\
|
| ︙ | ︙ | |||
735 736 737 738 739 740 741 |
foreach s [lsort -unique $filelist] {
if {([file tail $s] != ".") && ([file tail $s] != "..")} {
file copy -force $s [file join $dest [file tail $s]]
}
}
return
}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 788 789 790 791 792 793 794 |
foreach s [lsort -unique $filelist] {
if {([file tail $s] != ".") && ([file tail $s] != "..")} {
file copy -force $s [file join $dest [file tail $s]]
}
}
return
}
|
Changes to library/parray.tcl.
1 2 3 | # parray: # Print the contents of a global array on stdout. # | | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# parray:
# Print the contents of a global array on stdout.
#
# RCS: @(#) $Id: parray.tcl,v 1.3.46.1 2005/06/13 01:46:37 msofer Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
proc parray {a {pattern *}} {
upvar 1 $a array
if {![array exists array]} {
error "\"$a\" isn't an array"
}
set maxl 0
set names [lsort [array names array $pattern]]
foreach name $names {
if {[string length $name] > $maxl} {
set maxl [string length $name]
}
}
set maxl [expr {$maxl + [string length $a] + 2}]
foreach name $names {
set nameString [format %s(%s) $a $name]
puts stdout [format "%-*s = %s" $maxl $nameString $array($name)]
}
}
|
Changes to library/tclIndex.
| ︙ | ︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 | set auto_index(::safe::Log) [list source [file join $dir safe.tcl]] set auto_index(::safe::CheckFileName) [list source [file join $dir safe.tcl]] set auto_index(::safe::AliasSource) [list source [file join $dir safe.tcl]] set auto_index(::safe::AliasLoad) [list source [file join $dir safe.tcl]] set auto_index(::safe::FileInAccessPath) [list source [file join $dir safe.tcl]] set auto_index(::safe::Subset) [list source [file join $dir safe.tcl]] set auto_index(::safe::AliasSubset) [list source [file join $dir safe.tcl]] set auto_index(tcl_wordBreakAfter) [list source [file join $dir word.tcl]] set auto_index(tcl_wordBreakBefore) [list source [file join $dir word.tcl]] set auto_index(tcl_endOfWord) [list source [file join $dir word.tcl]] set auto_index(tcl_startOfNextWord) [list source [file join $dir word.tcl]] set auto_index(tcl_startOfPreviousWord) [list source [file join $dir word.tcl]] | > > > > > > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | set auto_index(::safe::Log) [list source [file join $dir safe.tcl]] set auto_index(::safe::CheckFileName) [list source [file join $dir safe.tcl]] set auto_index(::safe::AliasSource) [list source [file join $dir safe.tcl]] set auto_index(::safe::AliasLoad) [list source [file join $dir safe.tcl]] set auto_index(::safe::FileInAccessPath) [list source [file join $dir safe.tcl]] set auto_index(::safe::Subset) [list source [file join $dir safe.tcl]] set auto_index(::safe::AliasSubset) [list source [file join $dir safe.tcl]] set auto_index(::safe::AliasEncoding) [list source [file join $dir safe.tcl]] set auto_index(tcl_wordBreakAfter) [list source [file join $dir word.tcl]] set auto_index(tcl_wordBreakBefore) [list source [file join $dir word.tcl]] set auto_index(tcl_endOfWord) [list source [file join $dir word.tcl]] set auto_index(tcl_startOfNextWord) [list source [file join $dir word.tcl]] set auto_index(tcl_startOfPreviousWord) [list source [file join $dir word.tcl]] set auto_index(::tcl::tm::add) [list source [file join $dir tm.tcl]] set auto_index(::tcl::tm::remove) [list source [file join $dir tm.tcl]] set auto_index(::tcl::tm::list) [list source [file join $dir tm.tcl]] set auto_index(::tcl::tm::UnknownHandler) [list source [file join $dir tm.tcl]] set auto_index(::tcl::tm::roots) [list source [file join $dir tm.tcl]] |
Changes to library/tcltest/tcltest.tcl.
| ︙ | ︙ | |||
12 13 14 15 16 17 18 | # # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2000 by Ajuba Solutions # Contributions from Don Porter, NIST, 2002. (not subject to US copyright) # All rights reserved. # | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# Copyright (c) 2000 by Ajuba Solutions
# Contributions from Don Porter, NIST, 2002. (not subject to US copyright)
# All rights reserved.
#
# RCS: @(#) $Id: tcltest.tcl,v 1.94.2.1 2005/06/13 01:46:37 msofer Exp $
package require Tcl 8.3 ;# uses [glob -directory]
namespace eval tcltest {
# When the version number changes, be sure to update the pkgIndex.tcl file,
# and the install directory in the Makefiles. When the minor version
# changes (new feature) be sure to update the man page as well.
|
| ︙ | ︙ |
Changes to library/tm.tcl.
| ︙ | ︙ | |||
358 359 360 361 362 363 364 |
return
}
# Initialization. Set up the default paths, then insert the new
# handler into the chain.
::tcl::tm::Defaults
| < | 358 359 360 361 362 363 364 |
return
}
# Initialization. Set up the default paths, then insert the new
# handler into the chain.
::tcl::tm::Defaults
|
Changes to library/tzdata/America/Boise.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Boise) {
{-9223372036854775808 -27889 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Boise) {
{-9223372036854775808 -27889 0 LMT}
{-2717640000 -28800 0 PST}
{-1633269600 -25200 1 PDT}
{-1615129200 -28800 0 PST}
{-1601820000 -25200 1 PDT}
{-1583679600 -28800 0 PST}
{-1471788000 -25200 0 MST}
{-880210800 -21600 1 MWT}
{-769395600 -21600 1 MPT}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Chicago.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Chicago) {
{-9223372036854775808 -21036 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Chicago) {
{-9223372036854775808 -21036 0 LMT}
{-2717647200 -21600 0 CST}
{-1633276800 -18000 1 CDT}
{-1615136400 -21600 0 CST}
{-1601827200 -18000 1 CDT}
{-1583686800 -21600 0 CST}
{-1577901600 -21600 0 CST}
{-1563724800 -18000 1 CDT}
{-1551632400 -21600 0 CST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Denver.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Denver) {
{-9223372036854775808 -25196 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Denver) {
{-9223372036854775808 -25196 0 LMT}
{-2717643600 -25200 0 MST}
{-1633273200 -21600 1 MDT}
{-1615132800 -25200 0 MST}
{-1601823600 -21600 1 MDT}
{-1583683200 -25200 0 MST}
{-1577898000 -25200 0 MST}
{-1570374000 -21600 1 MDT}
{-1551628800 -25200 0 MST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Indiana/Knox.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Indiana/Knox) {
{-9223372036854775808 -20790 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Indiana/Knox) {
{-9223372036854775808 -20790 0 LMT}
{-2717647200 -21600 0 CST}
{-1633276800 -18000 1 CDT}
{-1615136400 -21600 0 CST}
{-1601827200 -18000 1 CDT}
{-1583686800 -21600 0 CST}
{-880214400 -18000 1 CWT}
{-769395600 -18000 1 CPT}
{-765392400 -21600 0 CST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Indiana/Marengo.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Indiana/Marengo) {
{-9223372036854775808 -20723 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Indiana/Marengo) {
{-9223372036854775808 -20723 0 LMT}
{-2717647200 -21600 0 CST}
{-1633276800 -18000 1 CDT}
{-1615136400 -21600 0 CST}
{-1601827200 -18000 1 CDT}
{-1583686800 -21600 0 CST}
{-880214400 -18000 1 CWT}
{-769395600 -18000 1 CPT}
{-765392400 -21600 0 CST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Indiana/Vevay.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Indiana/Vevay) {
{-9223372036854775808 -20416 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Indiana/Vevay) {
{-9223372036854775808 -20416 0 LMT}
{-2717647200 -21600 0 CST}
{-1633276800 -18000 1 CDT}
{-1615136400 -21600 0 CST}
{-1601827200 -18000 1 CDT}
{-1583686800 -21600 0 CST}
{-880214400 -18000 1 CWT}
{-769395600 -18000 1 CPT}
{-765392400 -21600 0 CST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Indianapolis.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Indianapolis) {
{-9223372036854775808 -20678 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Indianapolis) {
{-9223372036854775808 -20678 0 LMT}
{-2717647200 -21600 0 CST}
{-1633276800 -18000 1 CDT}
{-1615136400 -21600 0 CST}
{-1601827200 -18000 1 CDT}
{-1583686800 -21600 0 CST}
{-1577901600 -21600 0 CST}
{-900259200 -18000 1 CDT}
{-891795600 -21600 0 CST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Kentucky/Monticello.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Kentucky/Monticello) {
{-9223372036854775808 -20364 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Kentucky/Monticello) {
{-9223372036854775808 -20364 0 LMT}
{-2717647200 -21600 0 CST}
{-1633276800 -18000 1 CDT}
{-1615136400 -21600 0 CST}
{-1601827200 -18000 1 CDT}
{-1583686800 -21600 0 CST}
{-880214400 -18000 1 CWT}
{-769395600 -18000 1 CPT}
{-765392400 -21600 0 CST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Los_Angeles.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Los_Angeles) {
{-9223372036854775808 -28378 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Los_Angeles) {
{-9223372036854775808 -28378 0 LMT}
{-2717640000 -28800 0 PST}
{-1633269600 -25200 1 PDT}
{-1615129200 -28800 0 PST}
{-1601820000 -25200 1 PDT}
{-1583679600 -28800 0 PST}
{-880207200 -25200 1 PWT}
{-769395600 -25200 1 PPT}
{-765385200 -28800 0 PST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Louisville.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Louisville) {
{-9223372036854775808 -20582 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Louisville) {
{-9223372036854775808 -20582 0 LMT}
{-2717647200 -21600 0 CST}
{-1633276800 -18000 1 CDT}
{-1615136400 -21600 0 CST}
{-1601827200 -18000 1 CDT}
{-1583686800 -21600 0 CST}
{-1546279200 -21600 0 CST}
{-1535904000 -18000 1 CDT}
{-1525280400 -21600 0 CST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Managua.
| ︙ | ︙ | |||
10 11 12 13 14 15 16 17 |
{299134800 -21600 0 CST}
{322034400 -18000 1 CDT}
{330584400 -21600 0 CST}
{694260000 -18000 1 CDT}
{717310800 -21600 0 CST}
{725882400 -18000 0 EST}
{912488400 -21600 0 CST}
}
| > > | 10 11 12 13 14 15 16 17 18 19 |
{299134800 -21600 0 CST}
{322034400 -18000 1 CDT}
{330584400 -21600 0 CST}
{694260000 -18000 1 CDT}
{717310800 -21600 0 CST}
{725882400 -18000 0 EST}
{912488400 -21600 0 CST}
{1113112800 -18000 1 CDT}
{1126414800 -21600 0 CST}
}
|
Changes to library/tzdata/America/Montevideo.
| ︙ | ︙ | |||
63 64 65 66 67 68 69 |
{656478000 -7200 1 UYST}
{667965600 -10800 0 UYT}
{688532400 -7200 1 UYST}
{699415200 -10800 0 UYT}
{719377200 -7200 1 UYST}
{730864800 -10800 0 UYT}
{1095562800 -7200 1 UYST}
| | | 63 64 65 66 67 68 69 70 71 |
{656478000 -7200 1 UYST}
{667965600 -10800 0 UYT}
{688532400 -7200 1 UYST}
{699415200 -10800 0 UYT}
{719377200 -7200 1 UYST}
{730864800 -10800 0 UYT}
{1095562800 -7200 1 UYST}
{1111896000 -10800 0 UYT}
}
|
Changes to library/tzdata/America/New_York.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/New_York) {
{-9223372036854775808 -17762 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/New_York) {
{-9223372036854775808 -17762 0 LMT}
{-2717650800 -18000 0 EST}
{-1633280400 -14400 1 EDT}
{-1615140000 -18000 0 EST}
{-1601830800 -14400 1 EDT}
{-1583690400 -18000 0 EST}
{-1577905200 -18000 0 EST}
{-1570381200 -14400 1 EDT}
{-1551636000 -18000 0 EST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/North_Dakota/Center.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/North_Dakota/Center) {
{-9223372036854775808 -24312 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/North_Dakota/Center) {
{-9223372036854775808 -24312 0 LMT}
{-2717643600 -25200 0 MST}
{-1633273200 -21600 1 MDT}
{-1615132800 -25200 0 MST}
{-1601823600 -21600 1 MDT}
{-1583683200 -25200 0 MST}
{-880210800 -21600 1 MWT}
{-769395600 -21600 1 MPT}
{-765388800 -25200 0 MST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Phoenix.
1 2 3 4 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Phoenix) {
{-9223372036854775808 -26898 0 LMT}
| | | 1 2 3 4 5 6 7 8 9 10 11 12 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:America/Phoenix) {
{-9223372036854775808 -26898 0 LMT}
{-2717643600 -25200 0 MST}
{-1633273200 -21600 1 MDT}
{-1615132800 -25200 0 MST}
{-1601823600 -21600 1 MDT}
{-1583683200 -25200 0 MST}
{-880210800 -21600 1 MWT}
{-820519140 -25200 0 MST}
{-796841940 -25200 0 MST}
|
| ︙ | ︙ |
Changes to library/tzdata/America/Port-au-Prince.
| ︙ | ︙ | |||
30 31 32 33 34 35 36 37 |
{783478800 -18000 0 EST}
{796784400 -14400 1 EDT}
{814928400 -18000 0 EST}
{828838800 -14400 1 EDT}
{846378000 -18000 0 EST}
{860288400 -14400 1 EDT}
{877827600 -18000 0 EST}
}
| > > | 30 31 32 33 34 35 36 37 38 39 |
{783478800 -18000 0 EST}
{796784400 -14400 1 EDT}
{814928400 -18000 0 EST}
{828838800 -14400 1 EDT}
{846378000 -18000 0 EST}
{860288400 -14400 1 EDT}
{877827600 -18000 0 EST}
{1112504400 -14400 1 EDT}
{1130644800 -18000 0 EST}
}
|
Changes to library/tzdata/Asia/Almaty.
| ︙ | ︙ | |||
48 49 50 51 52 53 54 |
{1004234400 21600 0 ALMT}
{1017540000 25200 1 ALMST}
{1035684000 21600 0 ALMT}
{1048989600 25200 1 ALMST}
{1067133600 21600 0 ALMT}
{1080439200 25200 1 ALMST}
{1099188000 21600 0 ALMT}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 48 49 50 51 52 53 54 55 56 |
{1004234400 21600 0 ALMT}
{1017540000 25200 1 ALMST}
{1035684000 21600 0 ALMT}
{1048989600 25200 1 ALMST}
{1067133600 21600 0 ALMT}
{1080439200 25200 1 ALMST}
{1099188000 21600 0 ALMT}
{1110823200 21600 0 ALMT}
}
|
Changes to library/tzdata/Asia/Aqtau.
| ︙ | ︙ | |||
50 51 52 53 54 55 56 |
{1004234400 14400 0 AQTT}
{1017540000 18000 1 AQTST}
{1035684000 14400 0 AQTT}
{1048989600 18000 1 AQTST}
{1067133600 14400 0 AQTT}
{1080439200 18000 1 AQTST}
{1099188000 14400 0 AQTT}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 50 51 52 53 54 55 56 57 58 |
{1004234400 14400 0 AQTT}
{1017540000 18000 1 AQTST}
{1035684000 14400 0 AQTT}
{1048989600 18000 1 AQTST}
{1067133600 14400 0 AQTT}
{1080439200 18000 1 AQTST}
{1099188000 14400 0 AQTT}
{1110830400 14400 0 AQTT}
}
|
Changes to library/tzdata/Asia/Aqtobe.
| ︙ | ︙ | |||
49 50 51 52 53 54 55 |
{1004234400 18000 0 AQTT}
{1017540000 21600 1 AQTST}
{1035684000 18000 0 AQTT}
{1048989600 21600 1 AQTST}
{1067133600 18000 0 AQTT}
{1080439200 21600 1 AQTST}
{1099188000 18000 0 AQTT}
| < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 49 50 51 52 53 54 55 56 57 |
{1004234400 18000 0 AQTT}
{1017540000 21600 1 AQTST}
{1035684000 18000 0 AQTT}
{1048989600 21600 1 AQTST}
{1067133600 18000 0 AQTT}
{1080439200 21600 1 AQTST}
{1099188000 18000 0 AQTT}
{1110826800 18000 0 AQTT}
}
|
Changes to library/tzdata/Asia/Baku.
| ︙ | ︙ | |||
24 25 26 27 28 29 30 |
{622605600 14400 0 BAKT}
{638330400 18000 1 BAKST}
{654660000 14400 0 BAKT}
{670384800 14400 1 BAKST}
{683496000 14400 0 AZST}
{686109600 10800 0 AZT}
{701812800 14400 1 AZST}
| < | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
{622605600 14400 0 BAKT}
{638330400 18000 1 BAKST}
{654660000 14400 0 BAKT}
{670384800 14400 1 BAKST}
{683496000 14400 0 AZST}
{686109600 10800 0 AZT}
{701812800 14400 1 AZST}
{717537600 14400 0 AZT}
{820440000 14400 0 AZT}
{828234000 18000 1 AZST}
{846378000 14400 0 AZT}
{852062400 14400 0 AZT}
{859669200 18000 1 AZST}
{877809600 14400 0 AZT}
{891118800 18000 1 AZST}
|
| ︙ | ︙ |
Changes to library/tzdata/Asia/Jerusalem.
| ︙ | ︙ | |||
75 76 77 78 79 80 81 |
{1001282400 7200 0 IST}
{1017356400 10800 1 IDT}
{1033941600 7200 0 IST}
{1048806000 10800 1 IDT}
{1065132000 7200 0 IST}
{1081292400 10800 1 IDT}
{1095804000 7200 0 IST}
| | | | | | | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < | | | | | | | | | | | | | | | | | | | | | | < < | 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 |
{1001282400 7200 0 IST}
{1017356400 10800 1 IDT}
{1033941600 7200 0 IST}
{1048806000 10800 1 IDT}
{1065132000 7200 0 IST}
{1081292400 10800 1 IDT}
{1095804000 7200 0 IST}
{1112313600 10800 1 IDT}
{1128812400 7200 0 IST}
{1143763200 10800 1 IDT}
{1159657200 7200 0 IST}
{1175212800 10800 1 IDT}
{1189897200 7200 0 IST}
{1206662400 10800 1 IDT}
{1223161200 7200 0 IST}
{1238112000 10800 1 IDT}
{1254006000 7200 0 IST}
{1269561600 10800 1 IDT}
{1284246000 7200 0 IST}
{1301616000 10800 1 IDT}
{1317510000 7200 0 IST}
{1333065600 10800 1 IDT}
{1348354800 7200 0 IST}
{1364515200 10800 1 IDT}
{1378594800 7200 0 IST}
{1395964800 10800 1 IDT}
{1411858800 7200 0 IST}
{1427414400 10800 1 IDT}
{1442703600 7200 0 IST}
{1459468800 10800 1 IDT}
{1475967600 7200 0 IST}
{1490918400 10800 1 IDT}
{1506207600 7200 0 IST}
{1522368000 10800 1 IDT}
{1537052400 7200 0 IST}
{1553817600 10800 1 IDT}
{1570316400 7200 0 IST}
{1585267200 10800 1 IDT}
{1601161200 7200 0 IST}
{1616716800 10800 1 IDT}
{1631401200 7200 0 IST}
{1648771200 10800 1 IDT}
{1664665200 7200 0 IST}
{1680220800 10800 1 IDT}
{1695510000 7200 0 IST}
{1711670400 10800 1 IDT}
{1728169200 7200 0 IST}
{1743120000 10800 1 IDT}
{1759014000 7200 0 IST}
{1774569600 10800 1 IDT}
{1789858800 7200 0 IST}
{1806019200 10800 1 IDT}
{1823122800 7200 0 IST}
{1838073600 10800 1 IDT}
{1853362800 7200 0 IST}
{1869523200 10800 1 IDT}
{1884207600 7200 0 IST}
{1900972800 10800 1 IDT}
{1917471600 7200 0 IST}
{1932422400 10800 1 IDT}
{1947711600 7200 0 IST}
{1963872000 10800 1 IDT}
{1978556400 7200 0 IST}
{1995926400 10800 1 IDT}
{2011820400 7200 0 IST}
{2027376000 10800 1 IDT}
{2042060400 7200 0 IST}
{2058825600 10800 1 IDT}
{2075324400 7200 0 IST}
{2090275200 10800 1 IDT}
{2106169200 7200 0 IST}
{2121724800 10800 1 IDT}
{2136409200 7200 0 IST}
}
|
Changes to library/tzdata/Asia/Oral.
| ︙ | ︙ | |||
50 51 52 53 54 55 56 |
{1004234400 14400 0 ORAT}
{1017540000 18000 1 ORAST}
{1035684000 14400 0 ORAT}
{1048989600 18000 1 ORAST}
{1067133600 14400 0 ORAT}
{1080439200 18000 1 ORAST}
{1099188000 14400 0 ORAT}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 50 51 52 53 54 55 56 57 58 |
{1004234400 14400 0 ORAT}
{1017540000 18000 1 ORAST}
{1035684000 14400 0 ORAT}
{1048989600 18000 1 ORAST}
{1067133600 14400 0 ORAT}
{1080439200 18000 1 ORAST}
{1099188000 14400 0 ORAT}
{1110830400 14400 0 ORAT}
}
|
Changes to library/tzdata/Asia/Qyzylorda.
| ︙ | ︙ | |||
50 51 52 53 54 55 56 |
{1004234400 21600 0 QYZT}
{1017540000 25200 1 QYZST}
{1035684000 21600 0 QYZT}
{1048989600 25200 1 QYZST}
{1067133600 21600 0 QYZT}
{1080439200 25200 1 QYZST}
{1099188000 21600 0 QYZT}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 50 51 52 53 54 55 56 57 58 |
{1004234400 21600 0 QYZT}
{1017540000 25200 1 QYZST}
{1035684000 21600 0 QYZT}
{1048989600 25200 1 QYZST}
{1067133600 21600 0 QYZT}
{1080439200 25200 1 QYZST}
{1099188000 21600 0 QYZT}
{1110823200 21600 0 QYZT}
}
|
Changes to library/tzdata/Asia/Tehran.
| ︙ | ︙ | |||
76 77 78 79 80 81 82 |
{1632252600 12600 0 IRST}
{1647894600 16200 1 IRDT}
{1663788600 12600 0 IRST}
{1679430600 16200 1 IRDT}
{1695324600 12600 0 IRST}
{1710966600 16200 1 IRDT}
{1726860600 12600 0 IRST}
| | | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
{1632252600 12600 0 IRST}
{1647894600 16200 1 IRDT}
{1663788600 12600 0 IRST}
{1679430600 16200 1 IRDT}
{1695324600 12600 0 IRST}
{1710966600 16200 1 IRDT}
{1726860600 12600 0 IRST}
{1742589000 16200 1 IRDT}
{1758483000 12600 0 IRST}
{1774125000 16200 1 IRDT}
{1790019000 12600 0 IRST}
{1805661000 16200 1 IRDT}
{1821555000 12600 0 IRST}
{1837197000 16200 1 IRDT}
{1853091000 12600 0 IRST}
{1868733000 16200 1 IRDT}
|
| ︙ | ︙ |
Changes to library/tzdata/Indian/Chagos.
1 2 3 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:Indian/Chagos) {
| | > | 1 2 3 4 5 6 7 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:Indian/Chagos) {
{-9223372036854775808 17380 0 LMT}
{-1988167780 18000 0 IOT}
{820436400 21600 0 IOT}
}
|
Changes to library/tzdata/Indian/Cocos.
1 2 3 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:Indian/Cocos) {
| | > | 1 2 3 4 5 6 |
# created by ../tools/tclZIC.tcl - do not edit
set TZData(:Indian/Cocos) {
{-9223372036854775808 23260 0 LMT}
{-2209012060 23400 0 CCT}
}
|
Deleted libtommath/bn.pdf.
cannot compute difference between binary files
Deleted libtommath/bn.tex.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_fast_mp_invmod.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_fast_mp_montgomery_reduce.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_fast_s_mp_mul_digs.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_fast_s_mp_mul_high_digs.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_fast_s_mp_sqr.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_exptmod.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_exptmod_fast.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_exteuclid.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_invmod_slow.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_montgomery_calc_normalization.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_mul_d.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_neg.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_prime_random_ex.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_radix_size.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_rand.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_read_radix.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_reduce.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_reduce_2k.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_reduce_2k_setup.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_reduce_is_2k.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_to_signed_bin.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_to_unsigned_bin.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_toom_mul.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_unsigned_bin_size.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_xor.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_mp_zero.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_s_mp_exptmod.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_s_mp_mul_digs.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bn_s_mp_sqr.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/bncore.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/callgraph.txt.
more than 10,000 changes
Deleted libtommath/changes.txt.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/demo/demo.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/demo/timing.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/dep.pl.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/etc/timer.asm.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/etc/tune.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/logs/README.
|
| < < < < < < < < < < < < < |
Deleted libtommath/logs/add.log.
|
| < < < < < < < < < < < < < < < < |
Deleted libtommath/logs/addsub.png.
cannot compute difference between binary files
Deleted libtommath/logs/expt.log.
|
| < < < < < < < |
Deleted libtommath/logs/expt.png.
cannot compute difference between binary files
Deleted libtommath/logs/expt_2k.log.
|
| < < < < < < |
Deleted libtommath/logs/expt_dr.log.
|
| < < < < < < < |
Deleted libtommath/logs/invmod.png.
cannot compute difference between binary files
Deleted libtommath/logs/mult.log.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/logs/mult.png.
cannot compute difference between binary files
Deleted libtommath/logs/mult_kara.log.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/logs/sqr.log.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/logs/sqr_kara.log.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/logs/sub.log.
|
| < < < < < < < < < < < < < < < < |
Deleted libtommath/makefile.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/makefile.bcc.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/makefile.cygwin_dll.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/makefile.icc.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/makefile.msvc.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/makefile.shared.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/pics/expt_state.tif.
cannot compute difference between binary files
Deleted libtommath/pics/primality.tif.
cannot compute difference between binary files
Deleted libtommath/poster.pdf.
cannot compute difference between binary files
Deleted libtommath/pre_gen/mpi.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/tommath.h.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/tommath.pdf.
cannot compute difference between binary files
Deleted libtommath/tommath.src.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/tommath.tex.
more than 10,000 changes
Deleted libtommath/tommath_class.h.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted libtommath/tommath_superclass.h.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to macosx/Makefile.
1 2 | ######################################################################################################## # | | | > | | > < < < < < | > > > > | < < | | < | < | < < < | | < < | < < | < < < < > | > > | | | > > > | | | > > > > > > | > | | | < < | | < | | | < | > | < > | | < | | > | | > | > | > > > > > > > | < > > | > | | < < < | | < | | | < < < < < < | | < < < > | < | | | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 |
########################################################################################################
#
# Makefile wrapper to build tcl on Mac OS X in a way compatible with the tk/macosx Xcode buildsystem
# uses the standard unix build system in tcl/unix (which can be used directly instead of this
# if you are not using the tk/macosx projects).
#
# RCS: @(#) $Id: Makefile,v 1.18.4.1 2005/06/13 01:46:39 msofer Exp $
#
########################################################################################################
#-------------------------------------------------------------------------------------------------------
# customizable settings
DESTDIR ?=
INSTALL_ROOT ?= ${DESTDIR}
BUILD_DIR ?= ${CURDIR}/../../build
SYMROOT ?= ${BUILD_DIR}/${PROJECT}
OBJROOT ?= ${SYMROOT}
EXTRA_CONFIGURE_ARGS ?=
EXTRA_MAKE_ARGS ?=
INSTALL_PATH ?= /Library/Frameworks
PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
LIBDIR ?= ${INSTALL_PATH}
MANDIR ?= ${PREFIX}/man
# set to non-empty value to install manpages in addition to html help:
INSTALL_MANPAGES ?=
#-------------------------------------------------------------------------------------------------------
# meta targets
meta := all install embedded install-embedded clean distclean test
styles := develop deploy
all := ${styles}
all : ${all}
install := ${styles:%=install-%}
install : ${install}
install-%: action := install-
embedded := ${styles:%=embedded-%}
embedded : embedded-deploy
install-embedded := ${embedded:%=install-%}
install-embedded : install-embedded-deploy
clean := ${styles:%=clean-%}
clean : ${clean}
clean-%: action := clean-
distclean := ${styles:%=distclean-%}
distclean : ${distclean}
distclean-%: action := distclean-
test := ${styles:%=test-%}
test : ${test}
test-%: action := test-
targets := $(foreach v,${meta},${$v})
#-------------------------------------------------------------------------------------------------------
# build styles
BUILD_STYLE =
CONFIGURE_ARGS =
OBJ_DIR = ${OBJROOT}/${BUILD_STYLE}
develop_make_args := BUILD_STYLE=Development CONFIGURE_ARGS=--enable-symbols
deploy_make_args := BUILD_STYLE=Deployment INSTALL_TARGET=install-strip \
GENERIC_FLAGS=-DNDEBUG
embedded_make_args := EMBEDDED_BUILD=1
install_make_args := INSTALL_BUILD=1
${targets}:
${MAKE} ${action}${PROJECT} \
$(foreach s,${styles} embedded install,$(if $(findstring $s,$@),${${s}_make_args}))
#-------------------------------------------------------------------------------------------------------
# project specific settings
PROJECT := tcl
PRODUCT_NAME := Tcl
UNIX_DIR := ${CURDIR}/../unix
VERSION := $(shell awk -F= '/^TCL_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.in)
TCLSH := tclsh${VERSION}
BUILD_TARGET := tclsh tcltest
INSTALL_TARGET := install
override GENERIC_FLAGS := ${GENERIC_FLAGS} -DTCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING
export CPPROG := cp -p
INSTALL_TARGETS = install-binaries install-libraries
ifeq (${EMBEDDED_BUILD},)
INSTALL_TARGETS += install-private-headers
endif
ifeq (${INSTALL_BUILD}_${EMBEDDED_BUILD}_${BUILD_STYLE},1__Deployment)
INSTALL_TARGETS += html-tcl
ifneq (${INSTALL_MANPAGES},)
INSTALL_TARGETS += install-doc
endif
endif
MAKE_VARS := INSTALL_ROOT INSTALL_TARGETS VERSION GENERIC_FLAGS
MAKE_ARGS_V = $(foreach v,${MAKE_VARS},$v='${$v}')
build-${PROJECT}: target = ${TARGET}
install-${PROJECT}: target = ${INSTALL_TARGET}
clean-${PROJECT} distclean-${PROJECT} test-${PROJECT}: \
target = $*
DO_MAKE = +${MAKE} -C ${OBJ_DIR} ${target} ${MAKE_ARGS_V} ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
#-------------------------------------------------------------------------------------------------------
# build rules
${PROJECT}:
${MAKE} install-${PROJECT} INSTALL_ROOT=${OBJ_DIR}/
${OBJ_DIR}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure
mkdir -p ${OBJ_DIR} && cd ${OBJ_DIR} && ${UNIX_DIR}/configure -C \
--prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} \
--mandir=${MANDIR} --enable-threads --enable-framework \
${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}
build-${PROJECT}: ${OBJ_DIR}/Makefile
${DO_MAKE}
# symolic link hackery to trick
# 'make install INSTALL_ROOT=${OBJ_DIR}'
# into building Tcl.framework and tclsh in ${SYMROOT}
@cd ${OBJ_DIR} && mkdir -p $(dir ./${LIBDIR}) $(dir ./${BINDIR}) ${SYMROOT} && \
rm -f ./${LIBDIR} ./${BINDIR} && ln -fs ${SYMROOT} ./${LIBDIR} && \
ln -fs ${SYMROOT} ./${BINDIR} && ln -fs ${OBJ_DIR}/tcltest ${SYMROOT}
install-${PROJECT}: build-${PROJECT}
ifeq (${EMBEDDED_BUILD}_${INSTALL_ROOT},1_)
@echo "Cannot install-embedded with empty INSTALL_ROOT !" && false
endif
ifeq (${EMBEDDED_BUILD},1)
@rm -rf "${INSTALL_ROOT}/${LIBDIR}/Tcl.framework"
endif
${DO_MAKE}
ifeq (${INSTALL_BUILD},1)
ifeq (${EMBEDDED_BUILD},1)
# if we are embedding frameworks, don't install tclsh
@rm -f "${INSTALL_ROOT}${BINDIR}/${TCLSH}" && \
rmdir -p "${INSTALL_ROOT}${BINDIR}" 2>&- || true
else
# redo prebinding
@cd ${INSTALL_ROOT}/ && \
if [ ! -d usr/lib ]; then mkdir -p usr && ln -fs /usr/lib usr/ && RM_USRLIB=1; fi; \
if [ ! -d System ]; then ln -fs /System . && RM_SYSTEM=1; fi; \
redo_prebinding -r . "./${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}/${PRODUCT_NAME}"; \
redo_prebinding -r . "./${BINDIR}/${TCLSH}"; \
if [ -n "$${RM_USRLIB:-}" ]; then rm -f usr/lib; rmdir -p usr 2>&-; fi; \
if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi
# install tclsh symbolic link
@ln -fs ${TCLSH} ${INSTALL_ROOT}${BINDIR}/tclsh
endif
endif
ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
# keep copy of debug library around, so that
# Deployment build can be installed on top
# of Development build without overwriting
# the debug library
@cd ${INSTALL_ROOT}${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION} && \
ln -f "${PRODUCT_NAME}" "${PRODUCT_NAME}_debug"
endif
clean-${PROJECT}: %-${PROJECT}:
${DO_MAKE}
rm -rf ${SYMROOT}/{${PRODUCT_NAME}.framework,${TCLSH},tcltest}
rm -f ${OBJ_DIR}{${LIBDIR},${BINDIR}} && \
rmdir -p ${OBJ_DIR}$(dir ${LIBDIR}) 2>&- || true && \
rmdir -p ${OBJ_DIR}$(dir ${BINDIR}) 2>&- || true
distclean-${PROJECT}: %-${PROJECT}: clean-${PROJECT}
${DO_MAKE}
rm -rf ${OBJ_DIR}
test-${PROJECT}: %-${PROJECT}: build-${PROJECT}
${DO_MAKE}
#-------------------------------------------------------------------------------------------------------
.PHONY: ${meta} ${targets} ${PROJECT} build-${PROJECT} install-${PROJECT} \
clean-${PROJECT} distclean-${PROJECT}
.NOTPARALLEL:
#-------------------------------------------------------------------------------------------------------
|
Changes to macosx/README.
1 2 3 | Tcl MacOSX README ----------------- | | | 1 2 3 4 5 6 7 8 9 10 11 | Tcl MacOSX README ----------------- RCS: @(#) $Id: README,v 1.2.6.1 2005/06/13 01:46:40 msofer Exp $ This is the README file for the Mac OS X native version of Tcl (framework build). 1. General ---------- |
| ︙ | ︙ | |||
30 31 32 33 34 35 36 | please make sure that your report Tk specific bugs to the tktoolkit bug tracker and not the tcl one. 2. Using Tcl on MacOSX ---------------------- | | | | | | | | | | | > > | > | > | < < | | 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 100 101 102 103 104 105 106 107 108 |
please make sure that your report Tk specific bugs to the tktoolkit bug
tracker and not the tcl one.
2. Using Tcl on MacOSX
----------------------
- Mac OS X 10.2 (or higher) is required to run Tcl on MacOSX.
- Tcl built on Mac OS X 10.3 or higher will not run on 10.2 due to missing
symbols in libSystem, however Tcl built on 10.2 will run on 10.3 (but without
prebinding and other optimizations).
- Tcl extensions will be found in any of:
$HOME/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl
$HOME/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks
/System/Library/Frameworks (searched in that order).
Given a potential package directory $pkg, Tcl on OSX checks for the file
$pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl.
This allows building extensions as frameworks with all script files contained
in the Resources/Scripts directory of the framework.
- The Tcl framework contains documentation in html format in the
standard location for frameworks:
Tcl.framework/Resources/Documentation/Reference/Tcl
No manpages are installed by default.
- the framework Tcl.framework can be placed in any of the system's standard
framework directories:
$HOME/Library/Frameworks /Library/Frameworks
/Network/Library/Frameworks /System/Library/Frameworks
and /usr/bin/tclsh will work.
- the format of binary extensions expected by [load] is that of ordinary shared
libraries (.dylib) and not MachO bundles, at present loading of MachO bundles is
not supported.
3. Building Tcl.framework
-------------------------
- Mac OS X 10.2 (or higher) is required to build Tcl on MacOSX.
- Apple's Developer Tools CD needs to be installed (the most recent version
matching your OS release, but no earlier than December 2002). This CD should
have come with Mac OS X retail or should be present as a disk image on new macs
that came with OSX preinstalled. It can also be downloaded from
http://connect.apple.com (after you register for free ADC membership).
- Tcl is built as a Mac OS X framework via the Makefile in tcl/macosx, but can
but can also be built directly with the standard unix configure and make
buildsystem in tcl/unix.
- It is still possible to build with Apple's Xcode IDE using the Tcl.pbproj
project but this is not recommended anymore (currently Tcl.pbproj calls through
to the tcl/macosx/Makefile so there should be no build differences).
- Unpack the tcl source release archive.
- The following instructions assume the tcl source tree is named "tcl${ver}",
where ${ver} is a shell variable containing the tcl version number (for
example '8.4.2').
Setup the shell variable as follows:
set ver="8.4.2" ;: if your shell is csh
ver="8.4.2" ;: if your shell is sh
The source tree will be named this way only if you are building from a release
archive, if you are building from CVS, the version numbers will be missing; so
set ${ver} to the empty string instead:
set ver="" ;: if your shell is csh
ver="" ;: if your shell is sh
- The following steps will build Tcl from the Terminal, assuming you are
located in the directory containing the tcl source tree:
make -C tcl${ver}/macosx
and the following will then install Tcl onto the root volume (admin password
required):
sudo make -C tcl${ver}/macosx install
if you don't have the admin password, you can install into your home directory,
instead by passing an INSTALL_ROOT argument to make:
|
| ︙ | ︙ |
Added macosx/Tcl-Info.plist.in.
> > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> <string>@TCL_LIB_FILE@</string> <key>CFBundleGetInfoString</key> <string>Tcl Library @TCL_VERSION@, Copyright © @TCL_YEAR@ Tcl Core Team. Initial MacOS X Port by Jim Ingham <jingham@apple.com> & Ian Reid, Copyright © 2001-2002, Apple Computer, Inc.</string> <key>CFBundleIdentifier</key> <string>com.tcltk.tcllibrary</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>Tcl Library @TCL_VERSION@</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>@TCL_VERSION@@TCL_PATCH_LEVEL@</string> <key>CFBundleSignature</key> <string>Tcl </string> <key>CFBundleVersion</key> <string>@TCL_VERSION@@TCL_PATCH_LEVEL@</string> </dict> </plist> |
Changes to macosx/tclMacOSXBundle.c.
| ︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | * Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the * foregoing, the authors grant the U.S. Government and others * acting in its behalf permission to use and distribute the * software in accordance with the terms specified in this * license. */ #include <CoreFoundation/CoreFoundation.h> #include <mach-o/dyld.h> #include "tcl.h" /* *---------------------------------------------------------------------- * * Tcl_MacOSXOpenBundleResources -- * | > > > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | * Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the * foregoing, the authors grant the U.S. Government and others * acting in its behalf permission to use and distribute the * software in accordance with the terms specified in this * license. */ #ifdef HAVE_COREFOUNDATION #include <CoreFoundation/CoreFoundation.h> #include <mach-o/dyld.h> #endif /* HAVE_COREFOUNDATION */ #include "tcl.h" /* *---------------------------------------------------------------------- * * Tcl_MacOSXOpenBundleResources -- * |
| ︙ | ︙ | |||
115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
Tcl_Interp *interp,
CONST char *bundleName,
CONST char *bundleVersion,
int hasResourceFile,
int maxPathLen,
char *libraryPath)
{
CFBundleRef bundleRef;
CFStringRef bundleNameRef;
CFURLRef libURL;
libraryPath[0] = '\0';
bundleNameRef = CFStringCreateWithCString(NULL,
| > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
Tcl_Interp *interp,
CONST char *bundleName,
CONST char *bundleVersion,
int hasResourceFile,
int maxPathLen,
char *libraryPath)
{
#ifdef HAVE_COREFOUNDATION
CFBundleRef bundleRef;
CFStringRef bundleNameRef;
CFURLRef libURL;
libraryPath[0] = '\0';
bundleNameRef = CFStringCreateWithCString(NULL,
|
| ︙ | ︙ | |||
195 196 197 198 199 200 201 |
if (libURL) {
/*
* FIXME: This is a quick fix, it is probably not right
* for internationalization.
*/
CFURLGetFileSystemRepresentation(libURL, TRUE,
| | > > > | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
if (libURL) {
/*
* FIXME: This is a quick fix, it is probably not right
* for internationalization.
*/
CFURLGetFileSystemRepresentation(libURL, TRUE,
(unsigned char*) libraryPath, maxPathLen);
CFRelease(libURL);
}
}
if (libraryPath[0]) {
return TCL_OK;
} else {
return TCL_ERROR;
}
#else /* HAVE_COREFOUNDATION */
return TCL_ERROR;
#endif /* HAVE_COREFOUNDATION */
}
|
Added macosx/tclMacOSXNotify.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 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 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 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 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 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 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 |
/*
* tclMacOSXNotify.c --
*
* This file contains the implementation of a merged
* CFRunLoop/select-based notifier, which is the lowest-level part
* of the Tcl event loop. This file works together with
* generic/tclNotify.c.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright 2005, Tcl Core Team.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclMacOSXNotify.c,v 1.3.4.2 2005/06/13 01:46:40 msofer Exp $
*/
#ifdef HAVE_COREFOUNDATION /* Traditional unix select-based notifier
* is in tclUnixNotfy.c */
#include "tclInt.h"
#include <CoreFoundation/CoreFoundation.h>
#include <pthread.h>
extern TclStubs tclStubs;
extern Tcl_NotifierProcs tclOriginalNotifier;
/*
* This structure is used to keep track of the notifier info for a
* a registered file.
*/
typedef struct FileHandler {
int fd;
int mask; /* Mask of desired events: TCL_READABLE,
* etc. */
int readyMask; /* Mask of events that have been seen since the
* last time file handlers were invoked for
* this file. */
Tcl_FileProc *proc; /* Procedure to call, in the style of
* Tcl_CreateFileHandler. */
ClientData clientData; /* Argument to pass to proc. */
struct FileHandler *nextPtr;/* Next in list of all files we care about. */
} FileHandler;
/*
* The following structure is what is added to the Tcl event queue when
* file handlers are ready to fire.
*/
typedef struct FileHandlerEvent {
Tcl_Event header; /* Information that is standard for
* all events. */
int fd; /* File descriptor that is ready. Used
* to find the FileHandler structure for
* the file (can't point directly to the
* FileHandler structure because it could
* go away while the event is queued). */
} FileHandlerEvent;
/*
*
* The following structure contains a set of select() masks to track
* readable, writable, and exceptional conditions.
*/
typedef struct SelectMasks {
fd_set readable;
fd_set writable;
fd_set exceptional;
} SelectMasks;
/*
* The following static structure contains the state information for the
* select based implementation of the Tcl notifier. One of these structures
* is created for each thread that is using the notifier.
*/
typedef struct ThreadSpecificData {
FileHandler *firstFileHandlerPtr;
/* Pointer to head of file handler list. */
SelectMasks checkMasks; /* This structure is used to build up the masks
* to be used in the next call to select.
* Bits are set in response to calls to
* Tcl_CreateFileHandler. */
SelectMasks readyMasks; /* This array reflects the readable/writable
* conditions that were found to exist by the
* last call to select. */
int numFdBits; /* Number of valid bits in checkMasks
* (one more than highest fd for which
* Tcl_WatchFile has been called). */
int onList; /* True if it is in this list */
unsigned int pollState; /* pollState is used to implement a polling
* handshake between each thread and the
* notifier thread. Bits defined below. */
struct ThreadSpecificData *nextPtr, *prevPtr;
/* All threads that are currently waiting on
* an event have their ThreadSpecificData
* structure on a doubly-linked listed formed
* from these pointers. You must hold the
* notifierLock before accessing these
* fields. */
CFRunLoopSourceRef runLoopSource;
/* Any other thread alerts a notifier
* that an event is ready to be processed
* by signaling this CFRunLoopSource. */
CFRunLoopRef runLoop; /* This thread's CFRunLoop, needs to be woken
* up whenever the runLoopSource is signaled. */
int eventReady; /* True if an event is ready to be processed. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
* The following static indicates the number of threads that have
* initialized notifiers.
*
* You must hold the notifierInitLock before accessing this variable.
*/
static int notifierCount = 0;
/*
* The following variable points to the head of a doubly-linked list of
* of ThreadSpecificData structures for all threads that are currently
* waiting on an event.
*
* You must hold the notifierLock before accessing this list.
*/
static ThreadSpecificData *waitingListPtr = NULL;
/*
* The notifier thread spends all its time in select() waiting for a
* file descriptor associated with one of the threads on the waitingListPtr
* list to do something interesting. But if the contents of the
* waitingListPtr list ever changes, we need to wake up and restart
* the select() system call. You can wake up the notifier thread by
* writing a single byte to the file descriptor defined below. This
* file descriptor is the input-end of a pipe and the notifier thread is
* listening for data on the output-end of the same pipe. Hence writing
* to this file descriptor will cause the select() system call to return
* and wake up the notifier thread.
*
* You must hold the notifierLock lock before writing to the pipe.
*/
static int triggerPipe = -1;
static int receivePipe = -1; /* Output end of triggerPipe */
/*
* We use Darwin-native spinlocks instead of pthread mutexes for notifier
* locking: this radically simplifies the implementation and lowers
* overhead. Note that these are not pure spinlocks, they employ various
* strategies to back off, making them immune to most priority-inversion
* livelocks (c.f. man 3 OSSpinLockLock).
*/
#if defined(HAVE_LIBKERN_OSATOMIC_H) && defined(HAVE_OSSPINLOCKLOCK)
/* Use OSSpinLock API where available (Tiger or later) */
#include <libkern/OSAtomic.h>
#else
/* Otherwise, use commpage spinlock SPI directly */
typedef uint32_t OSSpinLock;
extern void _spin_lock(OSSpinLock *lock);
extern void _spin_unlock(OSSpinLock *lock);
#define OSSpinLockLock(p) _spin_lock(p)
#define OSSpinLockUnlock(p) _spin_unlock(p)
#endif
/*
* These spinlocks lock access to the global notifier state.
*/
static OSSpinLock notifierInitLock = 0;
static OSSpinLock notifierLock = 0;
/*
* Macros abstracting notifier locking/unlocking
*/
#define LOCK_NOTIFIER_INIT OSSpinLockLock(¬ifierInitLock)
#define UNLOCK_NOTIFIER_INIT OSSpinLockUnlock(¬ifierInitLock)
#define LOCK_NOTIFIER OSSpinLockLock(¬ifierLock)
#define UNLOCK_NOTIFIER OSSpinLockUnlock(¬ifierLock)
/*
* The pollState bits
* POLL_WANT is set by each thread before it waits on its condition
* variable. It is checked by the notifier before it does
* select.
* POLL_DONE is set by the notifier if it goes into select after
* seeing POLL_WANT. The idea is to ensure it tries a select
* with the same bits the initial thread had set.
*/
#define POLL_WANT 0x1
#define POLL_DONE 0x2
/*
* This is the thread ID of the notifier thread that does select.
*/
static pthread_t notifierThread;
/*
* Static routines defined in this file.
*/
static void NotifierThreadProc(ClientData clientData);
static int FileHandlerEventProc(Tcl_Event *evPtr, int flags);
/*
*----------------------------------------------------------------------
*
* Tcl_InitNotifier --
*
* Initializes the platform specific notifier state.
*
* Results:
* Returns a handle to the notifier state for this thread..
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
ClientData
Tcl_InitNotifier()
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->eventReady = 0;
/*
* Initialize CFRunLoopSource and add it to CFRunLoop of this thread
*/
if (!tsdPtr->runLoop) {
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
CFRunLoopSourceRef runLoopSource;
CFRunLoopSourceContext runLoopSourceContext;
bzero(&runLoopSourceContext, sizeof(CFRunLoopSourceContext));
runLoopSourceContext.info = tsdPtr;
runLoopSource = CFRunLoopSourceCreate(NULL, 0, &runLoopSourceContext);
if (!runLoopSource) {
Tcl_Panic("Tcl_InitNotifier: could not create CFRunLoopSource.");
}
CFRunLoopAddSource(runLoop, runLoopSource, kCFRunLoopCommonModes);
tsdPtr->runLoopSource = runLoopSource;
tsdPtr->runLoop = runLoop;
}
/*
* Initialize trigger pipe and start the Notifier thread if necessary.
*/
LOCK_NOTIFIER_INIT;
if (notifierCount == 0) {
int fds[2], status, result;
pthread_attr_t attr;
if (pipe(fds) != 0) {
Tcl_Panic("Tcl_InitNotifier: could not create trigger pipe.");
}
status = fcntl(fds[0], F_GETFL);
status |= O_NONBLOCK;
if (fcntl(fds[0], F_SETFL, status) < 0) {
Tcl_Panic("Tcl_InitNotifier: could not make receive pipe non blocking.");
}
status = fcntl(fds[1], F_GETFL);
status |= O_NONBLOCK;
if (fcntl(fds[1], F_SETFL, status) < 0) {
Tcl_Panic("Tcl_InitNotifier: could not make trigger pipe non blocking.");
}
receivePipe = fds[0];
triggerPipe = fds[1];
pthread_attr_init(&attr);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
pthread_attr_setstacksize(&attr, 60 * 1024);
result = pthread_create(¬ifierThread, &attr, (void * (*)(void *))NotifierThreadProc, NULL);
pthread_attr_destroy(&attr);
if (result) {
Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread.");
}
}
notifierCount++;
UNLOCK_NOTIFIER_INIT;
return (ClientData) tsdPtr;
}
/*
*----------------------------------------------------------------------
*
* Tcl_FinalizeNotifier --
*
* This function is called to cleanup the notifier state before
* a thread is terminated.
*
* Results:
* None.
*
* Side effects:
* May terminate the background notifier thread if this is the
* last notifier instance.
*
*----------------------------------------------------------------------
*/
void
Tcl_FinalizeNotifier(clientData)
ClientData clientData; /* Not used. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
LOCK_NOTIFIER_INIT;
notifierCount--;
/*
* If this is the last thread to use the notifier, close the notifier
* pipe and wait for the background thread to terminate.
*/
if (notifierCount == 0) {
int result;
if (triggerPipe < 0) {
Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized.");
}
/*
* Send "q" message to the notifier thread so that it will
* terminate. The notifier will return from its call to select()
* and notice that a "q" message has arrived, it will then close
* its side of the pipe and terminate its thread. Note the we can
* not just close the pipe and check for EOF in the notifier
* thread because if a background child process was created with
* exec, select() would not register the EOF on the pipe until the
* child processes had terminated. [Bug: 4139]
*/
write(triggerPipe, "q", 1);
close(triggerPipe);
result = pthread_join(notifierThread, NULL);
if (result) {
Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread.");
}
close(receivePipe);
triggerPipe = -1;
}
UNLOCK_NOTIFIER_INIT;
LOCK_NOTIFIER; /* for concurrency with Tcl_AlertNotifier */
if (tsdPtr->runLoop) {
tsdPtr->runLoop = NULL;
/* Remove runLoopSource from all CFRunLoops and release it */
CFRunLoopSourceInvalidate(tsdPtr->runLoopSource);
CFRelease(tsdPtr->runLoopSource);
tsdPtr->runLoopSource = NULL;
}
UNLOCK_NOTIFIER;
}
/*
*----------------------------------------------------------------------
*
* Tcl_AlertNotifier --
*
* Wake up the specified notifier from any thread. This routine
* is called by the platform independent notifier code whenever
* the Tcl_ThreadAlert routine is called. This routine is
* guaranteed not to be called on a given notifier after
* Tcl_FinalizeNotifier is called for that notifier.
*
* Results:
* None.
*
* Side effects:
* Signals the notifier condition variable for the specified
* notifier.
*
*----------------------------------------------------------------------
*/
void
Tcl_AlertNotifier(clientData)
ClientData clientData;
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
LOCK_NOTIFIER;
if (tsdPtr->runLoop) {
tsdPtr->eventReady = 1;
CFRunLoopSourceSignal(tsdPtr->runLoopSource);
CFRunLoopWakeUp(tsdPtr->runLoop);
}
UNLOCK_NOTIFIER;
}
/*
*----------------------------------------------------------------------
*
* Tcl_SetTimer --
*
* This procedure sets the current notifier timer value. This
* interface is not implemented in this notifier because we are
* always running inside of Tcl_DoOneEvent.
*
* Results:
* None.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetTimer(timePtr)
Tcl_Time *timePtr; /* Timeout value, may be NULL. */
{
/*
* The interval timer doesn't do anything in this implementation,
* because the only event loop is via Tcl_DoOneEvent, which passes
* timeout values to Tcl_WaitForEvent.
*/
if (tclStubs.tcl_SetTimer != tclOriginalNotifier.setTimerProc) {
tclStubs.tcl_SetTimer(timePtr);
}
}
/*
*----------------------------------------------------------------------
*
* Tcl_ServiceModeHook --
*
* This function is invoked whenever the service mode changes.
*
* Results:
* None.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
void
Tcl_ServiceModeHook(mode)
int mode; /* Either TCL_SERVICE_ALL, or
* TCL_SERVICE_NONE. */
{
}
/*
*----------------------------------------------------------------------
*
* Tcl_CreateFileHandler --
*
* This procedure registers a file handler with the select notifier.
*
* Results:
* None.
*
* Side effects:
* Creates a new file handler structure.
*
*----------------------------------------------------------------------
*/
void
Tcl_CreateFileHandler(fd, mask, proc, clientData)
int fd; /* Handle of stream to watch. */
int mask; /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION:
* indicates conditions under which
* proc should be called. */
Tcl_FileProc *proc; /* Procedure to call for each
* selected event. */
ClientData clientData; /* Arbitrary data to pass to proc. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
FileHandler *filePtr;
if (tclStubs.tcl_CreateFileHandler != tclOriginalNotifier.createFileHandlerProc) {
tclStubs.tcl_CreateFileHandler(fd, mask, proc, clientData);
return;
}
for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
filePtr = filePtr->nextPtr) {
if (filePtr->fd == fd) {
break;
}
}
if (filePtr == NULL) {
filePtr = (FileHandler*) ckalloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->readyMask = 0;
filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
tsdPtr->firstFileHandlerPtr = filePtr;
}
filePtr->proc = proc;
filePtr->clientData = clientData;
filePtr->mask = mask;
/*
* Update the check masks for this file.
*/
if (mask & TCL_READABLE) {
FD_SET(fd, &(tsdPtr->checkMasks.readable));
} else {
FD_CLR(fd, &(tsdPtr->checkMasks.readable));
}
if (mask & TCL_WRITABLE) {
FD_SET(fd, &(tsdPtr->checkMasks.writable));
} else {
FD_CLR(fd, &(tsdPtr->checkMasks.writable));
}
if (mask & TCL_EXCEPTION) {
FD_SET(fd, &(tsdPtr->checkMasks.exceptional));
} else {
FD_CLR(fd, &(tsdPtr->checkMasks.exceptional));
}
if (tsdPtr->numFdBits <= fd) {
tsdPtr->numFdBits = fd+1;
}
}
/*
*----------------------------------------------------------------------
*
* Tcl_DeleteFileHandler --
*
* Cancel a previously-arranged callback arrangement for
* a file.
*
* Results:
* None.
*
* Side effects:
* If a callback was previously registered on file, remove it.
*
*----------------------------------------------------------------------
*/
void
Tcl_DeleteFileHandler(fd)
int fd; /* Stream id for which to remove callback procedure. */
{
FileHandler *filePtr, *prevPtr;
int i;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (tclStubs.tcl_DeleteFileHandler != tclOriginalNotifier.deleteFileHandlerProc) {
tclStubs.tcl_DeleteFileHandler(fd);
return;
}
/*
* Find the entry for the given file (and return if there isn't one).
*/
for (prevPtr = NULL, filePtr = tsdPtr->firstFileHandlerPtr; ;
prevPtr = filePtr, filePtr = filePtr->nextPtr) {
if (filePtr == NULL) {
return;
}
if (filePtr->fd == fd) {
break;
}
}
/*
* Update the check masks for this file.
*/
if (filePtr->mask & TCL_READABLE) {
FD_CLR(fd, &(tsdPtr->checkMasks.readable));
}
if (filePtr->mask & TCL_WRITABLE) {
FD_CLR(fd, &(tsdPtr->checkMasks.writable));
}
if (filePtr->mask & TCL_EXCEPTION) {
FD_CLR(fd, &(tsdPtr->checkMasks.exceptional));
}
/*
* Find current max fd.
*/
if (fd+1 == tsdPtr->numFdBits) {
tsdPtr->numFdBits = 0;
for (i = fd-1; i >= 0; i--) {
if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))
|| FD_ISSET(i, &(tsdPtr->checkMasks.writable))
|| FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))) {
tsdPtr->numFdBits = i+1;
break;
}
}
}
/*
* Clean up information in the callback record.
*/
if (prevPtr == NULL) {
tsdPtr->firstFileHandlerPtr = filePtr->nextPtr;
} else {
prevPtr->nextPtr = filePtr->nextPtr;
}
ckfree((char *) filePtr);
}
/*
*----------------------------------------------------------------------
*
* FileHandlerEventProc --
*
* This procedure is called by Tcl_ServiceEvent when a file event
* reaches the front of the event queue. This procedure is
* responsible for actually handling the event by invoking the
* callback for the file handler.
*
* Results:
* Returns 1 if the event was handled, meaning it should be removed
* from the queue. Returns 0 if the event was not handled, meaning
* it should stay on the queue. The only time the event isn't
* handled is if the TCL_FILE_EVENTS flag bit isn't set.
*
* Side effects:
* Whatever the file handler's callback procedure does.
*
*----------------------------------------------------------------------
*/
static int
FileHandlerEventProc(evPtr, flags)
Tcl_Event *evPtr; /* Event to service. */
int flags; /* Flags that indicate what events to
* handle, such as TCL_FILE_EVENTS. */
{
int mask;
FileHandler *filePtr;
FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) evPtr;
ThreadSpecificData *tsdPtr;
if (!(flags & TCL_FILE_EVENTS)) {
return 0;
}
/*
* Search through the file handlers to find the one whose handle matches
* the event. We do this rather than keeping a pointer to the file
* handler directly in the event, so that the handler can be deleted
* while the event is queued without leaving a dangling pointer.
*/
tsdPtr = TCL_TSD_INIT(&dataKey);
for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
filePtr = filePtr->nextPtr) {
if (filePtr->fd != fileEvPtr->fd) {
continue;
}
/*
* The code is tricky for two reasons:
* 1. The file handler's desired events could have changed
* since the time when the event was queued, so AND the
* ready mask with the desired mask.
* 2. The file could have been closed and re-opened since
* the time when the event was queued. This is why the
* ready mask is stored in the file handler rather than
* the queued event: it will be zeroed when a new
* file handler is created for the newly opened file.
*/
mask = filePtr->readyMask & filePtr->mask;
filePtr->readyMask = 0;
if (mask != 0) {
(*filePtr->proc)(filePtr->clientData, mask);
}
break;
}
return 1;
}
/*
*----------------------------------------------------------------------
*
* Tcl_WaitForEvent --
*
* This function is called by Tcl_DoOneEvent to wait for new
* events on the message queue. If the block time is 0, then
* Tcl_WaitForEvent just polls without blocking.
*
* Results:
* Returns -1 if the select would block forever, otherwise
* returns 0.
*
* Side effects:
* Queues file events that are detected by the select.
*
*----------------------------------------------------------------------
*/
int
Tcl_WaitForEvent(timePtr)
Tcl_Time *timePtr; /* Maximum block time, or NULL. */
{
FileHandler *filePtr;
FileHandlerEvent *fileEvPtr;
int mask;
Tcl_Time myTime;
int waitForFiles;
Tcl_Time *myTimePtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (tclStubs.tcl_WaitForEvent != tclOriginalNotifier.waitForEventProc) {
return tclStubs.tcl_WaitForEvent(timePtr);
}
if (timePtr != NULL) {
/* TIP #233 (Virtualized Time). Is virtual time in effect ?
* And do we actually have something to scale ? If yes to both
* then we call the handler to do this scaling */
myTime.sec = timePtr->sec;
myTime.usec = timePtr->usec;
if (myTime.sec != 0 || myTime.usec != 0) {
(*tclScaleTimeProcPtr) (&myTime, tclTimeClientData);
}
myTimePtr = &myTime;
} else {
myTimePtr = NULL;
}
/*
* Place this thread on the list of interested threads, signal the
* notifier thread, and wait for a response or a timeout.
*/
LOCK_NOTIFIER;
waitForFiles = (tsdPtr->numFdBits > 0);
if (myTimePtr != NULL && myTimePtr->sec == 0 && myTimePtr->usec == 0) {
/*
* Cannot emulate a polling select with a polling condition variable.
* Instead, pretend to wait for files and tell the notifier
* thread what we are doing. The notifier thread makes sure
* it goes through select with its select mask in the same state
* as ours currently is. We block until that happens.
*/
waitForFiles = 1;
tsdPtr->pollState = POLL_WANT;
myTimePtr = NULL;
} else {
tsdPtr->pollState = 0;
}
if (waitForFiles) {
/*
* Add the ThreadSpecificData structure of this thread to the list
* of ThreadSpecificData structures of all threads that are waiting
* on file events.
*/
tsdPtr->nextPtr = waitingListPtr;
if (waitingListPtr) {
waitingListPtr->prevPtr = tsdPtr;
}
tsdPtr->prevPtr = 0;
waitingListPtr = tsdPtr;
tsdPtr->onList = 1;
write(triggerPipe, "", 1);
}
FD_ZERO(&(tsdPtr->readyMasks.readable));
FD_ZERO(&(tsdPtr->readyMasks.writable));
FD_ZERO(&(tsdPtr->readyMasks.exceptional));
if (!tsdPtr->eventReady) {
CFTimeInterval waitTime;
if (myTimePtr == NULL) {
waitTime = 1.0e10; /* Wait forever, as per CFRunLoop.c */
} else {
waitTime = myTimePtr->sec + 1.0e-6 * myTimePtr->usec;
}
UNLOCK_NOTIFIER;
CFRunLoopRunInMode(kCFRunLoopDefaultMode, waitTime, TRUE);
LOCK_NOTIFIER;
}
tsdPtr->eventReady = 0;
if (waitForFiles && tsdPtr->onList) {
/*
* Remove the ThreadSpecificData structure of this thread from the
* waiting list. Alert the notifier thread to recompute its select
* masks - skipping this caused a hang when trying to close a pipe
* which the notifier thread was still doing a select on.
*/
if (tsdPtr->prevPtr) {
tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr;
} else {
waitingListPtr = tsdPtr->nextPtr;
}
if (tsdPtr->nextPtr) {
tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
}
tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
tsdPtr->onList = 0;
write(triggerPipe, "", 1);
}
/*
* Queue all detected file events before returning.
*/
for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL);
filePtr = filePtr->nextPtr) {
mask = 0;
if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.readable))) {
mask |= TCL_READABLE;
}
if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.writable))) {
mask |= TCL_WRITABLE;
}
if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.exceptional))) {
mask |= TCL_EXCEPTION;
}
if (!mask) {
continue;
}
/*
* Don't bother to queue an event if the mask was previously
* non-zero since an event must still be on the queue.
*/
if (filePtr->readyMask == 0) {
fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL);
}
filePtr->readyMask = mask;
}
UNLOCK_NOTIFIER;
return 0;
}
/*
*----------------------------------------------------------------------
*
* NotifierThreadProc --
*
* This routine is the initial (and only) function executed by the
* special notifier thread. Its job is to wait for file descriptors
* to become readable or writable or to have an exception condition
* and then to notify other threads who are interested in this
* information by signalling a condition variable. Other threads
* can signal this notifier thread of a change in their interests
* by writing a single byte to a special pipe that the notifier
* thread is monitoring.
*
* Result:
* None. Once started, this routine never exits. It dies with
* the overall process.
*
* Side effects:
* The trigger pipe used to signal the notifier thread is created
* when the notifier thread first starts.
*
*----------------------------------------------------------------------
*/
static void
NotifierThreadProc(clientData)
ClientData clientData; /* Not used. */
{
ThreadSpecificData *tsdPtr;
fd_set readableMask;
fd_set writableMask;
fd_set exceptionalMask;
int i, numFdBits = 0;
long found;
struct timeval poll = {0., 0.}, *timePtr;
char buf[2];
/*
* Look for file events and report them to interested threads.
*/
while (1) {
FD_ZERO(&readableMask);
FD_ZERO(&writableMask);
FD_ZERO(&exceptionalMask);
/*
* Compute the logical OR of the select masks from all the
* waiting notifiers.
*/
LOCK_NOTIFIER;
timePtr = NULL;
for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) {
for (i = tsdPtr->numFdBits-1; i >= 0; --i) {
if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))) {
FD_SET(i, &readableMask);
}
if (FD_ISSET(i, &(tsdPtr->checkMasks.writable))) {
FD_SET(i, &writableMask);
}
if (FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))) {
FD_SET(i, &exceptionalMask);
}
}
if (tsdPtr->numFdBits > numFdBits) {
numFdBits = tsdPtr->numFdBits;
}
if (tsdPtr->pollState & POLL_WANT) {
/*
* Here we make sure we go through select() with the same
* mask bits that were present when the thread tried to poll.
*/
tsdPtr->pollState |= POLL_DONE;
timePtr = &poll;
}
}
UNLOCK_NOTIFIER;
/*
* Set up the select mask to include the receive pipe.
*/
if (receivePipe >= numFdBits) {
numFdBits = receivePipe + 1;
}
FD_SET(receivePipe, &readableMask);
if (select(numFdBits, &readableMask, &writableMask, &exceptionalMask,
timePtr) == -1) {
/*
* Try again immediately on an error.
*/
continue;
}
/*
* Alert any threads that are waiting on a ready file descriptor.
*/
LOCK_NOTIFIER;
for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) {
found = 0;
for (i = tsdPtr->numFdBits-1; i >= 0; --i) {
if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))
&& FD_ISSET(i, &readableMask)) {
FD_SET(i, &(tsdPtr->readyMasks.readable));
found = 1;
}
if (FD_ISSET(i, &(tsdPtr->checkMasks.writable))
&& FD_ISSET(i, &writableMask)) {
FD_SET(i, &(tsdPtr->readyMasks.writable));
found = 1;
}
if (FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))
&& FD_ISSET(i, &exceptionalMask)) {
FD_SET(i, &(tsdPtr->readyMasks.exceptional));
found = 1;
}
}
if (found || (tsdPtr->pollState & POLL_DONE)) {
tsdPtr->eventReady = 1;
if (tsdPtr->onList) {
/*
* Remove the ThreadSpecificData structure of this
* thread from the waiting list. This prevents us from
* continuously spining on select until the other
* threads runs and services the file event.
*/
if (tsdPtr->prevPtr) {
tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr;
} else {
waitingListPtr = tsdPtr->nextPtr;
}
if (tsdPtr->nextPtr) {
tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
}
tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
tsdPtr->onList = 0;
tsdPtr->pollState = 0;
}
if (tsdPtr->runLoop) {
CFRunLoopSourceSignal(tsdPtr->runLoopSource);
CFRunLoopWakeUp(tsdPtr->runLoop);
}
}
}
UNLOCK_NOTIFIER;
/*
* Consume the next byte from the notifier pipe if the pipe was
* readable. Note that there may be multiple bytes pending, but
* to avoid a race condition we only read one at a time.
*/
if (FD_ISSET(receivePipe, &readableMask)) {
i = read(receivePipe, buf, 1);
if ((i == 0) || ((i == 1) && (buf[0] == 'q'))) {
/*
* Someone closed the write end of the pipe or sent us a
* Quit message [Bug: 4139] and then closed the write end
* of the pipe so we need to shut down the notifier thread.
*/
break;
}
}
}
pthread_exit (0);
}
#endif /* HAVE_COREFOUNDATION */
|
Changes to tests/appendComp.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: append lappend # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: append lappend
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: appendComp.test,v 1.7.4.1 2005/06/13 01:46:40 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
catch {unset x}
|
| ︙ | ︙ | |||
347 348 349 350 351 352 353 |
proc foo {args} {append ::result $args}
append myvar a
info exists ::result
}
bar
} {0}
| | | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
proc foo {args} {append ::result $args}
append myvar a
info exists ::result
}
bar
} {0}
test appendComp-8.1 {defer error to runtime} -setup {
interp create slave
} -body {
slave eval {
proc foo {} {
proc append args {}
append
}
|
| ︙ | ︙ |
Changes to tests/basic.test.
| ︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: basic.test,v 1.38.2.1 2005/06/13 01:46:40 msofer Exp $ # package require tcltest 2 namespace import -force ::tcltest::* testConstraint testevalex [llength [info commands testevalex]] testConstraint testcmdtoken [llength [info commands testcmdtoken]] |
| ︙ | ︙ | |||
600 601 602 603 604 605 606 |
} -constraints {
exec
} -body {
exec [interpreter] $fName
} -cleanup {
removeFile BREAKtest
} -returnCodes error -match glob -result {invoked "break" outside of a loop
| | < < | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
} -constraints {
exec
} -body {
exec [interpreter] $fName
} -cleanup {
removeFile BREAKtest
} -returnCodes error -match glob -result {invoked "break" outside of a loop
while executing*
"foo \[set a 1] \[break]"
(file "*BREAKtest" line 2)}
test basic-46.5 {Tcl_AllowExceptions: exception return not allowed} -setup {
set fName [makeFile {
return -code return
} BREAKtest]
|
| ︙ | ︙ |
Changes to tests/binary.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # This file tests the tclBinary.c file and the "binary" Tcl command. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 by Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# This file tests the tclBinary.c file and the "binary" Tcl command.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1997 by Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: binary.test,v 1.18.4.1 2005/06/13 01:46:40 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
::tcltest::testConstraint bigEndian [expr {$tcl_platform(byteOrder) eq "bigEndian"}]
::tcltest::testConstraint littleEndian [expr {$tcl_platform(byteOrder) eq "littleEndian"}]
|
| ︙ | ︙ | |||
1067 1068 1069 1070 1071 1072 1073 |
test binary-31.1 {Tcl_BinaryObjCmd: scan} {
list [catch {binary scan abc f} msg] $msg
} {1 {not enough arguments for all format specifiers}}
test binary-31.2 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f* arg1] $arg1
| | | | | | | | | | | | 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 |
test binary-31.1 {Tcl_BinaryObjCmd: scan} {
list [catch {binary scan abc f} msg] $msg
} {1 {not enough arguments for all format specifiers}}
test binary-31.2 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f* arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-31.3 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f* arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-31.4 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f arg1] $arg1
} {1 1.600000023841858}
test binary-31.5 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f arg1] $arg1
} {1 1.600000023841858}
test binary-31.6 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd f1 arg1] $arg1
} {1 1.600000023841858}
test binary-31.7 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f f1 arg1] $arg1
} {1 1.600000023841858}
test binary-31.8 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd f0 arg1] $arg1
} {1 {}}
test binary-31.9 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f f0 arg1] $arg1
} {1 {}}
test binary-31.10 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f2 arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-31.11 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f2 arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-31.12 {Tcl_BinaryObjCmd: scan} {
catch {unset arg1}
set arg1 foo
list [binary scan \x52 f1 arg1] $arg1
} {0 foo}
test binary-31.13 {Tcl_BinaryObjCmd: scan} {
catch {unset arg1}
set arg1 1
list [catch {binary scan \x3f\xcc\xcc\xcd f1 arg1(a)} msg] $msg
} {1 {can't set "arg1(a)": variable isn't array}}
test binary-31.14 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a\x05 f2c* arg1 arg2] $arg1 $arg2
} {2 {1.600000023841858 3.4000000953674316} 5}
test binary-31.15 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40\x05 f2c* arg1 arg2] $arg1 $arg2
} {2 {1.600000023841858 3.4000000953674316} 5}
test binary-32.1 {Tcl_BinaryObjCmd: scan} {
list [catch {binary scan abc d} msg] $msg
} {1 {not enough arguments for all format specifiers}}
test binary-32.2 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d* arg1] $arg1
|
| ︙ | ︙ | |||
1387 1388 1389 1390 1391 1392 1393 |
test binary-40.1 {ScanNumber: floating point overflow} {nonPortable bigEndian} {
catch {unset arg1}
list [binary scan \xff\xff\xff\xff f1 arg1] $arg1
} {1 -NaN}
test binary-40.3 {ScanNumber: floating point overflow} {littleEndian win} {
catch {unset arg1}
set result [binary scan \xff\xff\xff\xff f1 arg1]
| < | < < < | < | < < < | | | | 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 |
test binary-40.1 {ScanNumber: floating point overflow} {nonPortable bigEndian} {
catch {unset arg1}
list [binary scan \xff\xff\xff\xff f1 arg1] $arg1
} {1 -NaN}
test binary-40.3 {ScanNumber: floating point overflow} {littleEndian win} {
catch {unset arg1}
set result [binary scan \xff\xff\xff\xff f1 arg1]
lappend result [regexp -nocase NaN $arg1]
} {1 1}
test binary-40.4 {ScanNumber: floating point overflow} {nonPortable bigEndian} {
catch {unset arg1}
list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d1 arg1] $arg1
} {1 -NaN}
test binary-40.6 {ScanNumber: floating point overflow} {littleEndian win} {
catch {unset arg1}
set result [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d1 arg1]
lappend result [regexp -nocase NaN $arg1]
} {1 1}
test binary-41.1 {ScanNumber: word alignment} {
catch {unset arg1; unset arg2}
list [binary scan \x01\x01\x00 c1s1 arg1 arg2] $arg1 $arg2
} {2 1 1}
test binary-41.2 {ScanNumber: word alignment} {
catch {unset arg1; unset arg2}
list [binary scan \x01\x00\x01 c1S1 arg1 arg2] $arg1 $arg2
} {2 1 1}
test binary-41.3 {ScanNumber: word alignment} {
catch {unset arg1; unset arg2}
list [binary scan \x01\x01\x00\x00\x00 c1i1 arg1 arg2] $arg1 $arg2
} {2 1 1}
test binary-41.4 {ScanNumber: word alignment} {
catch {unset arg1; unset arg2}
list [binary scan \x01\x00\x00\x00\x01 c1I1 arg1 arg2] $arg1 $arg2
} {2 1 1}
test binary-41.5 {ScanNumber: word alignment} bigEndian {
catch {unset arg1; unset arg2}
list [binary scan \x01\x3f\xcc\xcc\xcd c1f1 arg1 arg2] $arg1 $arg2
} {2 1 1.600000023841858}
test binary-41.6 {ScanNumber: word alignment} littleEndian {
catch {unset arg1; unset arg2}
list [binary scan \x01\xcd\xcc\xcc\x3f c1f1 arg1 arg2] $arg1 $arg2
} {2 1 1.600000023841858}
test binary-41.7 {ScanNumber: word alignment} bigEndian {
catch {unset arg1; unset arg2}
list [binary scan \x01\x3f\xf9\x99\x99\x99\x99\x99\x9a c1d1 arg1 arg2] $arg1 $arg2
} {2 1 1.6}
test binary-41.8 {ScanNumber: word alignment} littleEndian {
catch {unset arg1; unset arg2}
list [binary scan \x01\x9a\x99\x99\x99\x99\x99\xf9\x3f c1d1 arg1 arg2] $arg1 $arg2
|
| ︙ | ︙ | |||
1935 1936 1937 1938 1939 1940 1941 |
} {1 {can't set "arg1(a)": variable isn't array}}
test binary-57.9 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 n2c* arg1 arg2] $arg1 $arg2
} {2 {1386435412 16909060} 5}
| < < < < < < < < < < < < < < < < < < < | 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 |
} {1 {can't set "arg1(a)": variable isn't array}}
test binary-57.9 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 n2c* arg1 arg2] $arg1 $arg2
} {2 {1386435412 16909060} 5}
# scan Q/q
test binary-58.1 {Tcl_BinaryObjCmd: scan} {
list [catch {binary scan abc q} msg] $msg
} {1 {not enough arguments for all format specifiers}}
test binary-58.2 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
|
| ︙ | ︙ | |||
2029 2030 2031 2032 2033 2034 2035 |
# scan R/r
test binary-59.1 {Tcl_BinaryObjCmd: scan} {
list [catch {binary scan abc r} msg] $msg
} {1 {not enough arguments for all format specifiers}}
test binary-59.2 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a R* arg1] $arg1
| | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > | 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 2088 2089 2090 2091 2092 2093 2094 2095 2096 |
# scan R/r
test binary-59.1 {Tcl_BinaryObjCmd: scan} {
list [catch {binary scan abc r} msg] $msg
} {1 {not enough arguments for all format specifiers}}
test binary-59.2 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a R* arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-59.3 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 r* arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-59.4 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a R arg1] $arg1
} {1 1.600000023841858}
test binary-59.5 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 r arg1] $arg1
} {1 1.600000023841858}
test binary-59.6 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd R1 arg1] $arg1
} {1 1.600000023841858}
test binary-59.7 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f r1 arg1] $arg1
} {1 1.600000023841858}
test binary-59.8 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd R0 arg1] $arg1
} {1 {}}
test binary-59.9 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f r0 arg1] $arg1
} {1 {}}
test binary-59.10 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1}
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a R2 arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-59.11 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1}
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 r2 arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-59.12 {Tcl_BinaryObjCmd: scan} {
catch {unset arg1}
set arg1 foo
list [binary scan \x52 r1 arg1] $arg1
} {0 foo}
test binary-59.13 {Tcl_BinaryObjCmd: scan} {
catch {unset arg1}
set arg1 1
list [catch {binary scan \x3f\xcc\xcc\xcd r1 arg1(a)} msg] $msg
} {1 {can't set "arg1(a)": variable isn't array}}
test binary-59.14 {Tcl_BinaryObjCmd: scan} bigEndian {
catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a\x05 R2c* arg1 arg2] $arg1 $arg2
} {2 {1.600000023841858 3.4000000953674316} 5}
test binary-59.15 {Tcl_BinaryObjCmd: scan} littleEndian {
catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40\x05 r2c* arg1 arg2] $arg1 $arg2
} {2 {1.600000023841858 3.4000000953674316} 5}
test binary-60.1 {[binary format] with NaN} -body {
binary scan [binary format dqQfrR NaN NaN NaN NaN NaN NaN] dqQfrR \
v1 v2 v3 v4 v5 v6
list $v1 $v2 $v3 $v4 $v5 $v6
} -match regexp -result {NaN(\([[:xdigit:]]+\))? NaN(\([[:xdigit:]]+\))? NaN(\([[:xdigit:]]+\))? NaN(\([[:xdigit:]]+\))? NaN(\([[:xdigit:]]+\))? NaN(\([[:xdigit:]]+\))?}
# scan m
test binary-61.1 {Tcl_BinaryObjCmd: scan wide int} bigEndian {
binary scan HelloTcl m x
set x
} 5216694956358656876
test binary-61.2 {Tcl_BinaryObjCmd: scan wide int} littleEndian {
binary scan lcTolleH m x
set x
} 5216694956358656876
test binary-61.3 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} littleEndian {
binary scan [binary format w [expr {wide(3) << 31}]] m x
set x
} 6442450944
test binary-61.4 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} bigEndian {
binary scan [binary format W [expr {wide(3) << 31}]] m x
set x
} 6442450944
# cleanup
::tcltest::cleanupTests
return
|
Added tests/chan.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 |
# This file contains a collection of tests for the Tcl built-in 'chan'
# command. Sourcing this file into Tcl runs the tests and generates
# output for errors. No output means no errors were found.
#
# Copyright (c) 2005 Donal K. Fellows
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: chan.test,v 1.4.2.2 2005/06/13 01:46:40 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
test chan-1.1 {chan command general syntax} -body {
chan
} -returnCodes error -result "wrong # args: should be \"chan subcommand ?argument ...?\""
test chan-1.2 {chan command general syntax} -body {
chan FOOBAR
} -returnCodes error -result "unknown or ambiguous subcommand \"FOOBAR\": must be blocked, close, configure, copy, eof, event, flush, gets, names, puts, read, seek, tell, or truncate"
test chan-2.1 {chan command: blocked subcommand} -body {
chan blocked foo bar
} -returnCodes error -result "wrong # args: should be \"chan blocked channelId\""
test chan-3.1 {chan command: close subcommand} -body {
chan close foo bar
} -returnCodes error -result "wrong # args: should be \"chan close channelId\""
test chan-4.1 {chan command: configure subcommand} -body {
chan configure
} -returnCodes error -result "wrong # args: should be \"chan configure channelId ?optionName? ?value? ?optionName value?...\""
test chan-5.1 {chan command: copy subcommand} -body {
chan copy foo
} -returnCodes error -result "wrong # args: should be \"chan copy input output ?-size size? ?-command callback?\""
test chan-6.1 {chan command: eof subcommand} -body {
chan eof foo bar
} -returnCodes error -result "wrong # args: should be \"chan eof channelId\""
test chan-7.1 {chan command: event subcommand} -body {
chan event foo
} -returnCodes error -result "wrong # args: should be \"chan event channelId event ?script?\""
test chan-8.1 {chan command: flush subcommand} -body {
chan flush foo bar
} -returnCodes error -result "wrong # args: should be \"chan flush channelId\""
test chan-9.1 {chan command: gets subcommand} -body {
chan gets
} -returnCodes error -result "wrong # args: should be \"chan gets channelId ?varName?\""
test chan-10.1 {chan command: names subcommand} -body {
chan names foo bar
} -returnCodes error -result "wrong # args: should be \"chan names ?pattern?\""
test chan-11.1 {chan command: puts subcommand} -body {
chan puts foo bar foo bar
} -returnCodes error -result "wrong # args: should be \"chan puts ?-nonewline? ?channelId? string\""
test chan-12.1 {chan command: read subcommand} -body {
chan read
} -returnCodes error -result "wrong # args: should be \"chan read channelId ?numChars?\" or \"chan read ?-nonewline? channelId\""
test chan-13.1 {chan command: seek subcommand} -body {
chan seek foo bar foo bar
} -returnCodes error -result "wrong # args: should be \"chan seek channelId offset ?origin?\""
test chan-14.1 {chan command: tell subcommand} -body {
chan tell foo bar
} -returnCodes error -result "wrong # args: should be \"chan tell channelId\""
test chan-15.1 {chan command: truncate subcommand} -body {
chan truncate foo bar foo bar
} -returnCodes error -result "wrong \# args: should be \"chan truncate channelId ?length?\""
test chan-15.2 {chan command: truncate subcommand} -setup {
set file [makeFile {} testTruncate]
set f [open $file w+]
fconfigure $f -translation binary
} -body {
seek $f 0
puts -nonewline $f 12345
seek $f 0
chan truncate $f 2
read $f
} -result 12 -cleanup {
catch {close $f}
catch {removeFile $file}
}
cleanupTests
return
# Local Variables:
# mode: tcl
# End:
|
Changes to tests/clock.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # clock.test -- # # This test file covers the 'clock' command that manipulates time. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# clock.test --
#
# This test file covers the 'clock' command that manipulates time.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 2004 by Kevin B. Kenny. All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: clock.test,v 1.53.2.1 2005/06/13 01:46:40 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
if { $::tcl_platform(platform) eq {windows} } {
|
| ︙ | ︙ | |||
35394 35395 35396 35397 35398 35399 35400 35401 35402 35403 35404 35405 35406 35407 35408 35409 35410 35411 |
test clock-47.1 {regression test - four-digit time} {
clock scan 0012
} [clock scan 0012 -format %H%M]
test clock-47.2 {regression test - four digit time} {
clock scan 0039
} [clock scan 0039 -format %H%M]
# cleanup
namespace delete ::testClock
::tcl::clock::ClearCaches
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
| > > > > > > > > > > > > | 35394 35395 35396 35397 35398 35399 35400 35401 35402 35403 35404 35405 35406 35407 35408 35409 35410 35411 35412 35413 35414 35415 35416 35417 35418 35419 35420 35421 35422 35423 |
test clock-47.1 {regression test - four-digit time} {
clock scan 0012
} [clock scan 0012 -format %H%M]
test clock-47.2 {regression test - four digit time} {
clock scan 0039
} [clock scan 0039 -format %H%M]
test clock-48.1 {Bug 1185933: 'i' destroyed by clock init} -setup {
interp create child
} -body {
interp eval child {
set i 12345
clock format 0
list [catch { set i } result] $result
}
} -cleanup {
interp delete child
} -result {0 12345}
# cleanup
namespace delete ::testClock
::tcl::clock::ClearCaches
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
|
Changes to tests/cmdIL.test.
1 2 3 4 5 6 7 8 9 10 | # This file contains a collection of tests for the procedures in the # file tclCmdIL.c. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# This file contains a collection of tests for the procedures in the
# file tclCmdIL.c. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: cmdIL.test,v 1.23.4.1 2005/06/13 01:46:44 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
# Used for constraining memory leak tests
testConstraint memory [llength [info commands memory]]
test cmdIL-1.1 {Tcl_LsortObjCmd procedure} {
list [catch {lsort} msg] $msg
} {1 {wrong # args: should be "lsort ?options? list"}}
test cmdIL-1.2 {Tcl_LsortObjCmd procedure} {
list [catch {lsort -foo {1 3 2 5}} msg] $msg
} {1 {bad option "-foo": must be -ascii, -command, -decreasing, -dictionary, -increasing, -index, -indices, -integer, -nocase, -real, or -unique}}
test cmdIL-1.3 {Tcl_LsortObjCmd procedure, default options} {
lsort {d e c b a \{ d35 d300}
} {a b c d d300 d35 e \{}
test cmdIL-1.4 {Tcl_LsortObjCmd procedure, -ascii option} {
lsort -integer -ascii {d e c b a d35 d300}
} {a b c d d300 d35 e}
test cmdIL-1.5 {Tcl_LsortObjCmd procedure, -command option} {
|
| ︙ | ︙ | |||
55 56 57 58 59 60 61 |
lsort -decreasing -increasing {d e c b a d35 d300}
} {a b c d d300 d35 e}
test cmdIL-1.11 {Tcl_LsortObjCmd procedure, -index option} {
list [catch {lsort -index {1 3 2 5}} msg] $msg
} {1 {"-index" option must be followed by list index}}
test cmdIL-1.12 {Tcl_LsortObjCmd procedure, -index option} {
list [catch {lsort -index foo {1 3 2 5}} msg] $msg
| | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
lsort -decreasing -increasing {d e c b a d35 d300}
} {a b c d d300 d35 e}
test cmdIL-1.11 {Tcl_LsortObjCmd procedure, -index option} {
list [catch {lsort -index {1 3 2 5}} msg] $msg
} {1 {"-index" option must be followed by list index}}
test cmdIL-1.12 {Tcl_LsortObjCmd procedure, -index option} {
list [catch {lsort -index foo {1 3 2 5}} msg] $msg
} {1 {bad index "foo": must be integer?[+-]integer? or end?[+-]integer?}}
test cmdIL-1.13 {Tcl_LsortObjCmd procedure, -index option} {
lsort -index end -integer {{2 25} {10 20 50 100} {3 16 42} 1}
} {1 {2 25} {3 16 42} {10 20 50 100}}
test cmdIL-1.14 {Tcl_LsortObjCmd procedure, -index option} {
lsort -index 1 -integer {{1 25 100} {3 16 42} {10 20 50}}
} {{3 16 42} {10 20 50} {1 25 100}}
test cmdIL-1.15 {Tcl_LsortObjCmd procedure, -integer option} {
|
| ︙ | ︙ | |||
379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
} [list ` AA c CC]
test cmdIL-4.32 {DictionaryCompare procedure, chars between Z and a in ASCII} {
lsort -dictionary [list AA c CC `]
} [list ` AA c CC]
test cmdIL-4.33 {DictionaryCompare procedure, chars between Z and a in ASCII} {
lsort -dictionary [list AA ! c CC `]
} [list ! ` AA c CC]
test cmdIL-5.1 {lsort with list style index} {
lsort -ascii -decreasing -index {0 1} {
{{Jim Alpha} 20000410}
{{Joe Bravo} 19990320}
{{Jacky Charlie} 19390911}
}
| > > > > > > | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
} [list ` AA c CC]
test cmdIL-4.32 {DictionaryCompare procedure, chars between Z and a in ASCII} {
lsort -dictionary [list AA c CC `]
} [list ` AA c CC]
test cmdIL-4.33 {DictionaryCompare procedure, chars between Z and a in ASCII} {
lsort -dictionary [list AA ! c CC `]
} [list ! ` AA c CC]
test cmdIL-4.34 {SortCompare procedure, -ascii option with -nocase option} {
lsort -ascii -nocase {d e c b a d35 d300 100 20}
} {100 20 a b c d d300 d35 e}
test cmdIL-4.35 {SortCompare procedure, -ascii option with -nocase option} {
lsort -ascii -nocase {d E c B a D35 d300 100 20}
} {100 20 a B c d d300 D35 E}
test cmdIL-5.1 {lsort with list style index} {
lsort -ascii -decreasing -index {0 1} {
{{Jim Alpha} 20000410}
{{Joe Bravo} 19990320}
{{Jacky Charlie} 19390911}
}
|
| ︙ | ︙ |
Changes to tests/compExpr-old.test.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # # Copyright (c) 1996-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 8 9 10 11 12 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 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 |
#
# Copyright (c) 1996-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: compExpr-old.test,v 1.11.4.1 2005/06/13 01:46:45 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} {
testConstraint testmathfunctions 0
} else {
testConstraint testmathfunctions 1
}
# Big test for correct ordering of data in [expr]
proc testIEEE {} {
variable ieeeValues
binary scan [binary format dd -1.0 1.0] c* c
switch -exact -- $c {
{0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
# little endian
binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \
ieeeValues(-Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \
ieeeValues(-Normal)
binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
ieeeValues(-Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
ieeeValues(+Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \
ieeeValues(+Normal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \
ieeeValues(+Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 1
return 1
}
{-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Infinity)
binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Normal)
binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Subnormal)
binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Subnormal)
binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Normal)
binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Infinity)
binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 0
return 1
}
default {
return 0
}
}
}
::tcltest::testConstraint ieeeFloatingPoint [testIEEE]
# procedures used below
proc put_hello_char {c} {
global a
append a [format %c $c]
return $c
}
|
| ︙ | ︙ | |||
139 140 141 142 143 144 145 |
set msg
} {syntax error in expression "7*2foo": extra tokens at end of expression}
test compExpr-old-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} {
expr {0001}
} 1
test compExpr-old-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1
| | > | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
set msg
} {syntax error in expression "7*2foo": extra tokens at end of expression}
test compExpr-old-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} {
expr {0001}
} 1
test compExpr-old-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1
test compExpr-old-3.2 {CompileCondExpr: error in lor expr} -body {
catch {expr x||3} msg
set msg
} -match glob \
-result {syntax error in expression "x||3": * preceding $*}
test compExpr-old-3.3 {CompileCondExpr: test true arm} {expr 3>2?44:66} 44
test compExpr-old-3.4 {CompileCondExpr: error compiling true arm} {
catch {expr 3>2?2***3:66} msg
set msg
} {syntax error in expression "3>2?2***3:66": unexpected operator *}
test compExpr-old-3.5 {CompileCondExpr: test false arm} {expr 2>3?44:66} 66
test compExpr-old-3.6 {CompileCondExpr: error compiling false arm} {
|
| ︙ | ︙ | |||
165 166 167 168 169 170 171 |
test compExpr-old-3.8 {CompileCondExpr: long arms & nested cond exprs} {nonPortable} {
puts "Note: doing test compExpr-old-3.8 which can take several minutes to run"
do_twelve_days
} 2358
catch {unset xxx}
test compExpr-old-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1
| | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
test compExpr-old-3.8 {CompileCondExpr: long arms & nested cond exprs} {nonPortable} {
puts "Note: doing test compExpr-old-3.8 which can take several minutes to run"
do_twelve_days
} 2358
catch {unset xxx}
test compExpr-old-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1
test compExpr-old-4.2 {CompileLorExpr: error in land expr} -body {
catch {expr x&&3} msg
set msg
} -match glob -result {syntax error in expression "x&&3": * preceding $*}
test compExpr-old-4.3 {CompileLorExpr: simple lor exprs} {expr 0||1.0} 1
test compExpr-old-4.4 {CompileLorExpr: simple lor exprs} {expr 3.0||0.0} 1
test compExpr-old-4.5 {CompileLorExpr: simple lor exprs} {expr 0||0||1} 1
test compExpr-old-4.6 {CompileLorExpr: error compiling lor arm} {
catch {expr 2***3||4.0} msg
set msg
} {syntax error in expression "2***3||4.0": unexpected operator *}
|
| ︙ | ︙ | |||
190 191 192 193 194 195 196 |
test compExpr-old-4.9 {CompileLorExpr: long lor arm} {
set a "abcdefghijkl"
set i 7
expr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]}
} 1
test compExpr-old-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23
| | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
test compExpr-old-4.9 {CompileLorExpr: long lor arm} {
set a "abcdefghijkl"
set i 7
expr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]}
} 1
test compExpr-old-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23
test compExpr-old-5.2 {CompileLandExpr: error in bitor expr} -body {
catch {expr x|3} msg
set msg
} -match glob -result {syntax error in expression "x|3": * preceding $*}
test compExpr-old-5.3 {CompileLandExpr: simple land exprs} {expr 0&&1.0} 0
test compExpr-old-5.4 {CompileLandExpr: simple land exprs} {expr 0&&0} 0
test compExpr-old-5.5 {CompileLandExpr: simple land exprs} {expr 3.0&&1.2} 1
test compExpr-old-5.6 {CompileLandExpr: simple land exprs} {expr 1&&1&&2} 1
test compExpr-old-5.7 {CompileLandExpr: error compiling land arm} {
catch {expr 2***3&&4.0} msg
set msg
|
| ︙ | ︙ | |||
216 217 218 219 220 221 222 |
test compExpr-old-5.10 {CompileLandExpr: long land arms} {
set a "abcdefghijkl"
set i 7
expr {[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]}
} 1
test compExpr-old-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3
| | | | | | | | | | | | | | | | | | | | | | | | | | > > > | | | | | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
test compExpr-old-5.10 {CompileLandExpr: long land arms} {
set a "abcdefghijkl"
set i 7
expr {[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]}
} 1
test compExpr-old-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3
test compExpr-old-6.2 {CompileBitXorExpr: error in bitand expr} -body {
catch {expr x|3} msg
set msg
} -match glob -result {syntax error in expression "x|3": * preceding $*}
test compExpr-old-6.3 {CompileBitXorExpr: simple bitxor exprs} {expr 7^0x13} 20
test compExpr-old-6.4 {CompileBitXorExpr: simple bitxor exprs} {expr 3^0x10} 19
test compExpr-old-6.5 {CompileBitXorExpr: simple bitxor exprs} {expr 0^7} 7
test compExpr-old-6.6 {CompileBitXorExpr: simple bitxor exprs} {expr -1^7} -8
test compExpr-old-6.7 {CompileBitXorExpr: error compiling bitxor arm} {
catch {expr 2***3|6} msg
set msg
} {syntax error in expression "2***3|6": unexpected operator *}
test compExpr-old-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body {
catch {expr 2^x} msg
set msg
} -match glob -result {syntax error in expression "2^x": * preceding $*}
test compExpr-old-6.9 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {24.0^3}} msg] $msg
} {1 {can't use floating-point value as operand of "^"}}
test compExpr-old-6.10 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {"a"^"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "^"}}
test compExpr-old-7.1 {CompileBitAndExpr: just equality expr} {expr 3==2} 0
test compExpr-old-7.2 {CompileBitAndExpr: just equality expr} {expr 2.0==2} 1
test compExpr-old-7.3 {CompileBitAndExpr: just equality expr} {expr 3.2!=2.2} 1
test compExpr-old-7.4 {CompileBitAndExpr: just equality expr} {expr {"abc" == "abd"}} 0
test compExpr-old-7.5 {CompileBitAndExpr: error in equality expr} -body {
catch {expr x==3} msg
set msg
} -match glob -result {syntax error in expression "x==3": * preceding $*}
test compExpr-old-7.6 {CompileBitAndExpr: simple bitand exprs} {expr 7&0x13} 3
test compExpr-old-7.7 {CompileBitAndExpr: simple bitand exprs} {expr 0xf2&0x53} 82
test compExpr-old-7.8 {CompileBitAndExpr: simple bitand exprs} {expr 3&6} 2
test compExpr-old-7.9 {CompileBitAndExpr: simple bitand exprs} {expr -1&-7} -7
test compExpr-old-7.10 {CompileBitAndExpr: error compiling bitand arm} {
catch {expr 2***3&6} msg
set msg
} {syntax error in expression "2***3&6": unexpected operator *}
test compExpr-old-7.11 {CompileBitAndExpr: error compiling bitand arm} -body {
catch {expr 2&x} msg
set msg
} -match glob -result {syntax error in expression "2&x": * preceding $*}
test compExpr-old-7.12 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {24.0&3}} msg] $msg
} {1 {can't use floating-point value as operand of "&"}}
test compExpr-old-7.13 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {"a"&"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "&"}}
test compExpr-old-8.1 {CompileEqualityExpr: just relational expr} {expr 3>=2} 1
test compExpr-old-8.2 {CompileEqualityExpr: just relational expr} {expr 2<=2.1} 1
test compExpr-old-8.3 {CompileEqualityExpr: just relational expr} {expr 3.2>"2.2"} 1
test compExpr-old-8.4 {CompileEqualityExpr: just relational expr} {expr {"0y"<"0x12"}} 0
test compExpr-old-8.5 {CompileEqualityExpr: error in relational expr} -body {
catch {expr x>3} msg
set msg
} -match glob -result {syntax error in expression "x>3": * preceding $*}
test compExpr-old-8.6 {CompileEqualityExpr: simple equality exprs} {expr 7==0x13} 0
test compExpr-old-8.7 {CompileEqualityExpr: simple equality exprs} {expr -0xf2!=0x53} 1
test compExpr-old-8.8 {CompileEqualityExpr: simple equality exprs} {expr {"12398712938788234-1298379" != ""}} 1
test compExpr-old-8.9 {CompileEqualityExpr: simple equality exprs} {expr -1!="abc"} 1
test compExpr-old-8.10 {CompileEqualityExpr: error compiling equality arm} {
catch {expr 2***3==6} msg
set msg
} {syntax error in expression "2***3==6": unexpected operator *}
test compExpr-old-8.11 {CompileEqualityExpr: error compiling equality arm} -body {
catch {expr 2!=x} msg
set msg
} -match glob -result {syntax error in expression "2!=x": * preceding $*}
test compExpr-old-9.1 {CompileRelationalExpr: just shift expr} {expr 3<<2} 12
test compExpr-old-9.2 {CompileRelationalExpr: just shift expr} {expr 0xff>>2} 63
test compExpr-old-9.3 {CompileRelationalExpr: just shift expr} {expr -1>>2} -1
test compExpr-old-9.4 {CompileRelationalExpr: just shift expr} {expr {1<<3}} 8
# The following test is different for 32-bit versus 64-bit
# architectures because LONG_MIN is different
if {int(0x80000000) > 0} {
test compExpr-old-9.5 {CompileRelationalExpr: shift expr producing LONG_MIN} {nonPortable} {
expr {1<<63}
} -9223372036854775808
} else {
test compExpr-old-9.5 {CompileRelationalExpr: shift expr producing LONG_MIN} {nonPortable} {
expr {1<<31}
} -2147483648
}
test compExpr-old-9.6 {CompileRelationalExpr: error in shift expr} -body {
catch {expr x>>3} msg
set msg
} -match glob -result {syntax error in expression "x>>3": * preceding $*}
test compExpr-old-9.7 {CompileRelationalExpr: simple relational exprs} {expr 0xff>=+0x3} 1
test compExpr-old-9.8 {CompileRelationalExpr: simple relational exprs} {expr -0xf2<0x3} 1
test compExpr-old-9.9 {CompileRelationalExpr: error compiling relational arm} {
catch {expr 2***3>6} msg
set msg
} {syntax error in expression "2***3>6": unexpected operator *}
test compExpr-old-9.10 {CompileRelationalExpr: error compiling relational arm} -body {
catch {expr 2<x} msg
set msg
} -match glob -result {syntax error in expression "2<x": * preceding $*}
test compExpr-old-10.1 {CompileShiftExpr: just add expr} {expr 4+-2} 2
test compExpr-old-10.2 {CompileShiftExpr: just add expr} {expr 0xff-2} 253
test compExpr-old-10.3 {CompileShiftExpr: just add expr} {expr -1--2} 1
test compExpr-old-10.4 {CompileShiftExpr: just add expr} {expr 1-0123} -82
test compExpr-old-10.5 {CompileShiftExpr: error in add expr} -body {
catch {expr x+3} msg
set msg
} -match glob -result {syntax error in expression "x+3": * preceding $*}
test compExpr-old-10.6 {CompileShiftExpr: simple shift exprs} {expr 0xff>>0x3} 31
test compExpr-old-10.7 {CompileShiftExpr: simple shift exprs} {expr -0xf2<<0x3} -1936
test compExpr-old-10.8 {CompileShiftExpr: error compiling shift arm} {
catch {expr 2***3>>6} msg
set msg
} {syntax error in expression "2***3>>6": unexpected operator *}
test compExpr-old-10.9 {CompileShiftExpr: error compiling shift arm} -body {
catch {expr 2<<x} msg
set msg
} -match glob -result {syntax error in expression "2<<x": * preceding $*}
test compExpr-old-10.10 {CompileShiftExpr: runtime error} {
list [catch {expr {24.0>>43}} msg] $msg
} {1 {can't use floating-point value as operand of ">>"}}
test compExpr-old-10.11 {CompileShiftExpr: runtime error} {
list [catch {expr {"a"<<"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "<<"}}
test compExpr-old-11.1 {CompileAddExpr: just multiply expr} {expr 4*-2} -8
test compExpr-old-11.2 {CompileAddExpr: just multiply expr} {expr 0xff%2} 1
test compExpr-old-11.3 {CompileAddExpr: just multiply expr} {expr -1/2} -1
test compExpr-old-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6
test compExpr-old-11.5 {CompileAddExpr: error in multiply expr} -body {
catch {expr x*3} msg
set msg
} -match glob -result {syntax error in expression "x*3": * preceding $*}
test compExpr-old-11.6 {CompileAddExpr: simple add exprs} {expr 0xff++0x3} 258
test compExpr-old-11.7 {CompileAddExpr: simple add exprs} {expr -0xf2--0x3} -239
test compExpr-old-11.8 {CompileAddExpr: error compiling add arm} {
catch {expr 2***3+6} msg
set msg
} {syntax error in expression "2***3+6": unexpected operator *}
test compExpr-old-11.9 {CompileAddExpr: error compiling add arm} -body {
catch {expr 2-x} msg
set msg
} -match glob -result {syntax error in expression "2-x": * preceding $*}
test compExpr-old-11.10 {CompileAddExpr: runtime error} {
list [catch {expr {24.0+"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "+"}}
test compExpr-old-11.11 {CompileAddExpr: runtime error} {
list [catch {expr {"a"-"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "-"}}
test compExpr-old-11.12 {CompileAddExpr: runtime error} {
list [catch {expr {3/0}} msg] $msg
} {1 {divide by zero}}
test compExpr-old-11.13a {CompileAddExpr: runtime error} ieeeFloatingPoint {
list [catch {expr {2.3/0.0}} msg] $msg
} {0 Inf}
test compExpr-old-11.13b {CompileAddExpr: runtime error} !ieeeFloatingPoint {
list [catch {expr {2.3/0.0}} msg] $msg
} {1 {divide by zero}}
test compExpr-old-12.1 {CompileMultiplyExpr: just unary expr} {expr ~4} -5
test compExpr-old-12.2 {CompileMultiplyExpr: just unary expr} {expr --5} 5
test compExpr-old-12.3 {CompileMultiplyExpr: just unary expr} {expr !27} 0
test compExpr-old-12.4 {CompileMultiplyExpr: just unary expr} {expr ~0xff00ff} -16711936
test compExpr-old-12.5 {CompileMultiplyExpr: error in unary expr} -body {
catch {expr ~x} msg
set msg
} -match glob -result {syntax error in expression "~x": * preceding $*}
test compExpr-old-12.6 {CompileMultiplyExpr: simple multiply exprs} {expr 0xff*0x3} 765
test compExpr-old-12.7 {CompileMultiplyExpr: simple multiply exprs} {expr -0xf2%-0x3} -2
test compExpr-old-12.8 {CompileMultiplyExpr: error compiling multiply arm} {
catch {expr 2*3%%6} msg
set msg
} {syntax error in expression "2*3%%6": unexpected operator %}
test compExpr-old-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body {
catch {expr 2*x} msg
set msg
} -match glob -result {syntax error in expression "2*x": * preceding $*}
test compExpr-old-12.10 {CompileMultiplyExpr: runtime error} {
list [catch {expr {24.0*"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "*"}}
test compExpr-old-12.11 {CompileMultiplyExpr: runtime error} {
list [catch {expr {"a"/"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "/"}}
test compExpr-old-13.1 {CompileUnaryExpr: unary exprs} {expr -0xff} -255
test compExpr-old-13.2 {CompileUnaryExpr: unary exprs} {expr +000123} 83
test compExpr-old-13.3 {CompileUnaryExpr: unary exprs} {expr +--++36} 36
test compExpr-old-13.4 {CompileUnaryExpr: unary exprs} {expr !2} 0
test compExpr-old-13.5 {CompileUnaryExpr: unary exprs} {expr +--+-62.0} -62.0
test compExpr-old-13.6 {CompileUnaryExpr: unary exprs} {expr !0.0} 1
test compExpr-old-13.7 {CompileUnaryExpr: unary exprs} {expr !0xef} 0
test compExpr-old-13.8 {CompileUnaryExpr: error compiling unary expr} -body {
catch {expr ~x} msg
set msg
} -match glob -result {syntax error in expression "~x": * preceding $*}
test compExpr-old-13.9 {CompileUnaryExpr: error compiling unary expr} {
catch {expr !1.x} msg
set msg
} {syntax error in expression "!1.x": extra tokens at end of expression}
test compExpr-old-13.10 {CompileUnaryExpr: runtime error} {
list [catch {expr {~"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "~"}}
|
| ︙ | ︙ | |||
525 526 527 528 529 530 531 |
} 2.71828
test compExpr-old-14.26 {CompilePrimaryExpr: math function primary} {
format %.6g [expr pow(2.0+0.1,3.0+0.1)]
} 9.97424
test compExpr-old-14.27 {CompilePrimaryExpr: error in math function primary} -body {
catch {expr sinh::(2.0)} msg
set errorInfo
| | | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
} 2.71828
test compExpr-old-14.26 {CompilePrimaryExpr: math function primary} {
format %.6g [expr pow(2.0+0.1,3.0+0.1)]
} 9.97424
test compExpr-old-14.27 {CompilePrimaryExpr: error in math function primary} -body {
catch {expr sinh::(2.0)} msg
set errorInfo
} -match glob -result {syntax error in expression "sinh::(2.0)": * function arguments*
while *ing
"expr sinh::(2.0)"}
test compExpr-old-14.28 {CompilePrimaryExpr: subexpression primary} {
expr 2+(3*4)
} 14
test compExpr-old-14.29 {CompilePrimaryExpr: error in subexpression primary} -body {
catch {expr 2+(3*[set])} msg
|
| ︙ | ︙ | |||
557 558 559 560 561 562 563 |
} -match glob -result {syntax error in expression "@": character not legal in expressions
while *ing
"expr @"}
test compExpr-old-15.1 {CompileMathFuncCall: missing parenthesis} -body {
catch {expr sinh2.0)} msg
set errorInfo
| | | | | | | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 |
} -match glob -result {syntax error in expression "@": character not legal in expressions
while *ing
"expr @"}
test compExpr-old-15.1 {CompileMathFuncCall: missing parenthesis} -body {
catch {expr sinh2.0)} msg
set errorInfo
} -match glob -result {syntax error in expression "sinh2.0)": * preceding $*
while *ing
"expr sinh2.0)"}
test compExpr-old-15.2 {CompileMathFuncCall: unknown math function} -body {
catch {expr whazzathuh(1)} msg
set errorInfo
} -match glob -result {* "*whazzathuh"
while *ing
"expr whazzathuh(1)"}
test compExpr-old-15.3 {CompileMathFuncCall: too many arguments} -body {
catch {expr sin(1,2,3)} msg
set errorInfo
} -match glob -result {too many arguments for math function*
while *ing
"expr sin(1,2,3)"}
test compExpr-old-15.4 {CompileMathFuncCall: ')' found before last required arg} -body {
catch {expr sin()} msg
set errorInfo
} -match glob -result {too few arguments for math function*
while *ing
"expr sin()"}
test compExpr-old-15.5 {CompileMathFuncCall: too few arguments} -body {
catch {expr pow(1)} msg
set errorInfo
} -match glob -result {too few arguments for math function*
while *ing
"expr pow(1)"}
test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} -body {
catch {expr sin(1} msg
set errorInfo
} -match glob -result {syntax error in expression "sin(1": missing close parenthesis at end of function call
while *ing
|
| ︙ | ︙ |
Changes to tests/compExpr.test.
1 2 3 4 5 6 7 8 9 10 | # This file contains a collection of tests for the procedures in the # file tclCompExpr.c. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# This file contains a collection of tests for the procedures in the
# file tclCompExpr.c. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: compExpr.test,v 1.8.4.1 2005/06/13 01:46:45 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} {
testConstraint testmathfunctions 0
} else {
testConstraint testmathfunctions 1
}
catch {unset a}
test compExpr-1.1 {TclCompileExpr procedure, successful expr parse and compile} {
expr 1+2
} 3
test compExpr-1.2 {TclCompileExpr procedure, error parsing expr} {
list [catch {expr 1+2+} msg] $msg
} {1 {syntax error in expression "1+2+": premature end of expression}}
test compExpr-1.3 {TclCompileExpr procedure, error compiling expr} -body {
list [catch {expr "foo(123)"} msg] $msg
} -match glob -result {1 {* "*foo"}}
test compExpr-1.4 {TclCompileExpr procedure, expr has no operators} {
set a {000123}
expr {$a}
} 83
test compExpr-2.1 {CompileSubExpr procedure, TCL_TOKEN_WORD parse token} {
catch {unset a}
|
| ︙ | ︙ | |||
90 91 92 93 94 95 96 |
} {0 1}
test compExpr-2.14 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, op found} {
expr {5*6}
} 30
test compExpr-2.15 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, math function found} {
format %.6g [expr {sin(2.0)}]
} 0.909297
| | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
} {0 1}
test compExpr-2.14 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, op found} {
expr {5*6}
} 30
test compExpr-2.15 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, math function found} {
format %.6g [expr {sin(2.0)}]
} 0.909297
test compExpr-2.16 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, math function not found} -body {
list [catch {expr {fred(2.0)}} msg] $msg
} -match glob -result {1 {* "*fred"}}
test compExpr-2.17 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, normal operator} {
expr {4*2}
} 8
test compExpr-2.18 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, normal operator} {
expr {4/2}
} 2
test compExpr-2.19 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, normal operator} {
|
| ︙ | ︙ | |||
285 286 287 288 289 290 291 |
test compExpr-4.9 {CompileCondExpr procedure, error in "false" clause} {
list [catch {expr {1? 15 : [expr *2]}} msg] $msg
} {0 15}
test compExpr-5.1 {CompileMathFuncCall procedure, math function found} {
format %.6g [expr atan2(1.0, 2.0)]
} 0.463648
| | | | | | | | | | 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 |
test compExpr-4.9 {CompileCondExpr procedure, error in "false" clause} {
list [catch {expr {1? 15 : [expr *2]}} msg] $msg
} {0 15}
test compExpr-5.1 {CompileMathFuncCall procedure, math function found} {
format %.6g [expr atan2(1.0, 2.0)]
} 0.463648
test compExpr-5.2 {CompileMathFuncCall procedure, math function not found} -body {
list [catch {expr {do_it()}} msg] $msg
} -match glob -result {1 {* "*do_it"}}
test compExpr-5.3 {CompileMathFuncCall: call registered math function} testmathfunctions {
expr 3*T1()-1
} 368
test compExpr-5.4 {CompileMathFuncCall: call registered math function} testmathfunctions {
expr T2()*3
} 1035
test compExpr-5.5 {CompileMathFuncCall procedure, too few arguments} -body {
list [catch {expr {atan2(1.0)}} msg] $msg
} -match glob -result {1 {too few arguments for math function*}}
test compExpr-5.6 {CompileMathFuncCall procedure, complex argument} {
format %.6g [expr pow(2.1, 27.5-(24.4*(5%2)))]
} 9.97424
test compExpr-5.7 {CompileMathFuncCall procedure, error in argument} {
list [catch {expr {sinh(2.*)}} msg] $msg
} {1 {syntax error in expression "sinh(2.*)": unexpected close parenthesis}}
test compExpr-5.8 {CompileMathFuncCall procedure, too many arguments} -body {
list [catch {expr {sinh(2.0, 3.0)}} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
test compExpr-5.9 {CompileMathFuncCall procedure, too many arguments} -body {
list [catch {expr {0 <= rand(5.2)}} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
test compExpr-6.1 {LogSyntaxError procedure, error in expr longer than 60 chars} {
list [catch {expr {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1 foo 3} msg] $msg
} {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012...": extra tokens at end of expression}}
# cleanup
catch {unset a}
catch {unset b}
::tcltest::cleanupTests
return
|
Changes to tests/compile.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file contains tests for the files tclCompile.c, tclCompCmds.c # and tclLiteral.c # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 by Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file contains tests for the files tclCompile.c, tclCompCmds.c # and tclLiteral.c # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 by Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: compile.test,v 1.36.2.1 2005/06/13 01:46:45 msofer Exp $ package require tcltest 2 namespace import -force ::tcltest::* testConstraint exec [llength [info commands exec]] testConstraint memory [llength [info commands memory]] testConstraint testevalex [llength [info commands testevalex]] |
| ︙ | ︙ | |||
232 233 234 235 236 237 238 |
proc p {} {
# shared object - Interp result && Var 'r'
set r [list foobar]
# command that will add error to result
lindex a bogus
}
list [catch {p} msg] $msg
| | | | | | | | | 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 |
proc p {} {
# shared object - Interp result && Var 'r'
set r [list foobar]
# command that will add error to result
lindex a bogus
}
list [catch {p} msg] $msg
} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
test compile-11.2 {Tcl_Append*: ensure Tcl_ResetResult is used properly} {
proc p {} { set r [list foobar] ; string index a bogus }
list [catch {p} msg] $msg
} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
test compile-11.3 {Tcl_Append*: ensure Tcl_ResetResult is used properly} {
proc p {} { set r [list foobar] ; string index a 09 }
list [catch {p} msg] $msg
} {1 {bad index "09": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test compile-11.4 {Tcl_Append*: ensure Tcl_ResetResult is used properly} {
proc p {} { set r [list foobar] ; array set var {one two many} }
list [catch {p} msg] $msg
} {1 {list must have an even number of elements}}
test compile-11.5 {Tcl_Append*: ensure Tcl_ResetResult is used properly} {
proc p {} { set r [list foobar] ; incr foo }
list [catch {p} msg] $msg
} {1 {can't read "foo": no such variable}}
test compile-11.6 {Tcl_Append*: ensure Tcl_ResetResult is used properly} {
proc p {} { set r [list foobar] ; incr foo bogus }
list [catch {p} msg] $msg
} {1 {expected integer but got "bogus"}}
test compile-11.7 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
proc p {} { set r [list foobar] ; expr !a }
list [catch {p} msg] $msg
} -match glob -result {1 {syntax error in expression "!a": * preceding $*}}
test compile-11.8 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
proc p {} { set r [list foobar] ; expr {!a} }
list [catch {p} msg] $msg
} -match glob -result {1 {syntax error in expression "!a": * preceding $*}}
test compile-11.9 {Tcl_Append*: ensure Tcl_ResetResult is used properly} {
proc p {} { set r [list foobar] ; llength "\{" }
list [catch {p} msg] $msg
} {1 {unmatched open brace in list}}
#
# Special section for tests of tclLiteral.c
|
| ︙ | ︙ | |||
316 317 318 319 320 321 322 |
test compile-12.3 {check for a buffer overrun} -body {
proc crash {} {
puts $array([expr {a+2}])
}
crash
} -returnCodes error -cleanup {
rename crash {}
| | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
test compile-12.3 {check for a buffer overrun} -body {
proc crash {} {
puts $array([expr {a+2}])
}
crash
} -returnCodes error -cleanup {
rename crash {}
} -match glob -result {syntax error in expression "a+2": * preceding $*}
test compile-12.4 {TclCleanupLiteralTable segfault} -body {
# Tcl Bug 1001997
# Here, we're trying to test a case that causes a crash in
# TclCleanupLiteralTable. The conditions that we're trying to
# establish are:
# - TclCleanupLiteralTable is attempting to clean up a bytecode
# object in the literal table.
|
| ︙ | ︙ |
Changes to tests/encoding.test.
1 2 3 4 5 6 7 8 9 10 | # This file contains a collection of tests for tclEncoding.c # Sourcing this file into Tcl runs the tests and generates output for # errors. No output means no errors were found. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# This file contains a collection of tests for tclEncoding.c
# Sourcing this file into Tcl runs the tests and generates output for
# errors. No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: encoding.test,v 1.21.4.1 2005/06/13 01:46:45 msofer Exp $
package require tcltest 2
namespace import -force ::tcltest::*
proc toutf {args} {
global x
lappend x "toutf $args"
|
| ︙ | ︙ | |||
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 |
close $fb
# Difference should be empty.
set diff
} {}
}
}
file delete {expand}[glob -directory [temporaryDirectory] *.chars *.tcltestout]
# ===> Cut here <===
# EscapeFreeProc, GetTableEncoding, unilen
# are fully tested by the rest of this file
# cleanup
::tcltest::cleanupTests
return
| > > > > > > > > > > > > > | 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 |
close $fb
# Difference should be empty.
set diff
} {}
}
}
testConstraint testgetdefenc [llength [info commands testgetdefenc]]
test encoding-26.0 {Tcl_GetDefaultEncodingDir} -constraints {
testgetdefenc
} -setup {
set origDir [testgetdefenc]
testsetdefenc slappy
} -body {
testgetdefenc
} -cleanup {
testsetdefenc $origDir
} -result slappy
file delete {expand}[glob -directory [temporaryDirectory] *.chars *.tcltestout]
# ===> Cut here <===
# EscapeFreeProc, GetTableEncoding, unilen
# are fully tested by the rest of this file
# cleanup
::tcltest::cleanupTests
return
|
Changes to tests/env.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: none (tests environment variable implementation) # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: none (tests environment variable implementation)
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: env.test,v 1.20.4.1 2005/06/13 01:46:45 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
# Some tests require the "exec" command.
|
| ︙ | ︙ | |||
72 73 74 75 76 77 78 |
set names [lsort [array names env]]
if {$tcl_platform(platform) == "windows"} {
lrem names HOME
lrem names COMSPEC
lrem names ComSpec
lrem names ""
}
| | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
set names [lsort [array names env]]
if {$tcl_platform(platform) == "windows"} {
lrem names HOME
lrem names COMSPEC
lrem names ComSpec
lrem names ""
}
foreach name {TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH PURE_PROG_NAME DISPLAY SHLIB_PATH DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH __CF_USER_TEXT_ENCODING } {
lrem names $name
}
foreach p $names {
puts "$p=$env($p)"
}
exit
} printenv]
|
| ︙ | ︙ | |||
102 103 104 105 106 107 108 |
set env2($name) $env($name)
unset env($name)
}
# Added the following lines so that child tcltest can actually find its
# library if the initial tcltest is run from a non-standard place.
# ('saved' env vars)
| | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
set env2($name) $env($name)
unset env($name)
}
# Added the following lines so that child tcltest can actually find its
# library if the initial tcltest is run from a non-standard place.
# ('saved' env vars)
foreach name {TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH DISPLAY SHLIB_PATH DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH} {
if {[info exists env2($name)]} {
set env($name) $env2($name);
}
}
test env-2.1 {adding environment variables} {exec} {
getenv
|
| ︙ | ︙ |
Changes to tests/expr-old.test.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | # Copyright (c) 1991-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-2000 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 9 10 11 12 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 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 |
# Copyright (c) 1991-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: expr-old.test,v 1.23.2.1 2005/06/13 01:46:45 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
namespace import -force ::tcltest::*
}
if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} {
testConstraint testmathfunctions 0
} else {
testConstraint testmathfunctions 1
}
# Big test for correct ordering of data in [expr]
proc testIEEE {} {
variable ieeeValues
binary scan [binary format dd -1.0 1.0] c* c
switch -exact -- $c {
{0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
# little endian
binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \
ieeeValues(-Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \
ieeeValues(-Normal)
binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
ieeeValues(-Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
ieeeValues(+Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \
ieeeValues(+Normal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \
ieeeValues(+Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 1
return 1
}
{-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Infinity)
binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Normal)
binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Subnormal)
binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Subnormal)
binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Normal)
binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Infinity)
binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 0
return 1
}
default {
return 0
}
}
}
::tcltest::testConstraint ieeeFloatingPoint [testIEEE]
# First, test all of the integer operators individually.
test expr-old-1.1 {integer operators} {expr -4} -4
test expr-old-1.2 {integer operators} {expr -(1+4)} -5
test expr-old-1.3 {integer operators} {expr ~3} -4
test expr-old-1.4 {integer operators} {expr !2} 0
test expr-old-1.5 {integer operators} {expr !0} 1
|
| ︙ | ︙ | |||
87 88 89 90 91 92 93 |
[expr {0 || $x}] [expr {$x || 0}]
} {1 1 1 1}
# Check the floating-point operators individually, along with
# automatic conversion to integers where needed.
test expr-old-2.1 {floating-point operators} {expr -4.2} -4.2
| | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
[expr {0 || $x}] [expr {$x || 0}]
} {1 1 1 1}
# Check the floating-point operators individually, along with
# automatic conversion to integers where needed.
test expr-old-2.1 {floating-point operators} {expr -4.2} -4.2
test expr-old-2.2 {floating-point operators} {expr -(1.125+4.25)} -5.375
test expr-old-2.3 {floating-point operators} {expr +5.7} 5.7
test expr-old-2.4 {floating-point operators} {expr +--+-62.0} -62.0
test expr-old-2.5 {floating-point operators} {expr !2.1} 0
test expr-old-2.6 {floating-point operators} {expr !0.0} 1
test expr-old-2.7 {floating-point operators} {expr 4.2*6.3} 26.46
test expr-old-2.8 {floating-point operators} {expr 36.0/12.0} 3.0
test expr-old-2.9 {floating-point operators} {expr 27/4.0} 6.75
|
| ︙ | ︙ | |||
424 425 426 427 428 429 430 |
test expr-old-25.12 {type conversions} {expr 2>"ab"} 0
test expr-old-25.13 {type conversions} {expr {2>" "}} 1
test expr-old-25.14 {type conversions} {expr {"24.1a" > 24.1}} 1
test expr-old-25.15 {type conversions} {expr {24.1 > "24.1a"}} 0
test expr-old-25.16 {type conversions} {expr 2+2.5} 4.5
test expr-old-25.17 {type conversions} {expr 2+2.5} 4.5
test expr-old-25.18 {type conversions} {expr 2.0e2} 200.0
| | | 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
test expr-old-25.12 {type conversions} {expr 2>"ab"} 0
test expr-old-25.13 {type conversions} {expr {2>" "}} 1
test expr-old-25.14 {type conversions} {expr {"24.1a" > 24.1}} 1
test expr-old-25.15 {type conversions} {expr {24.1 > "24.1a"}} 0
test expr-old-25.16 {type conversions} {expr 2+2.5} 4.5
test expr-old-25.17 {type conversions} {expr 2+2.5} 4.5
test expr-old-25.18 {type conversions} {expr 2.0e2} 200.0
test expr-old-25.19 {type conversions} {expr 2.0e15} 2000000000000000.0
test expr-old-25.20 {type conversions} {expr 10.0} 10.0
# Various error conditions.
test expr-old-26.1 {error conditions} {
list [catch {expr 2+"a"} msg] $msg
} {1 {can't use non-numeric string as operand of "+"}}
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 |
} {1 {syntax error in expression "2+(4": looking for close parenthesis}}
test expr-old-26.8 {error conditions} {
list [catch {expr 2/0} msg] $msg $errorCode
} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}}
test expr-old-26.9 {error conditions} {
list [catch {expr 2%0} msg] $msg $errorCode
} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}}
| | > > > | | | | | | | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
} {1 {syntax error in expression "2+(4": looking for close parenthesis}}
test expr-old-26.8 {error conditions} {
list [catch {expr 2/0} msg] $msg $errorCode
} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}}
test expr-old-26.9 {error conditions} {
list [catch {expr 2%0} msg] $msg $errorCode
} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}}
test expr-old-26.10a {error conditions} !ieeeFloatingPoint {
list [catch {expr 2.0/0.0} msg] $msg $errorCode
} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}}
test expr-old-26.10b {error conditions} ieeeFloatingPoint {
list [catch {expr 2.0/0.0} msg] $msg
} {0 Inf}
test expr-old-26.11 {error conditions} {
list [catch {expr 2#} msg] $msg
} {1 {syntax error in expression "2#": extra tokens at end of expression}}
test expr-old-26.12 {error conditions} -body {
list [catch {expr a.b} msg] $msg
} -match glob -result {1 {syntax error in expression "a.b": * preceding $*}}
test expr-old-26.13 {error conditions} {
list [catch {expr {"a"/"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "/"}}
test expr-old-26.14 {error conditions} {
list [catch {expr 2:3} msg] $msg
} {1 {syntax error in expression "2:3": extra tokens at end of expression}}
test expr-old-26.15 {error conditions} -body {
list [catch {expr a@b} msg] $msg
} -match glob -result {1 {syntax error in expression "a@b": * preceding $*}}
test expr-old-26.16 {error conditions} {
list [catch {expr a[b} msg] $msg
} {1 {missing close-bracket}}
test expr-old-26.17 {error conditions} -body {
list [catch {expr a`b} msg] $msg
} -match glob -result {1 {syntax error in expression "a`b": * preceding $*}}
test expr-old-26.18 {error conditions} {
list [catch {expr \"a\"\{b} msg] $msg
} {1 syntax\ error\ in\ expression\ \"\"a\"\{b\":\ extra\ tokens\ at\ end\ of\ expression}
test expr-old-26.19 {error conditions} -body {
list [catch {expr a} msg] $msg
} -match glob -result {1 {syntax error in expression "a": * preceding $*}}
test expr-old-26.20 {error conditions} {
list [catch expr msg] $msg
} {1 {wrong # args: should be "expr arg ?arg ...?"}}
# Cancelled evaluation.
test expr-old-27.1 {cancelled evaluation} {
|
| ︙ | ︙ | |||
535 536 537 538 539 540 541 |
test expr-old-27.9 {cancelled evaluation} {
list [catch {expr {1 || ("string" * ("x" && "y"))}} msg] $msg
} {0 1}
test expr-old-27.10 {cancelled evaluation} {
set x -1.0
list [catch {expr {($x > 0) ? round(log($x)) : 0}} msg] $msg
} {0 0}
| | | | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
test expr-old-27.9 {cancelled evaluation} {
list [catch {expr {1 || ("string" * ("x" && "y"))}} msg] $msg
} {0 1}
test expr-old-27.10 {cancelled evaluation} {
set x -1.0
list [catch {expr {($x > 0) ? round(log($x)) : 0}} msg] $msg
} {0 0}
test expr-old-27.11 {cancelled evaluation} -body {
list [catch {expr {0 && foo}} msg] $msg
} -match glob -result {1 {syntax error in expression "0 && foo": * preceding $*}}
test expr-old-27.12 {cancelled evaluation} -body {
list [catch {expr {0 ? 1 : foo}} msg] $msg
} -match glob -result {1 {syntax error in expression "0 ? 1 : foo": * preceding $*}}
# Tcl_ExprBool as used in "if" statements
test expr-old-28.1 {Tcl_ExprBoolean usage} {
set a 1
if {2} {set a 2}
set a
|
| ︙ | ︙ | |||
795 796 797 798 799 800 801 |
} 246
test expr-old-32.44 {math functions in expressions} testmathfunctions {
expr T2()*3
} 1035
test expr-old-32.45 {math functions in expressions} {
expr (0 <= rand()) && (rand() < 1)
} {1}
| | | | | | 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 |
} 246
test expr-old-32.44 {math functions in expressions} testmathfunctions {
expr T2()*3
} 1035
test expr-old-32.45 {math functions in expressions} {
expr (0 <= rand()) && (rand() < 1)
} {1}
test expr-old-32.46 {math functions in expressions} -body {
list [catch {expr rand(24)} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
test expr-old-32.47 {math functions in expressions} -body {
list [catch {expr srand()} msg] $msg
} -match glob -result {1 {too few arguments for math function*}}
test expr-old-32.48 {math functions in expressions} {
list [catch {expr srand(3.79)} msg] $msg
} {1 {can't use floating-point value as argument to srand}}
test expr-old-32.49 {math functions in expressions} {
list [catch {expr srand("")} msg] $msg
} {1 {argument to math function didn't have numeric value}}
test expr-old-32.50 {math functions in expressions} {
|
| ︙ | ︙ | |||
837 838 839 840 841 842 843 |
test expr-old-33.3 {conversions and fancy args to math functions} {
expr hypot ( 3 , (3.0 + 1.0) )
} 5.0
test expr-old-33.4 {conversions and fancy args to math functions} {
format %.6g [expr cos(acos(0.1))]
} 0.1
| | | | | | | | | | | | > > > > > > | > | | | 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 |
test expr-old-33.3 {conversions and fancy args to math functions} {
expr hypot ( 3 , (3.0 + 1.0) )
} 5.0
test expr-old-33.4 {conversions and fancy args to math functions} {
format %.6g [expr cos(acos(0.1))]
} 0.1
test expr-old-34.1 {errors in math functions} -body {
list [catch {expr func_2(1.0)} msg] $msg
} -match glob -result {1 {* "*func_2"}}
test expr-old-34.2 {errors in math functions} -body {
list [catch {expr func|(1.0)} msg] $msg
} -match glob -result {1 {syntax error in expression "func|(1.0)": * preceding $*}}
test expr-old-34.3 {errors in math functions} {
list [catch {expr {hypot("a b", 2.0)}} msg] $msg
} {1 {expected floating-point number but got "a b"}}
test expr-old-34.4 {errors in math functions} {
list [catch {expr hypot(1.0 2.0)} msg] $msg
} {1 {syntax error in expression "hypot(1.0 2.0)": missing close parenthesis at end of function call}}
test expr-old-34.5 {errors in math functions} {
list [catch {expr hypot(1.0, 2.0} msg] $msg
} {1 {syntax error in expression "hypot(1.0, 2.0": missing close parenthesis at end of function call}}
test expr-old-34.6 {errors in math functions} {
list [catch {expr hypot(1.0 ,} msg] $msg
} {1 {syntax error in expression "hypot(1.0 ,": premature end of expression}}
test expr-old-34.7 {errors in math functions} -body {
list [catch {expr hypot(1.0)} msg] $msg
} -match glob -result {1 {too few arguments for math function*}}
test expr-old-34.8 {errors in math functions} -body {
list [catch {expr hypot(1.0, 2.0, 3.0)} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
test expr-old-34.9 {errors in math functions} {
list [catch {expr acos(-2.0)} msg] $msg $errorCode
} {1 {domain error: argument not in valid range} {ARITH DOMAIN {domain error: argument not in valid range}}}
test expr-old-34.10 {errors in math functions} {nonPortable} {
list [catch {expr pow(-3, 1000001)} msg] $msg $errorCode
} {1 {floating-point value too large to represent} {ARITH OVERFLOW {floating-point value too large to represent}}}
test expr-old-34.11a {errors in math functions} !ieeeFloatingPoint {
list [catch {expr pow(3, 1000001)} msg] $msg $errorCode
} {1 {floating-point value too large to represent} {ARITH OVERFLOW {floating-point value too large to represent}}}
test expr-old-34.11b {errors in math functions} ieeeFloatingPoint {
list [catch {expr pow(3, 1000001)} msg] $msg
} {0 Inf}
test expr-old-34.12a {errors in math functions} !ieeeFloatingPoint {
list [catch {expr -14.0*exp(100000)} msg] $msg $errorCode
} {1 {floating-point value too large to represent} {ARITH OVERFLOW {floating-point value too large to represent}}}
test expr-old-34.12b {errors in math functions} ieeeFloatingPoint {
list [catch {expr -14.0*exp(100000)} msg] $msg
} {0 -Inf}
test expr-old-34.13 {errors in math functions} {
list [catch {expr int(1.0e30)} msg] $msg $errorCode
} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}}
test expr-old-34.14 {errors in math functions} {
list [catch {expr int(-1.0e30)} msg] $msg $errorCode
} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}}
test expr-old-34.15 {errors in math functions} {
list [catch {expr round(1.0e30)} msg] $msg $errorCode
} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}}
test expr-old-34.16 {errors in math functions} {
list [catch {expr round(-1.0e30)} msg] $msg $errorCode
} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}}
test expr-old-34.17 {errors in math functions} -constraints testmathfunctions \
-body {
list [catch {expr T1(4)} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
test expr-old-36.1 {ExprLooksLikeInt procedure} -body {
expr 0289
} -returnCodes error -match glob -result {*invalid octal number*}
test expr-old-36.2 {ExprLooksLikeInt procedure} {
set x 0289
list [catch {expr {$x+1}} msg] $msg
|
| ︙ | ︙ | |||
968 969 970 971 972 973 974 975 976 977 978 979 980 981 |
testexprlong wide(1)+2
} {This is a result: 3}
test expr-old-38.1 {Verify Tcl_ExprString's basic operation} testexprstring {
list [testexprstring "1+4"] [testexprstring "2*3+4.2"] \
[catch {testexprstring "1+"} msg] $msg
} {5 10.2 1 {syntax error in expression "1+": premature end of expression}}
#
# Test for bug #908375: rounding numbers that do not fit in a
# long but do fit in a wide
#
test expr-old-39.1 {Rounding with wide result} {
| > > > > > > > | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 |
testexprlong wide(1)+2
} {This is a result: 3}
test expr-old-38.1 {Verify Tcl_ExprString's basic operation} testexprstring {
list [testexprstring "1+4"] [testexprstring "2*3+4.2"] \
[catch {testexprstring "1+"} msg] $msg
} {5 10.2 1 {syntax error in expression "1+": premature end of expression}}
test expr-old-38.2 {Tcl_ExprString} testexprstring {
# This one is "magical"
testexprstring {}
} 0
test expr-old-38.3 {Tcl_ExprString} -constraints testexprstring -body {
testexprstring { }
} -returnCodes error -match glob -result *
#
# Test for bug #908375: rounding numbers that do not fit in a
# long but do fit in a wide
#
test expr-old-39.1 {Rounding with wide result} {
|
| ︙ | ︙ |
Changes to tests/expr.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # Commands covered: expr # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1996-1997 Sun Microsystems, Inc. # Copyright (c) 1998-2000 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# Commands covered: expr
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1996-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: expr.test,v 1.30.4.1 2005/06/13 01:46:45 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
namespace import -force ::tcltest::*
}
testConstraint testmathfunctions [expr {
([catch {expr T1()} msg] != 1) || ($msg ne {unknown math function "T1"})
}]
|
| ︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
proc do_twelve_days {} {
global xxx
set xxx ""
12days 1 1 1
string length $xxx
}
# start of tests
catch {unset a b i x}
test expr-1.1 {TclCompileExprCmd: no expression} {
list [catch {expr } msg] $msg
} {1 {wrong # args: should be "expr arg ?arg ...?"}}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
proc do_twelve_days {} {
global xxx
set xxx ""
12days 1 1 1
string length $xxx
}
# Big test for correct ordering of data in [expr]
proc testIEEE {} {
variable ieeeValues
binary scan [binary format dd -1.0 1.0] c* c
switch -exact -- $c {
{0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
# little endian
binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \
ieeeValues(-Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \
ieeeValues(-Normal)
binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
ieeeValues(-Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
ieeeValues(+Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \
ieeeValues(+Normal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \
ieeeValues(+Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 1
return 1
}
{-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Infinity)
binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Normal)
binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Subnormal)
binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Subnormal)
binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Normal)
binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Infinity)
binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 0
return 1
}
default {
return 0
}
}
}
::tcltest::testConstraint ieeeFloatingPoint [testIEEE]
# start of tests
catch {unset a b i x}
test expr-1.1 {TclCompileExprCmd: no expression} {
list [catch {expr } msg] $msg
} {1 {wrong # args: should be "expr arg ?arg ...?"}}
|
| ︙ | ︙ | |||
140 141 142 143 144 145 146 |
set msg
} {syntax error in expression "7*2foo": extra tokens at end of expression}
test expr-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} {
expr {0001}
} 1
test expr-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1
| | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
set msg
} {syntax error in expression "7*2foo": extra tokens at end of expression}
test expr-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} {
expr {0001}
} 1
test expr-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1
test expr-3.2 {CompileCondExpr: error in lor expr} -body {
catch {expr x||3} msg
set msg
} -match glob -result {syntax error in expression "x||3": * preceding $*}
test expr-3.3 {CompileCondExpr: test true arm} {expr 3>2?44:66} 44
test expr-3.4 {CompileCondExpr: error compiling true arm} {
catch {expr 3>2?2***3:66} msg
set msg
} {syntax error in expression "3>2?2***3:66": unexpected operator *}
test expr-3.5 {CompileCondExpr: test false arm} {expr 2>3?44:66} 66
test expr-3.6 {CompileCondExpr: error compiling false arm} {
|
| ︙ | ︙ | |||
166 167 168 169 170 171 172 |
test expr-3.8 {CompileCondExpr: long arms & nested cond exprs} {unix nonPortable} {
puts "Note: doing test expr-3.8 which can take several minutes to run"
do_twelve_days
} 2358
catch {unset xxx}
test expr-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1
| | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
test expr-3.8 {CompileCondExpr: long arms & nested cond exprs} {unix nonPortable} {
puts "Note: doing test expr-3.8 which can take several minutes to run"
do_twelve_days
} 2358
catch {unset xxx}
test expr-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1
test expr-4.2 {CompileLorExpr: error in land expr} -body {
catch {expr x&&3} msg
set msg
} -match glob -result {syntax error in expression "x&&3": *preceding $*}
test expr-4.3 {CompileLorExpr: simple lor exprs} {expr 0||1.0} 1
test expr-4.4 {CompileLorExpr: simple lor exprs} {expr 3.0||0.0} 1
test expr-4.5 {CompileLorExpr: simple lor exprs} {expr 0||0||1} 1
test expr-4.6 {CompileLorExpr: error compiling lor arm} {
catch {expr 2***3||4.0} msg
set msg
} {syntax error in expression "2***3||4.0": unexpected operator *}
|
| ︙ | ︙ | |||
191 192 193 194 195 196 197 |
test expr-4.9 {CompileLorExpr: long lor arm} {
set a "abcdefghijkl"
set i 7
expr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]}
} 1
test expr-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23
| | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
test expr-4.9 {CompileLorExpr: long lor arm} {
set a "abcdefghijkl"
set i 7
expr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]] || [string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]}
} 1
test expr-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23
test expr-5.2 {CompileLandExpr: error in bitor expr} -body {
catch {expr x|3} msg
set msg
} -match glob -result {syntax error in expression "x|3": * preceding $*}
test expr-5.3 {CompileLandExpr: simple land exprs} {expr 0&&1.0} 0
test expr-5.4 {CompileLandExpr: simple land exprs} {expr 0&&0} 0
test expr-5.5 {CompileLandExpr: simple land exprs} {expr 3.0&&1.2} 1
test expr-5.6 {CompileLandExpr: simple land exprs} {expr 1&&1&&2} 1
test expr-5.7 {CompileLandExpr: error compiling land arm} {
catch {expr 2***3&&4.0} msg
set msg
|
| ︙ | ︙ | |||
217 218 219 220 221 222 223 |
test expr-5.10 {CompileLandExpr: long land arms} {
set a "abcdefghijkl"
set i 7
expr {[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]}
} 1
test expr-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3
| | | | | | | | | | | | | | | | | | | | 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 |
test expr-5.10 {CompileLandExpr: long land arms} {
set a "abcdefghijkl"
set i 7
expr {[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]] && [string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]^[string compare [format %c 103] [string index $a $i]]^[string compare [format %c 105] [string index $a $i]]}
} 1
test expr-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3
test expr-6.2 {CompileBitXorExpr: error in bitand expr} -body {
catch {expr x|3} msg
set msg
} -match glob -result {syntax error in expression "x|3": * preceding $*}
test expr-6.3 {CompileBitXorExpr: simple bitxor exprs} {expr 7^0x13} 20
test expr-6.4 {CompileBitXorExpr: simple bitxor exprs} {expr 3^0x10} 19
test expr-6.5 {CompileBitXorExpr: simple bitxor exprs} {expr 0^7} 7
test expr-6.6 {CompileBitXorExpr: simple bitxor exprs} {expr -1^7} -8
test expr-6.7 {CompileBitXorExpr: error compiling bitxor arm} {
catch {expr 2***3|6} msg
set msg
} {syntax error in expression "2***3|6": unexpected operator *}
test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body {
catch {expr 2^x} msg
set msg
} -match glob -result {syntax error in expression "2^x": * preceding $**}
test expr-6.9 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {24.0^3}} msg] $msg
} {1 {can't use floating-point value as operand of "^"}}
test expr-6.10 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {"a"^"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "^"}}
test expr-7.1 {CompileBitAndExpr: just equality expr} {expr 3==2} 0
test expr-7.2 {CompileBitAndExpr: just equality expr} {expr 2.0==2} 1
test expr-7.3 {CompileBitAndExpr: just equality expr} {expr 3.2!=2.2} 1
test expr-7.4 {CompileBitAndExpr: just equality expr} {expr {"abc" == "abd"}} 0
test expr-7.5 {CompileBitAndExpr: error in equality expr} -body {
catch {expr x==3} msg
set msg
} -match glob -result {syntax error in expression "x==3": * preceding $*}
test expr-7.6 {CompileBitAndExpr: simple bitand exprs} {expr 7&0x13} 3
test expr-7.7 {CompileBitAndExpr: simple bitand exprs} {expr 0xf2&0x53} 82
test expr-7.8 {CompileBitAndExpr: simple bitand exprs} {expr 3&6} 2
test expr-7.9 {CompileBitAndExpr: simple bitand exprs} {expr -1&-7} -7
test expr-7.10 {CompileBitAndExpr: error compiling bitand arm} {
catch {expr 2***3&6} msg
set msg
} {syntax error in expression "2***3&6": unexpected operator *}
test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} -body {
catch {expr 2&x} msg
set msg
} -match glob -result {syntax error in expression "2&x": * preceding $*}
test expr-7.12 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {24.0&3}} msg] $msg
} {1 {can't use floating-point value as operand of "&"}}
test expr-7.13 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {"a"&"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "&"}}
test expr-7.14 {CompileBitAndExpr: equality expr} {expr 3eq2} 0
test expr-7.18 {CompileBitAndExpr: equality expr} {expr {"abc" eq "abd"}} 0
test expr-7.20 {CompileBitAndExpr: error in equality expr} -body {
catch {expr xne3} msg
set msg
} -match glob -result {syntax error in expression "xne3": * preceding $*}
test expr-8.1 {CompileEqualityExpr: just relational expr} {expr 3>=2} 1
test expr-8.2 {CompileEqualityExpr: just relational expr} {expr 2<=2.1} 1
test expr-8.3 {CompileEqualityExpr: just relational expr} {expr 3.2>"2.2"} 1
test expr-8.4 {CompileEqualityExpr: just relational expr} {expr {"0y"<"0x12"}} 0
test expr-8.5 {CompileEqualityExpr: error in relational expr} -body {
catch {expr x>3} msg
set msg
} -match glob -result {syntax error in expression "x>3": * preceding $*}
test expr-8.6 {CompileEqualityExpr: simple equality exprs} {expr 7==0x13} 0
test expr-8.7 {CompileEqualityExpr: simple equality exprs} {expr -0xf2!=0x53} 1
test expr-8.8 {CompileEqualityExpr: simple equality exprs} {expr {"12398712938788234-1298379" != ""}} 1
test expr-8.9 {CompileEqualityExpr: simple equality exprs} {expr -1!="abc"} 1
test expr-8.10 {CompileEqualityExpr: error compiling equality arm} {
catch {expr 2***3==6} msg
set msg
} {syntax error in expression "2***3==6": unexpected operator *}
test expr-8.11 {CompileEqualityExpr: error compiling equality arm} -body {
catch {expr 2!=x} msg
set msg
} -match glob -result {syntax error in expression "2!=x": * preceding $*}
test expr-8.12 {CompileBitAndExpr: equality expr} {expr {"a"eq"a"}} 1
test expr-8.13 {CompileBitAndExpr: equality expr} {expr {"\374" eq "ü"}} 1
test expr-8.14 {CompileBitAndExpr: equality expr} {expr 3eq2} 0
test expr-8.15 {CompileBitAndExpr: equality expr} {expr 2.0eq2} 0
test expr-8.16 {CompileBitAndExpr: equality expr} {expr 3.2ne2.2} 1
test expr-8.17 {CompileBitAndExpr: equality expr} {expr 01eq1} 0
test expr-8.18 {CompileBitAndExpr: equality expr} {expr {"abc" eq "abd"}} 0
test expr-8.19 {CompileBitAndExpr: equality expr} {expr {"abc" ne "abd"}} 1
test expr-8.20 {CompileBitAndExpr: error in equality expr} -body {
catch {expr x ne3} msg
set msg
} -match glob -result {syntax error in expression "x ne3": * preceding $*}
test expr-8.21 {CompileBitAndExpr: error in equality expr} -body {
# These should be ""ed to avoid the error
catch {expr a eq b} msg
set msg
} -match glob -result {syntax error in expression "a eq b": * preceding $*}
test expr-8.22 {CompileBitAndExpr: error in equality expr} {
catch {expr {false eqfalse}} msg
set msg
} {syntax error in expression "false eqfalse": extra tokens at end of expression}
test expr-8.23 {CompileBitAndExpr: error in equality expr} {
catch {expr {false nefalse}} msg
set msg
|
| ︙ | ︙ | |||
336 337 338 339 340 341 342 |
expr {1<<63}
} -9223372036854775808
} else {
test expr-9.5b {CompileRelationalExpr: shift expr producing LONG_MIN} {nonPortable} {
expr {1<<31}
} -2147483648
}
| | | | | | | | | | | | | | > > > | | | | | | | 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 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
expr {1<<63}
} -9223372036854775808
} else {
test expr-9.5b {CompileRelationalExpr: shift expr producing LONG_MIN} {nonPortable} {
expr {1<<31}
} -2147483648
}
test expr-9.6 {CompileRelationalExpr: error in shift expr} -body {
catch {expr x>>3} msg
set msg
} -match glob -result {syntax error in expression "x>>3": * preceding $*}
test expr-9.7 {CompileRelationalExpr: simple relational exprs} {expr 0xff>=+0x3} 1
test expr-9.8 {CompileRelationalExpr: simple relational exprs} {expr -0xf2<0x3} 1
test expr-9.9 {CompileRelationalExpr: error compiling relational arm} {
catch {expr 2***3>6} msg
set msg
} {syntax error in expression "2***3>6": unexpected operator *}
test expr-9.10 {CompileRelationalExpr: error compiling relational arm} -body {
catch {expr 2<x} msg
set msg
} -match glob -result {syntax error in expression "2<x": * preceding $*}
test expr-10.1 {CompileShiftExpr: just add expr} {expr 4+-2} 2
test expr-10.2 {CompileShiftExpr: just add expr} {expr 0xff-2} 253
test expr-10.3 {CompileShiftExpr: just add expr} {expr -1--2} 1
test expr-10.4 {CompileShiftExpr: just add expr} {expr 1-0123} -82
test expr-10.5 {CompileShiftExpr: error in add expr} -body {
catch {expr x+3} msg
set msg
} -match glob -result {syntax error in expression "x+3": * preceding $*}
test expr-10.6 {CompileShiftExpr: simple shift exprs} {expr 0xff>>0x3} 31
test expr-10.7 {CompileShiftExpr: simple shift exprs} {expr -0xf2<<0x3} -1936
test expr-10.8 {CompileShiftExpr: error compiling shift arm} {
catch {expr 2***3>>6} msg
set msg
} {syntax error in expression "2***3>>6": unexpected operator *}
test expr-10.9 {CompileShiftExpr: error compiling shift arm} -body {
catch {expr 2<<x} msg
set msg
} -match glob -result {syntax error in expression "2<<x": * preceding $*}
test expr-10.10 {CompileShiftExpr: runtime error} {
list [catch {expr {24.0>>43}} msg] $msg
} {1 {can't use floating-point value as operand of ">>"}}
test expr-10.11 {CompileShiftExpr: runtime error} {
list [catch {expr {"a"<<"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "<<"}}
test expr-11.1 {CompileAddExpr: just multiply expr} {expr 4*-2} -8
test expr-11.2 {CompileAddExpr: just multiply expr} {expr 0xff%2} 1
test expr-11.3 {CompileAddExpr: just multiply expr} {expr -1/2} -1
test expr-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6
test expr-11.5 {CompileAddExpr: error in multiply expr} -body {
catch {expr x*3} msg
set msg
} -match glob -result {syntax error in expression "x*3": * preceding $*}
test expr-11.6 {CompileAddExpr: simple add exprs} {expr 0xff++0x3} 258
test expr-11.7 {CompileAddExpr: simple add exprs} {expr -0xf2--0x3} -239
test expr-11.8 {CompileAddExpr: error compiling add arm} {
catch {expr 2***3+6} msg
set msg
} {syntax error in expression "2***3+6": unexpected operator *}
test expr-11.9 {CompileAddExpr: error compiling add arm} -body {
catch {expr 2-x} msg
set msg
} -match glob -result {syntax error in expression "2-x": * preceding $*}
test expr-11.10 {CompileAddExpr: runtime error} {
list [catch {expr {24.0+"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "+"}}
test expr-11.11 {CompileAddExpr: runtime error} {
list [catch {expr {"a"-"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "-"}}
test expr-11.12 {CompileAddExpr: runtime error} {
list [catch {expr {3/0}} msg] $msg
} {1 {divide by zero}}
test expr-11.13a {CompileAddExpr: runtime error} !ieeeFloatingPoint {
list [catch {expr {2.3/0.0}} msg] $msg
} {1 {divide by zero}}
test expr-11.13b {CompileAddExpr: runtime error} ieeeFloatingPoint {
list [catch {expr {2.3/0.0}} msg] $msg
} {0 Inf}
test expr-12.1 {CompileMultiplyExpr: just unary expr} {expr ~4} -5
test expr-12.2 {CompileMultiplyExpr: just unary expr} {expr --5} 5
test expr-12.3 {CompileMultiplyExpr: just unary expr} {expr !27} 0
test expr-12.4 {CompileMultiplyExpr: just unary expr} {expr ~0xff00ff} -16711936
test expr-12.5 {CompileMultiplyExpr: error in unary expr} -body {
catch {expr ~x} msg
set msg
} -match glob -result {syntax error in expression "~x": * preceding $*}
test expr-12.6 {CompileMultiplyExpr: simple multiply exprs} {expr 0xff*0x3} 765
test expr-12.7 {CompileMultiplyExpr: simple multiply exprs} {expr -0xf2%-0x3} -2
test expr-12.8 {CompileMultiplyExpr: error compiling multiply arm} {
catch {expr 2*3%%6} msg
set msg
} {syntax error in expression "2*3%%6": unexpected operator %}
test expr-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body {
catch {expr 2*x} msg
set msg
} -match glob -result {syntax error in expression "2*x": * preceding $*}
test expr-12.10 {CompileMultiplyExpr: runtime error} {
list [catch {expr {24.0*"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "*"}}
test expr-12.11 {CompileMultiplyExpr: runtime error} {
list [catch {expr {"a"/"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "/"}}
test expr-13.1 {CompileUnaryExpr: unary exprs} {expr -0xff} -255
test expr-13.2 {CompileUnaryExpr: unary exprs} {expr +000123} 83
test expr-13.3 {CompileUnaryExpr: unary exprs} {expr +--++36} 36
test expr-13.4 {CompileUnaryExpr: unary exprs} {expr !2} 0
test expr-13.5 {CompileUnaryExpr: unary exprs} {expr +--+-62.0} -62.0
test expr-13.6 {CompileUnaryExpr: unary exprs} {expr !0.0} 1
test expr-13.7 {CompileUnaryExpr: unary exprs} {expr !0xef} 0
test expr-13.8 {CompileUnaryExpr: error compiling unary expr} -body {
catch {expr ~x} msg
set msg
} -match glob -result {syntax error in expression "~x": * preceding $*}
test expr-13.9 {CompileUnaryExpr: error compiling unary expr} {
catch {expr !1.x} msg
set msg
} {syntax error in expression "!1.x": extra tokens at end of expression}
test expr-13.10 {CompileUnaryExpr: runtime error} {
list [catch {expr {~"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "~"}}
|
| ︙ | ︙ | |||
561 562 563 564 565 566 567 |
} 2.71828
test expr-14.26 {CompilePrimaryExpr: math function primary} {
format %.6g [expr pow(2.0+0.1,3.0+0.1)]
} 9.97424
test expr-14.27 {CompilePrimaryExpr: error in math function primary} -body {
catch {expr sinh::(2.0)} msg
set errorInfo
| | | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 |
} 2.71828
test expr-14.26 {CompilePrimaryExpr: math function primary} {
format %.6g [expr pow(2.0+0.1,3.0+0.1)]
} 9.97424
test expr-14.27 {CompilePrimaryExpr: error in math function primary} -body {
catch {expr sinh::(2.0)} msg
set errorInfo
} -match glob -result {syntax error in expression "sinh::(2.0)": * function arguments*
while *ing
"expr sinh::(2.0)"}
test expr-14.28 {CompilePrimaryExpr: subexpression primary} {
expr 2+(3*4)
} 14
test expr-14.29 {CompilePrimaryExpr: error in subexpression primary} -body {
catch {expr 2+(3*[set])} msg
|
| ︙ | ︙ | |||
593 594 595 596 597 598 599 |
} -match glob -result {syntax error in expression "@": character not legal in expressions
while *ing
"expr @"}
test expr-15.1 {CompileMathFuncCall: missing parenthesis} -body {
catch {expr sinh2.0)} msg
set errorInfo
| | | | | | | 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 |
} -match glob -result {syntax error in expression "@": character not legal in expressions
while *ing
"expr @"}
test expr-15.1 {CompileMathFuncCall: missing parenthesis} -body {
catch {expr sinh2.0)} msg
set errorInfo
} -match glob -result {syntax error in expression "sinh2.0)": * preceding $*
while *ing
"expr sinh2.0)"}
test expr-15.2 {CompileMathFuncCall: unknown math function} -body {
catch {expr whazzathuh(1)} msg
set errorInfo
} -match glob -result {* "*whazzathuh"
while *ing
"expr whazzathuh(1)"}
test expr-15.3 {CompileMathFuncCall: too many arguments} -body {
catch {expr sin(1,2,3)} msg
set errorInfo
} -match glob -result {too many arguments for math function*
while *ing
"expr sin(1,2,3)"}
test expr-15.4 {CompileMathFuncCall: ')' found before last required arg} -body {
catch {expr sin()} msg
set errorInfo
} -match glob -result {too few arguments for math function*
while *ing
"expr sin()"}
test expr-15.5 {CompileMathFuncCall: too few arguments} -body {
catch {expr pow(1)} msg
set errorInfo
} -match glob -result {too few arguments for math function*
while *ing
"expr pow(1)"}
test expr-15.6 {CompileMathFuncCall: missing ')'} -body {
catch {expr sin(1} msg
set errorInfo
} -match glob -result {syntax error in expression "sin(1": missing close parenthesis at end of function call
while *ing
|
| ︙ | ︙ | |||
816 817 818 819 820 821 822 |
} 0
# Tests for exponentiation handling
test expr-23.1 {CompileExponentialExpr: just exponential expr} {expr 4**2} 16
test expr-23.2 {CompileExponentialExpr: just exponential expr} {expr 0xff**2} 65025
test expr-23.3 {CompileExponentialExpr: just exponential expr} {expr -1**2} 1
test expr-23.4 {CompileExponentialExpr: just exponential expr} {expr 18**07} 612220032
| | | | | | 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 |
} 0
# Tests for exponentiation handling
test expr-23.1 {CompileExponentialExpr: just exponential expr} {expr 4**2} 16
test expr-23.2 {CompileExponentialExpr: just exponential expr} {expr 0xff**2} 65025
test expr-23.3 {CompileExponentialExpr: just exponential expr} {expr -1**2} 1
test expr-23.4 {CompileExponentialExpr: just exponential expr} {expr 18**07} 612220032
test expr-23.5 {CompileExponentialExpr: error in exponential expr} -body {
catch {expr x**3} msg
set msg
} -match glob -result {syntax error in expression "x**3": * preceding $*}
test expr-23.6 {CompileExponentialExpr: simple expo exprs} {expr 0xff**0x3} 16581375
test expr-23.7 {CompileExponentialExpr: error compiling expo arm} {
catch {expr (-3-)**6} msg
set msg
} {syntax error in expression "(-3-)**6": unexpected close parenthesis}
test expr-23.8 {CompileExponentialExpr: error compiling expo arm} -body {
catch {expr 2**x} msg
set msg
} -match glob -result {syntax error in expression "2**x": * preceding $*}
test expr-23.9 {CompileExponentialExpr: runtime error} {
list [catch {expr {24.0**"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "**"}}
test expr-23.10 {CompileExponentialExpr: runtime error} {
list [catch {expr {"a"**2}} msg] $msg
} {1 {can't use non-numeric string as operand of "**"}}
test expr-23.11 {CompileExponentialExpr: runtime error} {
|
| ︙ | ︙ | |||
864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
test expr-23.27 {INST_EXPON: special cases} {expr {wide(-2)**wide(0)}} 1
test expr-23.28 {INST_EXPON: special cases} {expr {wide(-1)**wide(1)}} -1
test expr-23.29 {INST_EXPON: special cases} {expr {wide(-1)**wide(0)}} 1
test expr-23.30 {INST_EXPON: special cases} {expr {wide(-1)**wide(2)}} 1
test expr-23.31 {INST_EXPON: special cases} {expr {wide(-1)**wide(-1)}} -1
test expr-23.32 {INST_EXPON: special cases} {expr {wide(1)**wide(1234567)}} 1
test expr-23.33 {INST_EXPON: special cases} {expr {wide(2)**wide(-2)}} 0
# Some compilers get this wrong; ensure that we work around it correctly
test expr-24.1 {expr edge cases; shifting} {expr int(5)>>32} 0
test expr-24.2 {expr edge cases; shifting} {expr int(5)>>63} 0
test expr-24.3 {expr edge cases; shifting} {expr wide(5)>>32} 0
test expr-24.4 {expr edge cases; shifting} {expr wide(5)>>63} 0
test expr-24.5 {expr edge cases; shifting} nonPortable {expr int(5)<<32} 0
| > > > | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 |
test expr-23.27 {INST_EXPON: special cases} {expr {wide(-2)**wide(0)}} 1
test expr-23.28 {INST_EXPON: special cases} {expr {wide(-1)**wide(1)}} -1
test expr-23.29 {INST_EXPON: special cases} {expr {wide(-1)**wide(0)}} 1
test expr-23.30 {INST_EXPON: special cases} {expr {wide(-1)**wide(2)}} 1
test expr-23.31 {INST_EXPON: special cases} {expr {wide(-1)**wide(-1)}} -1
test expr-23.32 {INST_EXPON: special cases} {expr {wide(1)**wide(1234567)}} 1
test expr-23.33 {INST_EXPON: special cases} {expr {wide(2)**wide(-2)}} 0
test expr-23.34 {INST_EXPON: special cases} {expr {2**0}} 1
test expr-23.35 {INST_EXPON: special cases} {expr {wide(2)**0}} 1
# Some compilers get this wrong; ensure that we work around it correctly
test expr-24.1 {expr edge cases; shifting} {expr int(5)>>32} 0
test expr-24.2 {expr edge cases; shifting} {expr int(5)>>63} 0
test expr-24.3 {expr edge cases; shifting} {expr wide(5)>>32} 0
test expr-24.4 {expr edge cases; shifting} {expr wide(5)>>63} 0
test expr-24.5 {expr edge cases; shifting} nonPortable {expr int(5)<<32} 0
|
| ︙ | ︙ | |||
893 894 895 896 897 898 899 900 901 902 903 904 905 |
test expr-26.2 {'ni' operator} {expr {"a" ni "b a c"}} 0
test expr-26.3 {'ni' operator} {expr {"a" ni "b c a"}} 0
test expr-26.4 {'ni' operator} {expr {"a" ni ""}} 1
test expr-26.5 {'ni' operator} {expr {"" ni {a b c ""}}} 0
test expr-26.6 {'ni' operator} {expr {"" ni "a b c"}} 1
test expr-26.7 {'ni' operator} {expr {"" ni ""}} 1
# cleanup
if {[info exists a]} {
unset a
}
::tcltest::cleanupTests
return
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 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 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 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 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 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 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 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 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 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 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 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 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 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 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 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 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 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 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 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 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 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 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 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 2741 2742 2743 2744 2745 2746 2747 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 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 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 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 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 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 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 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 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 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 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 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 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 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 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 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 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 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 3849 3850 3851 3852 3853 3854 3855 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 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 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 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 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 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 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 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 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 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 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 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 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 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 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 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 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 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 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 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 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 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 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 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 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 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 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 5256 |
test expr-26.2 {'ni' operator} {expr {"a" ni "b a c"}} 0
test expr-26.3 {'ni' operator} {expr {"a" ni "b c a"}} 0
test expr-26.4 {'ni' operator} {expr {"a" ni ""}} 1
test expr-26.5 {'ni' operator} {expr {"" ni {a b c ""}}} 0
test expr-26.6 {'ni' operator} {expr {"" ni "a b c"}} 1
test expr-26.7 {'ni' operator} {expr {"" ni ""}} 1
foreach op {< <= == != > >=} {
proc test$op {a b} [list expr "\$a $op \$b"]
}
test expr-27.1 {expr - correct ordering - not compiled} ieeeFloatingPoint {
set problems {}
# Ordering should be: -Infinity < -Normal < Subnormal < -0
# < +0 < +Subnormal < +Normal < +Infinity
# with equality within each class.
set names {
-Infinity -Normal -Subnormal -0 +0 +Subnormal +Normal +Infinity
}
set weights {
-3 -2 -1 0 0 1 2 3
}
foreach name1 $names weight1 $weights {
foreach name2 $names weight2 $weights {
foreach op {< <= == != >= >} {
set shouldBe [expr "$weight1 $op $weight2"]
set is [expr "\$ieeeValues($name1) $op \$ieeeValues($name2)"]
if { $is != $shouldBe } {
append problems $name1 { } $op { } $name2 \
":result is " $is ", should be $shouldBe" \n
}
}
}
}
set problems
} {}
test expr-27.2 {expr - correct ordering - compiled} ieeeFloatingPoint {
set problems {}
# Ordering should be: -Infinity < -Normal < Subnormal < -0
# < +0 < +Subnormal < +Normal < +Infinity
# with equality within each class.
set names {
-Infinity -Normal -Subnormal -0 +0 +Subnormal +Normal +Infinity
}
set weights {
-3 -2 -1 0 0 1 2 3
}
foreach name1 $names weight1 $weights {
foreach name2 $names weight2 $weights {
foreach op {< <= == != >= >} {
set shouldBe [expr "$weight1 $op $weight2"]
set is [test$op $ieeeValues($name1) $ieeeValues($name2)]
if { $is != $shouldBe } {
append problems $name1 { } $op { } $name2 \
":result is " $is ", should be $shouldBe" \n
}
}
}
}
set problems
} {}
test expr-27.3 {expr - NaN is unordered - not compiled} {
set problems {}
set names {
-Infinity -Normal -Subnormal -0 +0 +Subnormal +Normal +Infinity NaN
}
foreach name1 $names {
foreach op {< <= == != >= >} sb {0 0 0 1 0 0} {
if "(\$ieeeValues($name1) $op \$ieeeValues(NaN)) != $sb " {
append problems $name1 { } $op { } NaN \
": result is 1, should be $sb" \n
}
if "(\$ieeeValues(NaN) $op \$ieeeValues($name1)) != $sb" {
append problems NaN { } $op { } $name1 \
": result is 1, should be $sb" \n
}
}
}
set problems
} {}
test expr-27.4 {expr - NaN is unordered - compiled} {
set problems {}
set names {
-Infinity -Normal -Subnormal -0 +0 +Subnormal +Normal +Infinity NaN
}
foreach name1 $names {
foreach op {< <= == != >= >} sb {0 0 0 1 0 0} {
if { [test$op $ieeeValues($name1) $ieeeValues(NaN)] != $sb } {
append problems $ieeeValues($name1) { } $op { } $ieeeValues(NaN) \
": result is 1, should be $sb" \n
}
if { [test$op $ieeeValues(NaN) $ieeeValues($name1)] != $sb } {
append problems NaN { } $op { } $ieeeValues($name1) \
": result is 1, should be $sb" \n
}
}
}
set problems
} {}
proc convertToDouble { x } {
variable ieeeValues
binary scan [binary format d $x] c* bytes
set result 0x
if { $ieeeValues(littleEndian) } {
for { set i 7 } { $i >= 0 } { incr i -1 } {
append result [format %02x [expr { [lindex $bytes $i] & 0xff }]]
}
} else {
foreach byte $bytes {
append result [format %02x [expr { $byte & 0xff }]]
}
}
return $result
}
test expr-28.1 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 0 E0 OK 00000000000000 E-1023
convertToDouble 0E0
} 0x0000000000000000
test expr-28.2 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL -0 E0 OK -0000000000000 E-1023
convertToDouble -0E0
} 0x8000000000000000
test expr-28.3 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 1 E0 OK 10000000000000 E0
convertToDouble 1E0
} 0x3ff0000000000000
test expr-28.4 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 15 E-1 OK 18000000000000 E0
convertToDouble 15E-1
} 0x3ff8000000000000
test expr-28.5 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 125 E-2 OK 14000000000000 E0
convertToDouble 125E-2
} 0x3ff4000000000000
test expr-28.6 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 1125 E-3 OK 12000000000000 E0
convertToDouble 1125E-3
} 0x3ff2000000000000
test expr-28.7 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 10625 E-4 OK 11000000000000 E0
convertToDouble 10625E-4
} 0x3ff1000000000000
test expr-28.8 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 103125 E-5 OK 10800000000000 E0
convertToDouble 103125E-5
} 0x3ff0800000000000
test expr-28.9 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 1015625 E-6 OK 10400000000000 E0
convertToDouble 1015625E-6
} 0x3ff0400000000000
test expr-28.10 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 10078125 E-7 OK 10200000000000 E0
convertToDouble 10078125E-7
} 0x3ff0200000000000
test expr-28.11 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d ALL 100390625 E-8 OK 10100000000000 E0
convertToDouble 100390625E-8
} 0x3ff0100000000000
test expr-28.12 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee ALL 1001953125 E-9 OK 10080000000000 E0
convertToDouble 1001953125E-9
} 0x3ff0080000000000
test expr-28.13 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee ALL 10009765625 E-10 OK 10040000000000 E0
convertToDouble 10009765625E-10
} 0x3ff0040000000000
test expr-28.14 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee ALL 100048828125 E-11 OK 10020000000000 E0
convertToDouble 100048828125E-11
} 0x3ff0020000000000
test expr-28.15 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee ALL 1000244140625 E-12 OK 10010000000000 E0
convertToDouble 1000244140625E-12
} 0x3ff0010000000000
test expr-28.16 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee ALL 10001220703125 E-13 OK 10008000000000 E0
convertToDouble 10001220703125E-13
} 0x3ff0008000000000
test expr-28.17 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee ALL 100006103515625 E-14 OK 10004000000000 E0
convertToDouble 100006103515625E-14
} 0x3ff0004000000000
test expr-28.18 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee ALL 1000030517578125 E-15 OK 10002000000000 E0
convertToDouble 1000030517578125E-15
} 0x3ff0002000000000
test expr-28.19 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee ALL 10000152587890625 E-16 OK 10001000000000 E0
convertToDouble 10000152587890625E-16
} 0x3ff0001000000000
test expr-28.20 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8 E153 x 1317e5ef3ab327_0000000001& E511
convertToDouble +8E153
} 0x5fe317e5ef3ab327
test expr-28.21 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1 E153 x -1317e5ef3ab327_0000000001& E508
convertToDouble -1E153
} 0xdfb317e5ef3ab327
test expr-28.22 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9 E306 x 19a2028368022e_00000000001& E1019
convertToDouble +9E306
} 0x7fa9a2028368022e
test expr-28.23 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -2 E153 x -1317e5ef3ab327_0000000001& E509
convertToDouble -2E153
} 0xdfc317e5ef3ab327
test expr-28.24 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7 E-304 x 1eb8e84fa0b278_00000000001& E-1008
convertToDouble +7E-304
} 0x00feb8e84fa0b278
test expr-28.25 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3 E-49 x -1c0f92a6276c9d_000000001& E-162
convertToDouble -3E-49
} 0xb5dc0f92a6276c9d
test expr-28.26 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7 E-303 x 13339131c46f8b_00000000001& E-1004
convertToDouble +7E-303
} 0x0133339131c46f8b
test expr-28.27 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -6 E-49 x -1c0f92a6276c9d_000000001& E-161
convertToDouble -6E-49
} 0xb5ec0f92a6276c9d
test expr-28.28 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9 E43 x 102498ea6df0c3_11111111110& E146
convertToDouble +9E43
} 0x49102498ea6df0c4
test expr-28.29 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9 E44 x -142dbf25096cf4_1111111110& E149
convertToDouble -9E44
} 0xc9442dbf25096cf5
test expr-28.30 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8 E303 x 1754e31cd072d9_1111111110& E1009
convertToDouble +8E303
} 0x7f0754e31cd072da
test expr-28.31 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1 E303 x -1754e31cd072d9_1111111110& E1006
convertToDouble -1E303
} 0xfed754e31cd072da
test expr-28.32 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7 E-287 x 1551603777f798_111111110& E-951
convertToDouble +7E-287
} 0x048551603777f799
test expr-28.33 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -2 E-204 x -1410d9f9b2f7f2_11111110& E-677
convertToDouble -2E-204
} 0x95a410d9f9b2f7f3
test expr-28.34 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2 E-205 x 100d7b2e28c65b_11111110& E-680
convertToDouble +2E-205
} 0x15700d7b2e28c65c
test expr-28.35 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9 E-47 x -10711fed5b19a3_11111110& E-153
convertToDouble -9E-47
} 0xb660711fed5b19a4
test expr-28.36 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +34 E195 x 1d1c26db7d0dae_000000000001& E652
convertToDouble +34E195
} 0x68bd1c26db7d0dae
test expr-28.37 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -68 E195 x -1d1c26db7d0dae_000000000001& E653
convertToDouble -68E195
} 0xe8cd1c26db7d0dae
test expr-28.38 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +85 E194 x 1d1c26db7d0dae_000000000001& E650
convertToDouble +85E194
} 0x689d1c26db7d0dae
test expr-28.39 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -67 E97 x -139ac1ce2cc95f_000000000001& E328
convertToDouble -67E97
} 0xd4739ac1ce2cc95f
test expr-28.40 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +93 E-234 x 127b2e4f210075_0000000000000001& E-771
convertToDouble +93E-234
} 0x0fc27b2e4f210075
test expr-28.41 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -19 E-87 x -12e5f5dfa4fe9d_00000000000001& E-285
convertToDouble -19E-87
} 0xae22e5f5dfa4fe9d
test expr-28.42 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +38 E-87 x 12e5f5dfa4fe9d_00000000000001& E-284
convertToDouble +38E-87
} 0x2e32e5f5dfa4fe9d
test expr-28.43 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -38 E-88 x -1e3cbc9907fdc8_00000000000001& E-288
convertToDouble -38E-88
} 0xadfe3cbc9907fdc8
test expr-28.44 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -69 E220 x -1e8aa8823a5db3_11111111110& E736
convertToDouble -69E220
} 0xedfe8aa8823a5db4
test expr-28.45 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +18 E43 x 102498ea6df0c3_11111111110& E147
convertToDouble +18E43
} 0x49202498ea6df0c4
test expr-28.46 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -36 E43 x -102498ea6df0c3_11111111110& E148
convertToDouble -36E43
} 0xc9302498ea6df0c4
test expr-28.47 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +61 E-99 x 10ad836f269a16_11111111111110& E-323
convertToDouble +61E-99
} 0x2bc0ad836f269a17
test expr-28.48 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -43 E-92 x -1c0794d9d40e95_111111111111110& E-301
convertToDouble -43E-92
} 0xad2c0794d9d40e96
test expr-28.49 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +86 E-92 x 1c0794d9d40e95_111111111111110& E-300
convertToDouble +86E-92
} 0x2d3c0794d9d40e96
test expr-28.50 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -51 E-74 x -1cd5bee57763e5_1111111111111110& E-241
convertToDouble -51E-74
} 0xb0ecd5bee57763e6
test expr-28.51 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +283 E85 x 16c309024bab4b_00000000000000001& E290
convertToDouble +283E85
} 0x5216c309024bab4b
test expr-28.52 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -566 E85 x -16c309024bab4b_00000000000000001& E291
convertToDouble -566E85
} 0xd226c309024bab4b
test expr-28.53 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +589 E187 x 1526be9c22eb17_00000000000000001& E630
convertToDouble +589E187
} 0x675526be9c22eb17
test expr-28.54 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -839 E143 x -1ae03f245703e2_000000000000001& E484
convertToDouble -839E143
} 0xde3ae03f245703e2
test expr-28.55 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -744 E-234 x -127b2e4f210075_0000000000000001& E-768
convertToDouble -744E-234
} 0x8ff27b2e4f210075
test expr-28.56 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +930 E-235 x 127b2e4f210075_0000000000000001& E-771
convertToDouble +930E-235
} 0x0fc27b2e4f210075
test expr-28.57 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -186 E-234 x -127b2e4f210075_0000000000000001& E-770
convertToDouble -186E-234
} 0x8fd27b2e4f210075
test expr-28.58 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +604 E175 x 17d93193f78fc5_1111111111111111110& E590
convertToDouble +604E175
} 0x64d7d93193f78fc6
test expr-28.59 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -302 E175 x -17d93193f78fc5_1111111111111111110& E589
convertToDouble -302E175
} 0xe4c7d93193f78fc6
test expr-28.60 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +755 E174 x 17d93193f78fc5_1111111111111111110& E587
convertToDouble +755E174
} 0x64a7d93193f78fc6
test expr-28.61 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -151 E175 x -17d93193f78fc5_1111111111111111110& E588
convertToDouble -151E175
} 0xe4b7d93193f78fc6
test expr-28.62 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +662 E-213 x 1bdb90e62a8cbc_1111111111111110& E-699
convertToDouble +662E-213
} 0x144bdb90e62a8cbd
test expr-28.63 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -408 E-74 x -1cd5bee57763e5_1111111111111110& E-238
convertToDouble -408E-74
} 0xb11cd5bee57763e6
test expr-28.64 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +510 E-75 x 1cd5bee57763e5_1111111111111110& E-241
convertToDouble +510E-75
} 0x30ecd5bee57763e6
test expr-28.65 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6782 E55 x 159bd3ad46e346_0000000000000000001& E195
convertToDouble +6782E55
} 0x4c259bd3ad46e346
test expr-28.66 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -2309 E92 x -1bac6f7d64d119_000000000000000001& E316
convertToDouble -2309E92
} 0xd3bbac6f7d64d119
test expr-28.67 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7963 E34 x 1df4170f0fdecc_00000000000000000001& E125
convertToDouble +7963E34
} 0x47cdf4170f0fdecc
test expr-28.68 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3391 E55 x -159bd3ad46e346_0000000000000000001& E194
convertToDouble -3391E55
} 0xcc159bd3ad46e346
test expr-28.69 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7903 E-96 x 107c2d27a5b989_0000000000000000001& E-306
convertToDouble +7903E-96
} 0x2cd07c2d27a5b989
test expr-28.70 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7611 E-226 x -119b8744033457_0000000000000000001& E-738
convertToDouble -7611E-226
} 0x91d19b8744033457
test expr-28.71 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +4907 E-196 x 11e90a8711440f_000000000000000001& E-639
convertToDouble +4907E-196
} 0x1801e90a8711440f
test expr-28.72 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5547 E-311 x -13f190452a29f4_000000000000000001& E-1021
convertToDouble -5547E-311
} 0x8023f190452a29f4
test expr-28.73 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +5311 E241 x 1f1ce3c887c25f_11111111111111111110& E812
convertToDouble +5311E241
} 0x72bf1ce3c887c260
test expr-28.74 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5311 E243 x -184e91f4aa0fda_11111111111111111110& E819
convertToDouble -5311E243
} 0xf3284e91f4aa0fdb
test expr-28.75 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +5311 E242 x 13720e5d54d97b_11111111111111111110& E816
convertToDouble +5311E242
} 0x72f3720e5d54d97c
test expr-28.76 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9269 E-45 x 19d69455a53bd8_111111111111111111110& E-137
convertToDouble +9269E-45
} 0x3769d69455a53bd9
test expr-28.77 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8559 E-289 x -104a81d35952fe_11111111111111111110& E-947
convertToDouble -8559E-289
} 0x84c04a81d35952ff
test expr-28.78 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8699 E-276 x 12d2df246ecd2c_1111111111111111111110& E-904
convertToDouble +8699E-276
} 0x0772d2df246ecd2d
test expr-28.79 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8085 E-64 x -14c98fce16152d_1111111111111111110& E-200
convertToDouble -8085E-64
} 0xb374c98fce16152e
test expr-28.80 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +74819 E201 x 1dd455061eb3f1_0000000000000000000001& E683
convertToDouble +74819E201
} 0x6aadd455061eb3f1
test expr-28.81 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -82081 E41 x -170105df3d47cb_000000000000000000000000001& E152
convertToDouble -82081E41
} 0xc9770105df3d47cb
test expr-28.82 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +51881 E37 x 17d2950dc76da4_000000000000000000001& E138
convertToDouble +51881E37
} 0x4897d2950dc76da4
test expr-28.83 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -55061 E157 x -1394fc0f33536c_000000000000000000001& E537
convertToDouble -55061E157
} 0xe18394fc0f33536c
test expr-28.84 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +77402 E-215 x 10492a4a8a37fd_0000000000000000000000001& E-698
convertToDouble +77402E-215
} 0x1450492a4a8a37fd
test expr-28.85 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -33891 E-92 x -1592f9932c06bd_00000000000000000000001& E-291
convertToDouble -33891E-92
} 0xadc592f9932c06bd
test expr-28.86 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +38701 E-215 x 10492a4a8a37fd_0000000000000000000000001& E-699
convertToDouble +38701E-215
} 0x1440492a4a8a37fd
test expr-28.87 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -82139 E-76 x -1d0681489839d5_00000000000000000000001& E-237
convertToDouble -82139E-76
} 0xb12d0681489839d5
test expr-28.88 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +75859 E25 x 132645e1ba93ef_11111111111111111111110& E99
convertToDouble +75859E25
} 0x46232645e1ba93f0
test expr-28.89 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +89509 E140 x 16f02bee68670c_1111111111111111111110& E481
convertToDouble +89509E140
} 0x5e06f02bee68670d
test expr-28.90 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -57533 E287 x -1272ed2307f569_1111111111111111111110& E969
convertToDouble -57533E287
} 0xfc8272ed2307f56a
test expr-28.91 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +46073 E-32 x 12405b773fbdf2_11111111111111111111110& E-91
convertToDouble +46073E-32
} 0x3a42405b773fbdf3
test expr-28.92 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -92146 E-32 x -12405b773fbdf2_11111111111111111111110& E-90
convertToDouble -92146E-32
} 0xba52405b773fbdf3
test expr-28.93 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +83771 E-74 x 17206bfc4ccabd_11111111111111111111110& E-230
convertToDouble +83771E-74
} 0x3197206bfc4ccabe
test expr-28.94 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -34796 E-276 x -12d2df246ecd2c_1111111111111111111110& E-902
convertToDouble -34796E-276
} 0x8792d2df246ecd2d
test expr-28.95 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +584169 E229 x 1d657059dc79aa_00000000000000000000000000001& E779
convertToDouble +584169E229
} 0x70ad657059dc79aa
test expr-28.96 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +164162 E41 x 170105df3d47cb_000000000000000000000000001& E153
convertToDouble +164162E41
} 0x49870105df3d47cb
test expr-28.97 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -328324 E41 x -170105df3d47cb_000000000000000000000000001& E154
convertToDouble -328324E41
} 0xc9970105df3d47cb
test expr-28.98 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +209901 E-11 x 119b96f36ec68b_00000000000000000000000001& E-19
convertToDouble +209901E-11
} 0x3ec19b96f36ec68b
test expr-28.99 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -419802 E-11 x -119b96f36ec68b_00000000000000000000000001& E-18
convertToDouble -419802E-11
} 0xbed19b96f36ec68b
test expr-28.100 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +940189 E-112 x 1b99d6240c1a28_00000000000000000000000001& E-353
convertToDouble +940189E-112
} 0x29eb99d6240c1a28
test expr-28.101 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -892771 E-213 x -125818c7294f27_0000000000000000000000000001& E-688
convertToDouble -892771E-213
} 0x94f25818c7294f27
test expr-28.102 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +757803 E120 x 11e968b555bb80_11111111111111111111111111110& E418
convertToDouble +757803E120
} 0x5a11e968b555bb81
test expr-28.103 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -252601 E120 x -17e1e0f1c7a4ab_11111111111111111111111111110& E416
convertToDouble -252601E120
} 0xd9f7e1e0f1c7a4ac
test expr-28.104 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +252601 E121 x 1dda592e398dd6_1111111111111111111111111110& E419
convertToDouble +252601E121
} 0x5a2dda592e398dd7
test expr-28.105 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -505202 E120 x -17e1e0f1c7a4ab_11111111111111111111111111110& E417
convertToDouble -505202E120
} 0xda07e1e0f1c7a4ac
test expr-28.106 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +970811 E-264 x 1dda6b965c9629_11111111111111111111111110& E-858
convertToDouble +970811E-264
} 0x0a5dda6b965c962a
test expr-28.107 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -654839 E-60 x -100e7db3b3f241_111111111111111111111111110& E-180
convertToDouble -654839E-60
} 0xb4b00e7db3b3f242
test expr-28.108 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +289767 E-178 x 1caad28f23a100_11111111111111111111111110& E-574
convertToDouble +289767E-178
} 0x1c1caad28f23a101
test expr-28.109 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -579534 E-178 x -1caad28f23a100_11111111111111111111111110& E-573
convertToDouble -579534E-178
} 0x9c2caad28f23a101
test expr-28.110 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8823691 E130 x -1e597c0b94b7ae_00000000000000000000000000000001& E454
convertToDouble -8823691E130
} 0xdc5e597c0b94b7ae
test expr-28.111 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9346704 E229 x 1d657059dc79aa_00000000000000000000000000001& E783
convertToDouble +9346704E229
} 0x70ed657059dc79aa
test expr-28.112 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1168338 E229 x -1d657059dc79aa_00000000000000000000000000001& E780
convertToDouble -1168338E229
} 0xf0bd657059dc79aa
test expr-28.113 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -6063369 E-136 x -1ae6148e3902b3_000000000000000000000000000001& E-430
convertToDouble -6063369E-136
} 0xa51ae6148e3902b3
test expr-28.114 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3865421 E-225 x 15d4fe53afec65_00000000000000000000000000001& E-726
convertToDouble +3865421E-225
} 0x1295d4fe53afec65
test expr-28.115 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5783893 E-127 x -17e5902ce0e151_000000000000000000000000000000001& E-400
convertToDouble -5783893E-127
} 0xa6f7e5902ce0e151
test expr-28.116 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2572231 E223 x 10f73be1dff9ac_111111111111111111111111111110& E762
convertToDouble +2572231E223
} 0x6f90f73be1dff9ad
test expr-28.117 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5144462 E223 x -10f73be1dff9ac_111111111111111111111111111110& E763
convertToDouble -5144462E223
} 0xefa0f73be1dff9ad
test expr-28.118 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +1817623 E109 x 1d85f96f3fe659_11111111111111111111111111110& E382
convertToDouble +1817623E109
} 0x57dd85f96f3fe65a
test expr-28.119 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6431543 E-97 x 14f6493f34a0bc_11111111111111111111111111110& E-300
convertToDouble +6431543E-97
} 0x2d34f6493f34a0bd
test expr-28.120 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -5444097 E-21 x -18849dd33c95ae_11111111111111111111111111110& E-48
convertToDouble -5444097E-21
} 0xbcf8849dd33c95af
test expr-28.121 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8076999 E-121 x 1fd332f7e2e3b2_11111111111111111111111111110& E-380
convertToDouble +8076999E-121
} 0x283fd332f7e2e3b3
test expr-28.122 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9997649 E-270 x -1425e9d29e558d_1111111111111111111111111110& E-874
convertToDouble -9997649E-270
} 0x895425e9d29e558e
test expr-28.123 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +50609263 E157 x 1193aff1f1c8e3_000000000000000000000000000000001& E547
convertToDouble +50609263E157
} 0x622193aff1f1c8e3
test expr-28.124 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +70589528 E130 x 1e597c0b94b7ae_00000000000000000000000000000001& E457
convertToDouble +70589528E130
} 0x5c8e597c0b94b7ae
test expr-28.125 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -88236910 E129 x -1e597c0b94b7ae_00000000000000000000000000000001& E454
convertToDouble -88236910E129
} 0xdc5e597c0b94b7ae
test expr-28.126 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +87575437 E-310 x 1805c19e680456_0000000000000000000000000000000000001& E-1004
convertToDouble +87575437E-310
} 0x013805c19e680456
test expr-28.127 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -23135572 E-127 x -17e5902ce0e151_000000000000000000000000000000001& E-398
convertToDouble -23135572E-127
} 0xa717e5902ce0e151
test expr-28.128 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +85900881 E177 x 14375b2214e1b4_111111111111111111111111111111110& E614
convertToDouble +85900881E177
} 0x6654375b2214e1b5
test expr-28.129 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -84863171 E113 x -1a4a8e56474b8b_111111111111111111111111111111110& E401
convertToDouble -84863171E113
} 0xd90a4a8e56474b8c
test expr-28.130 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +68761586 E232 x 1a662c350f37f2_1111111111111111111111111111110& E796
convertToDouble +68761586E232
} 0x71ba662c350f37f3
test expr-28.131 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -50464069 E286 x -1948dd06de561e_1111111111111111111111111111110& E975
convertToDouble -50464069E286
} 0xfce948dd06de561f
test expr-28.132 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +27869147 E-248 x 1dbbac6f83a820_111111111111111111111111111111111110& E-800
convertToDouble +27869147E-248
} 0x0dfdbbac6f83a821
test expr-28.133 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -55738294 E-248 x -1dbbac6f83a820_111111111111111111111111111111111110& E-799
convertToDouble -55738294E-248
} 0x8e0dbbac6f83a821
test expr-28.134 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +70176353 E-53 x 100683a21de854_1111111111111111111111111111111110& E-150
convertToDouble +70176353E-53
} 0x36900683a21de855
test expr-28.135 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -80555086 E-32 x -1f29ca0ff893b0_111111111111111111111111111111110& E-81
convertToDouble -80555086E-32
} 0xbaef29ca0ff893b1
test expr-28.136 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -491080654 E121 x -1c569e968e0944_00000000000000000000000000000000000000001& E430
convertToDouble -491080654E121
} 0xdadc569e968e0944
test expr-28.137 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +526250918 E287 x 14997a298b2f2e_0000000000000000000000000000000000001& E982
convertToDouble +526250918E287
} 0x7d54997a298b2f2e
test expr-28.138 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -245540327 E121 x -1c569e968e0944_00000000000000000000000000000000000000001& E429
convertToDouble -245540327E121
} 0xdacc569e968e0944
test expr-28.139 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -175150874 E-310 x -1805c19e680456_0000000000000000000000000000000000001& E-1003
convertToDouble -175150874E-310
} 0x814805c19e680456
test expr-28.140 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +350301748 E-310 x 1805c19e680456_0000000000000000000000000000000000001& E-1002
convertToDouble +350301748E-310
} 0x015805c19e680456
test expr-28.141 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -437877185 E-311 x -1805c19e680456_0000000000000000000000000000000000001& E-1005
convertToDouble -437877185E-311
} 0x812805c19e680456
test expr-28.142 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +458117166 E52 x 16ce94febdc7a4_1111111111111111111111111111111111110& E201
convertToDouble +458117166E52
} 0x4c86ce94febdc7a5
test expr-28.143 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -916234332 E52 x -16ce94febdc7a4_1111111111111111111111111111111111110& E202
convertToDouble -916234332E52
} 0xcc96ce94febdc7a5
test expr-28.144 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +229058583 E52 x 16ce94febdc7a4_1111111111111111111111111111111111110& E200
convertToDouble +229058583E52
} 0x4c76ce94febdc7a5
test expr-28.145 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -525789935 E98 x -16ecdc2a58fc64_11111111111111111111111111111111110& E354
convertToDouble -525789935E98
} 0xd616ecdc2a58fc65
test expr-28.146 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +282926897 E-227 x 1ff5a70d3d2fee_1111111111111111111111111111111111110& E-727
convertToDouble +282926897E-227
} 0x128ff5a70d3d2fef
test expr-28.147 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -565853794 E-227 x -1ff5a70d3d2fee_1111111111111111111111111111111111110& E-726
convertToDouble -565853794E-227
} 0x929ff5a70d3d2fef
test expr-28.148 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +667284113 E-240 x 109355f8050c01_111111111111111111111111111111111110& E-768
convertToDouble +667284113E-240
} 0x0ff09355f8050c02
test expr-28.149 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -971212611 E-126 x -1397d3c9745d2e_111111111111111111111111111111111111110& E-389
convertToDouble -971212611E-126
} 0xa7a397d3c9745d2f
test expr-28.150 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9981396317 E-182 x 18afe10a2a66aa_0000000000000000000000000000000000000001& E-572
convertToDouble +9981396317E-182
} 0x1c38afe10a2a66aa
test expr-28.151 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5035231965 E-156 x -101891fc4717fd_00000000000000000000000000000000000001& E-486
convertToDouble -5035231965E-156
} 0xa1901891fc4717fd
test expr-28.152 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8336960483 E-153 x 1a06a1024b95e1_000000000000000000000000000000000000001& E-476
convertToDouble +8336960483E-153
} 0x223a06a1024b95e1
test expr-28.153 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8056371144 E-155 x -101891fc4717fd_00000000000000000000000000000000000001& E-482
convertToDouble -8056371144E-155
} 0xa1d01891fc4717fd
test expr-28.154 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6418488827 E79 x 1021f14ed7b3f9_11111111111111111111111111111111111111110& E295
convertToDouble +6418488827E79
} 0x526021f14ed7b3fa
test expr-28.155 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3981006983 E252 x -102ebaf189d5f1_1111111111111111111111111111111111111110& E869
convertToDouble -3981006983E252
} 0xf6402ebaf189d5f2
test expr-28.156 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7962013966 E252 x 102ebaf189d5f1_1111111111111111111111111111111111111110& E870
convertToDouble +7962013966E252
} 0x76502ebaf189d5f2
test expr-28.157 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -4713898551 E261 x -11d8813536e0df_11111111111111111111111111111111111110& E899
convertToDouble -4713898551E261
} 0xf821d8813536e0e0
test expr-28.158 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8715380633 E-58 x 14614c3219891e_11111111111111111111111111111111111111110& E-160
convertToDouble +8715380633E-58
} 0x35f4614c3219891f
test expr-28.159 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9078555839 E-109 x -1fc575867314ed_111111111111111111111111111111111111111111110& E-330
convertToDouble -9078555839E-109
} 0xab5fc575867314ee
test expr-28.160 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9712126110 E-127 x 1397d3c9745d2e_111111111111111111111111111111111111110& E-389
convertToDouble +9712126110E-127
} 0x27a397d3c9745d2f
test expr-28.161 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +42333842451 E201 x 10189a26df575f_000000000000000000000000000000000000000000001& E703
convertToDouble +42333842451E201
} 0x6be0189a26df575f
test expr-28.162 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -84667684902 E201 x -10189a26df575f_000000000000000000000000000000000000000000001& E704
convertToDouble -84667684902E201
} 0xebf0189a26df575f
test expr-28.163 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +23792120709 E-315 x 10b517dc5d3212_00000000000000000000000000000000000000001& E-1012
convertToDouble +23792120709E-315
} 0x00b0b517dc5d3212
test expr-28.164 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -78564021519 E-227 x -1155515fd37265_00000000000000000000000000000000000000000001& E-718
convertToDouble -78564021519E-227
} 0x931155515fd37265
test expr-28.165 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +71812054883 E-188 x 1747b46d78c6fe_00000000000000000000000000000000000000001& E-589
convertToDouble +71812054883E-188
} 0x1b2747b46d78c6fe
test expr-28.166 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -30311163631 E-116 x -163ef6f560afe7_00000000000000000000000000000000000000001& E-351
convertToDouble -30311163631E-116
} 0xaa063ef6f560afe7
test expr-28.167 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +71803914657 E292 x 10c0c44cdc2c05_11111111111111111111111111111111111111111110& E1006
convertToDouble +71803914657E292
} 0x7ed0c0c44cdc2c06
test expr-28.168 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +36314223356 E-109 x 1fc575867314ed_111111111111111111111111111111111111111111110& E-328
convertToDouble +36314223356E-109
} 0x2b7fc575867314ee
test expr-28.169 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +18157111678 E-109 x 1fc575867314ed_111111111111111111111111111111111111111111110& E-329
convertToDouble +18157111678E-109
} 0x2b6fc575867314ee
test expr-28.170 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -45392779195 E-110 x -1fc575867314ed_111111111111111111111111111111111111111111110& E-331
convertToDouble -45392779195E-110
} 0xab4fc575867314ee
test expr-28.171 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +778380362293 E218 x 19ab8261990292_0000000000000000000000000000000000000000000000000001& E763
convertToDouble +778380362293E218
} 0x6fa9ab8261990292
test expr-28.172 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -685763015669 E280 x -15fd7aa44d9477_000000000000000000000000000000000000000000000001& E969
convertToDouble -685763015669E280
} 0xfc85fd7aa44d9477
test expr-28.173 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +952918668151 E70 x 14177a9915fbf8_00000000000000000000000000000000000000000000001& E272
convertToDouble +952918668151E70
} 0x50f4177a9915fbf8
test expr-28.174 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -548357443505 E32 x -13abde2775e9b5_0000000000000000000000000000000000000000000001& E145
convertToDouble -548357443505E32
} 0xc903abde2775e9b5
test expr-28.175 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +384865004907 E-285 x 1aa65b58639e69_00000000000000000000000000000000000000000000001& E-909
convertToDouble +384865004907E-285
} 0x072aa65b58639e69
test expr-28.176 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -769730009814 E-285 x -1aa65b58639e69_00000000000000000000000000000000000000000000001& E-908
convertToDouble -769730009814E-285
} 0x873aa65b58639e69
test expr-28.177 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +697015418417 E-93 x 152847dad80453_0000000000000000000000000000000000000000000001& E-270
convertToDouble +697015418417E-93
} 0x2f152847dad80453
test expr-28.178 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -915654049301 E-28 x -1a645598d05989_0000000000000000000000000000000000000000000001& E-54
convertToDouble -915654049301E-28
} 0xbc9a645598d05989
test expr-28.179 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +178548656339 E169 x 1b89d67c5b6d24_111111111111111111111111111111111111111111110& E598
convertToDouble +178548656339E169
} 0x655b89d67c5b6d25
test expr-28.180 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -742522891517 E259 x -1c1c352fc3c308_11111111111111111111111111111111111111111111110& E899
convertToDouble -742522891517E259
} 0xf82c1c352fc3c309
test expr-28.181 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +742522891517 E258 x 167cf7596968d3_11111111111111111111111111111111111111111111110& E896
convertToDouble +742522891517E258
} 0x77f67cf7596968d4
test expr-28.182 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -357097312678 E169 x -1b89d67c5b6d24_111111111111111111111111111111111111111111110& E599
convertToDouble -357097312678E169
} 0xe56b89d67c5b6d25
test expr-28.183 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3113521449172 E218 x -19ab8261990292_0000000000000000000000000000000000000000000000000001& E765
convertToDouble -3113521449172E218
} 0xefc9ab8261990292
test expr-28.184 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3891901811465 E217 x 19ab8261990292_0000000000000000000000000000000000000000000000000001& E762
convertToDouble +3891901811465E217
} 0x6f99ab8261990292
test expr-28.185 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1556760724586 E218 x -19ab8261990292_0000000000000000000000000000000000000000000000000001& E764
convertToDouble -1556760724586E218
} 0xefb9ab8261990292
test expr-28.186 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9997878507563 E-195 x 153db2fea1ea31_0000000000000000000000000000000000000000000000001& E-605
convertToDouble +9997878507563E-195
} 0x1a253db2fea1ea31
test expr-28.187 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7247563029154 E-319 x -10493f056e9ef3_0000000000000000000000000000000000000000000000001& E-1017
convertToDouble -7247563029154E-319
} 0x8060493f056e9ef3
test expr-28.188 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3623781514577 E-319 x 10493f056e9ef3_0000000000000000000000000000000000000000000000001& E-1018
convertToDouble +3623781514577E-319
} 0x0050493f056e9ef3
test expr-28.189 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3092446298323 E-200 x -113918353bbc47_0000000000000000000000000000000000000000000000001& E-623
convertToDouble -3092446298323E-200
} 0x99013918353bbc47
test expr-28.190 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6363857920591 E145 x 128a61cf9483b6_1111111111111111111111111111111111111111111111111110& E524
convertToDouble +6363857920591E145
} 0x60b28a61cf9483b7
test expr-28.191 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8233559360849 E94 x -11f324d11d4861_1111111111111111111111111111111111111111111111110& E355
convertToDouble -8233559360849E94
} 0xd621f324d11d4862
test expr-28.192 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2689845954547 E49 x 10bd2bfd34f98a_1111111111111111111111111111111111111111111111110& E204
convertToDouble +2689845954547E49
} 0x4cb0bd2bfd34f98b
test expr-28.193 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5379691909094 E49 x -10bd2bfd34f98a_1111111111111111111111111111111111111111111111110& E205
convertToDouble -5379691909094E49
} 0xccc0bd2bfd34f98b
test expr-28.194 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +5560322501926 E-301 x 15acc2053064c1_11111111111111111111111111111111111111111111111110& E-958
convertToDouble +5560322501926E-301
} 0x0415acc2053064c2
test expr-28.195 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7812878489261 E-179 x -126dae7bbeda74_11111111111111111111111111111111111111111111111111110& E-552
convertToDouble -7812878489261E-179
} 0x9d726dae7bbeda75
test expr-28.196 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8439398533053 E-256 x 170cc285f2d209_1111111111111111111111111111111111111111111111110& E-808
convertToDouble +8439398533053E-256
} 0x0d770cc285f2d20a
test expr-28.197 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -2780161250963 E-301 x -15acc2053064c1_11111111111111111111111111111111111111111111111110& E-959
convertToDouble -2780161250963E-301
} 0x8405acc2053064c2
test expr-28.198 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -87605699161665 E155 x -12920f96e7f9ef_00000000000000000000000000000000000000000000000000001& E561
convertToDouble -87605699161665E155
} 0xe302920f96e7f9ef
test expr-28.199 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -17521139832333 E156 x -12920f96e7f9ef_00000000000000000000000000000000000000000000000000001& E562
convertToDouble -17521139832333E156
} 0xe312920f96e7f9ef
test expr-28.200 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -88218101363513 E-170 x -18395688592faf_0000000000000000000000000000000000000000000000000001& E-519
convertToDouble -88218101363513E-170
} 0x9f88395688592faf
test expr-28.201 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +38639244311627 E-115 x 114ef3e205c817_0000000000000000000000000000000000000000000000000001& E-337
convertToDouble +38639244311627E-115
} 0x2ae14ef3e205c817
test expr-28.202 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +35593959807306 E261 x 1072f3819c1320_11111111111111111111111111111111111111111111111111110& E912
convertToDouble +35593959807306E261
} 0x78f072f3819c1321
test expr-28.203 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -53390939710959 E260 x -13bd243521b08d_11111111111111111111111111111111111111111111111111110& E909
convertToDouble -53390939710959E260
} 0xf8c3bd243521b08e
test expr-28.204 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +71187919614612 E261 x 1072f3819c1320_11111111111111111111111111111111111111111111111111110& E913
convertToDouble +71187919614612E261
} 0x790072f3819c1321
test expr-28.205 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -88984899518265 E260 x -1072f3819c1320_11111111111111111111111111111111111111111111111111110& E910
convertToDouble -88984899518265E260
} 0xf8d072f3819c1321
test expr-28.206 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +77003665618895 E-73 x 18bf7e7fa6f029_111111111111111111111111111111111111111111111111111111110& E-197
convertToDouble +77003665618895E-73
} 0x33a8bf7e7fa6f02a
test expr-28.207 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -15400733123779 E-72 x -18bf7e7fa6f029_111111111111111111111111111111111111111111111111111111110& E-196
convertToDouble -15400733123779E-72
} 0xb3b8bf7e7fa6f02a
test expr-28.208 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +61602932495116 E-72 x 18bf7e7fa6f029_111111111111111111111111111111111111111111111111111111110& E-194
convertToDouble +61602932495116E-72
} 0x33d8bf7e7fa6f02a
test expr-28.209 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -30801466247558 E-72 x -18bf7e7fa6f029_111111111111111111111111111111111111111111111111111111110& E-195
convertToDouble -30801466247558E-72
} 0xb3c8bf7e7fa6f02a
test expr-28.210 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +834735494917063 E-300 x 1fc6c26f899dd1_0000000000000000000000000000000000000000000000000000000001& E-948
convertToDouble +834735494917063E-300
} 0x04bfc6c26f899dd1
test expr-28.211 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -589795149206434 E-151 x -15f2df5e675a0f_0000000000000000000000000000000000000000000000000000000001& E-453
convertToDouble -589795149206434E-151
} 0xa3a5f2df5e675a0f
test expr-28.212 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +475603213226859 E-42 x 12d73088f4050a_000000000000000000000000000000000000000000000000000000001& E-91
convertToDouble +475603213226859E-42
} 0x3a42d73088f4050a
test expr-28.213 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -294897574603217 E-151 x -15f2df5e675a0f_0000000000000000000000000000000000000000000000000000000001& E-454
convertToDouble -294897574603217E-151
} 0xa395f2df5e675a0f
test expr-28.214 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +850813008001913 E93 x 172f7a1831ad70_11111111111111111111111111111111111111111111111111111110& E358
convertToDouble +850813008001913E93
} 0x56572f7a1831ad71
test expr-28.215 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -203449172043339 E185 x -1102b47e4af987_11111111111111111111111111111111111111111111111111111110& E662
convertToDouble -203449172043339E185
} 0xe95102b47e4af988
test expr-28.216 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +406898344086678 E185 x 1102b47e4af987_11111111111111111111111111111111111111111111111111111110& E663
convertToDouble +406898344086678E185
} 0x696102b47e4af988
test expr-28.217 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -813796688173356 E185 x -1102b47e4af987_11111111111111111111111111111111111111111111111111111110& E664
convertToDouble -813796688173356E185
} 0xe97102b47e4af988
test expr-28.218 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6045338514609393 E244 x 1f746182e6cd5d_00000000000000000000000000000000000000000000000000000000001& E862
convertToDouble +6045338514609393E244
} 0x75df746182e6cd5d
test expr-28.219 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5145963778954906 E142 x -1dfc11fbf46087_00000000000000000000000000000000000000000000000000000000001& E523
convertToDouble -5145963778954906E142
} 0xe0adfc11fbf46087
test expr-28.220 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2572981889477453 E142 x 1dfc11fbf46087_00000000000000000000000000000000000000000000000000000000001& E522
convertToDouble +2572981889477453E142
} 0x609dfc11fbf46087
test expr-28.221 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -6965949469487146 E74 x -15e2c10ad970b0_0000000000000000000000000000000000000000000000000000000001& E298
convertToDouble -6965949469487146E74
} 0xd295e2c10ad970b0
test expr-28.222 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6182410494241627 E-119 x 11b96458445d07_0000000000000000000000000000000000000000000000000000000000001& E-343
convertToDouble +6182410494241627E-119
} 0x2a81b96458445d07
test expr-28.223 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8510309498186985 E-277 x -1acc46749dccfe_000000000000000000000000000000000000000000000000000000000001& E-868
convertToDouble -8510309498186985E-277
} 0x89bacc46749dccfe
test expr-28.224 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6647704637273331 E-212 x 13e07d2c0cb1e9_0000000000000000000000000000000000000000000000000000000000001& E-652
convertToDouble +6647704637273331E-212
} 0x1733e07d2c0cb1e9
test expr-28.225 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -2215901545757777 E-212 x -1a80a6e566428c_000000000000000000000000000000000000000000000000000000000001& E-654
convertToDouble -2215901545757777E-212
} 0x971a80a6e566428c
test expr-28.226 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3771476185376383 E276 x 183010aba78a53_111111111111111111111111111111111111111111111111111111111110& E968
convertToDouble +3771476185376383E276
} 0x7c783010aba78a54
test expr-28.227 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3729901848043846 E212 x -1f7d6721f7f143_111111111111111111111111111111111111111111111111111111111110& E755
convertToDouble -3729901848043846E212
} 0xef2f7d6721f7f144
test expr-28.228 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3771476185376383 E277 x 1e3c14d6916ce8_111111111111111111111111111111111111111111111111111111111110& E971
convertToDouble +3771476185376383E277
} 0x7cae3c14d6916ce9
test expr-28.229 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9977830465649166 E119 x -15f6de9d5d6b5a_111111111111111111111111111111111111111111111111111111111110& E448
convertToDouble -9977830465649166E119
} 0xdbf5f6de9d5d6b5b
test expr-28.230 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8439928496349319 E-142 x 12483a0f125699_111111111111111111111111111111111111111111111111111111111110& E-419
convertToDouble +8439928496349319E-142
} 0x25c2483a0f12569a
test expr-28.231 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8204230082070882 E-59 x -1d460f4fca1d36_1111111111111111111111111111111111111111111111111111111110& E-144
convertToDouble -8204230082070882E-59
} 0xb6fd460f4fca1d37
test expr-28.232 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8853686434843997 E-244 x 157a340eb5d4f0_11111111111111111111111111111111111111111111111111111111110& E-758
convertToDouble +8853686434843997E-244
} 0x10957a340eb5d4f1
test expr-28.233 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5553274272288559 E-104 x -1c47d20a19d1ed_1111111111111111111111111111111111111111111111111111111110& E-294
convertToDouble -5553274272288559E-104
} 0xad9c47d20a19d1ee
test expr-28.234 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +36149023611096162 E144 x 1491daad0ba280_0000000000000000000000000000000000000000000000000000000000000001& E533
convertToDouble +36149023611096162E144
} 0x614491daad0ba280
test expr-28.235 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -36149023611096162 E147 x -14166f8cfd5cb1_0000000000000000000000000000000000000000000000000000000000000001& E543
convertToDouble -36149023611096162E147
} 0xe1e4166f8cfd5cb1
test expr-28.236 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +18074511805548081 E146 x 1011f2d73116f4_0000000000000000000000000000000000000000000000000000000000000001& E539
convertToDouble +18074511805548081E146
} 0x61a011f2d73116f4
test expr-28.237 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -18074511805548081 E147 x -14166f8cfd5cb1_0000000000000000000000000000000000000000000000000000000000000001& E542
convertToDouble -18074511805548081E147
} 0xe1d4166f8cfd5cb1
test expr-28.238 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +97338774138954421 E-290 x 10d9b828199006_0000000000000000000000000000000000000000000000000000000000000001& E-907
convertToDouble +97338774138954421E-290
} 0x0740d9b828199006
test expr-28.239 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -88133809804950961 E-308 x -119710dc581911_000000000000000000000000000000000000000000000000000000000000001& E-967
convertToDouble -88133809804950961E-308
} 0x83819710dc581911
test expr-28.240 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +94080055902682397 E-243 x 11d467e94b856e_0000000000000000000000000000000000000000000000000000000000000001& E-751
convertToDouble +94080055902682397E-243
} 0x1101d467e94b856e
test expr-28.241 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -24691002732654881 E-115 x -159a2783ce70ab_000000000000000000000000000000000000000000000000000000000000001& E-328
convertToDouble -24691002732654881E-115
} 0xab759a2783ce70ab
test expr-28.242 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +52306490527514614 E49 x 13de005bd620de_111111111111111111111111111111111111111111111111111111111111111110& E218
convertToDouble +52306490527514614E49
} 0x4d93de005bd620df
test expr-28.243 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -26153245263757307 E49 x -13de005bd620de_111111111111111111111111111111111111111111111111111111111111111110& E217
convertToDouble -26153245263757307E49
} 0xcd83de005bd620df
test expr-28.244 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +55188692254193604 E165 x 1a999ddec72ac9_11111111111111111111111111111111111111111111111111111111111110& E603
convertToDouble +55188692254193604E165
} 0x65aa999ddec72aca
test expr-28.245 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -68985865317742005 E164 x -1a999ddec72ac9_11111111111111111111111111111111111111111111111111111111111110& E600
convertToDouble -68985865317742005E164
} 0xe57a999ddec72aca
test expr-28.246 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +27176258005319167 E-261 x 17c0747bd76fa0_11111111111111111111111111111111111111111111111111111111111111110& E-813
convertToDouble +27176258005319167E-261
} 0x0d27c0747bd76fa1
test expr-28.247 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -73169230107256116 E-248 x -122cea327fa99c_1111111111111111111111111111111111111111111111111111111111110& E-768
convertToDouble -73169230107256116E-248
} 0x8ff22cea327fa99d
test expr-28.248 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +91461537634070145 E-249 x 122cea327fa99c_1111111111111111111111111111111111111111111111111111111111110& E-771
convertToDouble +91461537634070145E-249
} 0x0fc22cea327fa99d
test expr-28.249 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -54352516010638334 E-261 x -17c0747bd76fa0_11111111111111111111111111111111111111111111111111111111111111110& E-812
convertToDouble -54352516010638334E-261
} 0x8d37c0747bd76fa1
test expr-28.250 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +586144289638535878 E280 x 11eccbd6f62709_0000000000000000000000000000000000000000000000000000000000000000001& E989
convertToDouble +586144289638535878E280
} 0x7dc1eccbd6f62709
test expr-28.251 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -601117006785295431 E245 x -1e8b3525b3737e_000000000000000000000000000000000000000000000000000000000000000001& E872
convertToDouble -601117006785295431E245
} 0xf67e8b3525b3737e
test expr-28.252 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +293072144819267939 E280 x 11eccbd6f62709_0000000000000000000000000000000000000000000000000000000000000000001& E988
convertToDouble +293072144819267939E280
} 0x7db1eccbd6f62709
test expr-28.253 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -953184713238516652 E272 x -138fd93f1f5342_00000000000000000000000000000000000000000000000000000000000000001& E963
convertToDouble -953184713238516652E272
} 0xfc238fd93f1f5342
test expr-28.254 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +902042358290366539 E-281 x 122dc01ca1cb8c_0000000000000000000000000000000000000000000000000000000000000000001& E-874
convertToDouble +902042358290366539E-281
} 0x09522dc01ca1cb8c
test expr-28.255 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -557035730189854663 E-294 x -13bfac6bc4767b_00000000000000000000000000000000000000000000000000000000000000000001& E-918
convertToDouble -557035730189854663E-294
} 0x8693bfac6bc4767b
test expr-28.256 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +902042358290366539 E-280 x 16b93023ca3e6f_0000000000000000000000000000000000000000000000000000000000000000001& E-871
convertToDouble +902042358290366539E-280
} 0x0986b93023ca3e6f
test expr-28.257 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -354944100507554393 E-238 x -19a91cece6ad07_000000000000000000000000000000000000000000000000000000000000000001& E-733
convertToDouble -354944100507554393E-238
} 0x9229a91cece6ad07
test expr-28.258 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +272104041512242479 E199 x 1f92bacb3cb40b_11111111111111111111111111111111111111111111111111111111111111111111110& E718
convertToDouble +272104041512242479E199
} 0x6cdf92bacb3cb40c
test expr-28.259 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -816312124536727437 E199 x -17ae0c186d8708_11111111111111111111111111111111111111111111111111111111111111111111110& E720
convertToDouble -816312124536727437E199
} 0xecf7ae0c186d8709
test expr-28.260 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +544208083024484958 E199 x 1f92bacb3cb40b_11111111111111111111111111111111111111111111111111111111111111111111110& E719
convertToDouble +544208083024484958E199
} 0x6cef92bacb3cb40c
test expr-28.261 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -792644927852378159 E78 x -17bff336d8ff05_111111111111111111111111111111111111111111111111111111111111111111110& E318
convertToDouble -792644927852378159E78
} 0xd3d7bff336d8ff06
test expr-28.262 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -679406450132979175 E-263 x -17c0747bd76fa0_11111111111111111111111111111111111111111111111111111111111111110& E-815
convertToDouble -679406450132979175E-263
} 0x8d07c0747bd76fa1
test expr-28.263 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +543525160106383340 E-262 x 17c0747bd76fa0_11111111111111111111111111111111111111111111111111111111111111110& E-812
convertToDouble +543525160106383340E-262
} 0x0d37c0747bd76fa1
test expr-28.264 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7400253695682920196 E215 x 1dca94e3990085_00000000000000000000000000000000000000000000000000000000000000000000001& E776
convertToDouble +7400253695682920196E215
} 0x707dca94e3990085
test expr-28.265 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1850063423920730049 E215 x -1dca94e3990085_00000000000000000000000000000000000000000000000000000000000000000000001& E774
convertToDouble -1850063423920730049E215
} 0xf05dca94e3990085
test expr-28.266 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3700126847841460098 E215 x 1dca94e3990085_00000000000000000000000000000000000000000000000000000000000000000000001& E775
convertToDouble +3700126847841460098E215
} 0x706dca94e3990085
test expr-28.267 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9250317119603650245 E214 x -1dca94e3990085_00000000000000000000000000000000000000000000000000000000000000000000001& E773
convertToDouble -9250317119603650245E214
} 0xf04dca94e3990085
test expr-28.268 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8396094300569779681 E-252 x 1ab223efcee35a_0000000000000000000000000000000000000000000000000000000000000000000000001& E-775
convertToDouble +8396094300569779681E-252
} 0x0f8ab223efcee35a
test expr-28.269 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3507665085003296281 E-75 x -160499b881ea50_00000000000000000000000000000000000000000000000000000000000000000000001& E-188
convertToDouble -3507665085003296281E-75
} 0xb4360499b881ea50
test expr-28.270 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7015330170006592562 E-75 x 160499b881ea50_00000000000000000000000000000000000000000000000000000000000000000000001& E-187
convertToDouble +7015330170006592562E-75
} 0x34460499b881ea50
test expr-28.271 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7015330170006592562 E-74 x -1b85c026a264e4_00000000000000000000000000000000000000000000000000000000000000000000001& E-184
convertToDouble -7015330170006592562E-74
} 0xb47b85c026a264e4
test expr-28.272 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7185620434951919351 E205 x 18d92d2bcc7a80_1111111111111111111111111111111111111111111111111111111111111111111111110& E743
convertToDouble +7185620434951919351E205
} 0x6e68d92d2bcc7a81
test expr-28.273 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1360520207561212395 E198 x -1f92bacb3cb40b_11111111111111111111111111111111111111111111111111111111111111111111110& E717
convertToDouble -1360520207561212395E198
} 0xeccf92bacb3cb40c
test expr-28.274 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2178999185345151731 E-184 x 19b2c4d2a82335_1111111111111111111111111111111111111111111111111111111111111111111110& E-551
convertToDouble +2178999185345151731E-184
} 0x1d89b2c4d2a82336
test expr-28.275 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8691089486201567102 E-218 x -1a9c42e5b6d89e_1111111111111111111111111111111111111111111111111111111111111111111110& E-662
convertToDouble -8691089486201567102E-218
} 0x969a9c42e5b6d89f
test expr-28.276 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +4345544743100783551 E-218 x 1a9c42e5b6d89e_1111111111111111111111111111111111111111111111111111111111111111111110& E-663
convertToDouble +4345544743100783551E-218
} 0x168a9c42e5b6d89f
test expr-28.277 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -4357998370690303462 E-184 x -19b2c4d2a82335_1111111111111111111111111111111111111111111111111111111111111111111110& E-550
convertToDouble -4357998370690303462E-184
} 0x9d99b2c4d2a82336
test expr-28.278 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +59825267349106892461 E177 x 199c476d7868df_000000000000000000000000000000000000000000000000000000000000000000000001& E653
convertToDouble +59825267349106892461E177
} 0x68c99c476d7868df
test expr-28.279 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -62259110684423957791 E47 x -1d8f2cfc20d6e8_0000000000000000000000000000000000000000000000000000000000000000000000001& E221
convertToDouble -62259110684423957791E47
} 0xcdcd8f2cfc20d6e8
test expr-28.280 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +58380168477038565599 E265 x 1f686e9efbe48d_00000000000000000000000000000000000000000000000000000000000000000000000001& E945
convertToDouble +58380168477038565599E265
} 0x7b0f686e9efbe48d
test expr-28.281 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -62259110684423957791 E48 x -12797c1d948651_0000000000000000000000000000000000000000000000000000000000000000000000001& E225
convertToDouble -62259110684423957791E48
} 0xce02797c1d948651
test expr-28.282 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -33584377202279118724 E-252 x -1ab223efcee35a_0000000000000000000000000000000000000000000000000000000000000000000000001& E-773
convertToDouble -33584377202279118724E-252
} 0x8faab223efcee35a
test expr-28.283 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -57484963479615354808 E205 x -18d92d2bcc7a80_1111111111111111111111111111111111111111111111111111111111111111111111110& E746
convertToDouble -57484963479615354808E205
} 0xee98d92d2bcc7a81
test expr-28.284 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +71856204349519193510 E204 x 18d92d2bcc7a80_1111111111111111111111111111111111111111111111111111111111111111111111110& E743
convertToDouble +71856204349519193510E204
} 0x6e68d92d2bcc7a81
test expr-28.285 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -14371240869903838702 E205 x -18d92d2bcc7a80_1111111111111111111111111111111111111111111111111111111111111111111111110& E744
convertToDouble -14371240869903838702E205
} 0xee78d92d2bcc7a81
test expr-28.286 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +36992084760177624177 E-318 x 18c5f9551c2f99_111111111111111111111111111111111111111111111111111111111111111111111110& E-992
convertToDouble +36992084760177624177E-318
} 0x01f8c5f9551c2f9a
test expr-28.287 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -73984169520355248354 E-318 x -18c5f9551c2f99_111111111111111111111111111111111111111111111111111111111111111111111110& E-991
convertToDouble -73984169520355248354E-318
} 0x8208c5f9551c2f9a
test expr-28.288 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +99257763227713890244 E-115 x 15338a554b9ce0_11111111111111111111111111111111111111111111111111111111111111111111110& E-316
convertToDouble +99257763227713890244E-115
} 0x2c35338a554b9ce1
test expr-28.289 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -87336362425182547697 E-280 x -1130304e7d9c32_11111111111111111111111111111111111111111111111111111111111111111111110& E-864
convertToDouble -87336362425182547697E-280
} 0x89f130304e7d9c33
test expr-28.290 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7 E289 x 1cbb547777a284_10000000001& E962
convertToDouble +7E289
} 0x7c1cbb547777a285
test expr-28.291 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3 E153 x -1ca3d8e6d80cba_100000001& E509
convertToDouble -3E153
} 0xdfcca3d8e6d80cbb
test expr-28.292 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6 E153 x 1ca3d8e6d80cba_100000001& E510
convertToDouble +6E153
} 0x5fdca3d8e6d80cbb
test expr-28.293 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5 E243 x -176ec98994f488_10000001& E809
convertToDouble -5E243
} 0xf2876ec98994f489
test expr-28.294 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7 E-161 x 1f7e0db3799aa2_10000000001& E-533
convertToDouble +7E-161
} 0x1eaf7e0db3799aa3
test expr-28.295 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7 E-172 x -15a4337446ef2a_1000000001& E-569
convertToDouble -7E-172
} 0x9c65a4337446ef2b
test expr-28.296 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8 E-63 x 1a53fc9631d10c_10000001& E-207
convertToDouble +8E-63
} 0x330a53fc9631d10d
test expr-28.297 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7 E-113 x -158c47e6eea282_10000001& E-373
convertToDouble -7E-113
} 0xa8a58c47e6eea283
test expr-28.298 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8 E126 x 17a2ecc414a03f_0111111111110& E421
convertToDouble +8E126
} 0x5a47a2ecc414a03f
test expr-28.299 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -4 E126 x -17a2ecc414a03f_0111111111110& E420
convertToDouble -4E126
} 0xda37a2ecc414a03f
test expr-28.300 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +5 E125 x 17a2ecc414a03f_0111111111110& E417
convertToDouble +5E125
} 0x5a07a2ecc414a03f
test expr-28.301 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1 E126 x -17a2ecc414a03f_0111111111110& E418
convertToDouble -1E126
} 0xda17a2ecc414a03f
test expr-28.302 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8 E-163 x 1708d0f84d3de7_011111110& E-539
convertToDouble +8E-163
} 0x1e4708d0f84d3de7
test expr-28.303 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1 E-163 x -1708d0f84d3de7_011111110& E-542
convertToDouble -1E-163
} 0x9e1708d0f84d3de7
test expr-28.304 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2 E-163 x 1708d0f84d3de7_011111110& E-541
convertToDouble +2E-163
} 0x1e2708d0f84d3de7
test expr-28.305 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -4 E-163 x -1708d0f84d3de7_011111110& E-540
convertToDouble -4E-163
} 0x9e3708d0f84d3de7
test expr-28.306 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +51 E195 x 15d51d249dca42_1000000000001& E653
convertToDouble +51E195
} 0x68c5d51d249dca43
test expr-28.307 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -37 E46 x -1033d7eca0adee_100000000000001& E158
convertToDouble -37E46
} 0xc9d033d7eca0adef
test expr-28.308 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +74 E46 x 1033d7eca0adee_100000000000001& E159
convertToDouble +74E46
} 0x49e033d7eca0adef
test expr-28.309 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -56 E289 x -1cbb547777a284_10000000001& E965
convertToDouble -56E289
} 0xfc4cbb547777a285
test expr-28.310 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +69 E-145 x 158a41b31c9a9a_100000000001& E-476
convertToDouble +69E-145
} 0x22358a41b31c9a9b
test expr-28.311 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -70 E-162 x -1f7e0db3799aa2_10000000001& E-533
convertToDouble -70E-162
} 0x9eaf7e0db3799aa3
test expr-28.312 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +56 E-161 x 1f7e0db3799aa2_10000000001& E-530
convertToDouble +56E-161
} 0x1edf7e0db3799aa3
test expr-28.313 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -21 E-303 x -1ccd59caa6a750_10000000001& E-1003
convertToDouble -21E-303
} 0x814ccd59caa6a751
test expr-28.314 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +34 E-276 x 12d5a4350d30ff_011111111110& E-912
convertToDouble +34E-276
} 0x06f2d5a4350d30ff
test expr-28.315 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -68 E-276 x -12d5a4350d30ff_011111111110& E-911
convertToDouble -68E-276
} 0x8702d5a4350d30ff
test expr-28.316 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +85 E-277 x 12d5a4350d30ff_011111111110& E-914
convertToDouble +85E-277
} 0x06d2d5a4350d30ff
test expr-28.317 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -87 E-274 x -12d36cf48e7abd_011111111111110& E-904
convertToDouble -87E-274
} 0x8772d36cf48e7abd
test expr-28.318 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +829 E102 x 17221a79cdd1d8_1000000000000001& E348
convertToDouble +829E102
} 0x55b7221a79cdd1d9
test expr-28.319 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -623 E100 x -1640a62f3a83de_10000000000000000001& E341
convertToDouble -623E100
} 0xd54640a62f3a83df
test expr-28.320 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +723 E-162 x 145457ee24abd2_1000000000000001& E-529
convertToDouble +723E-162
} 0x1ee45457ee24abd3
test expr-28.321 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -457 E-102 x -1ffc81bc29f02a_100000000000000001& E-331
convertToDouble -457E-102
} 0xab4ffc81bc29f02b
test expr-28.322 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +914 E-102 x 1ffc81bc29f02a_100000000000000001& E-330
convertToDouble +914E-102
} 0x2b5ffc81bc29f02b
test expr-28.323 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -323 E-135 x -1d589ae4d70218_10000000000001& E-441
convertToDouble -323E-135
} 0xa46d589ae4d70219
test expr-28.324 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +151 E176 x 1dcf7df8f573b7_0111111111111111110& E591
convertToDouble +151E176
} 0x64edcf7df8f573b7
test expr-28.325 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -302 E176 x -1dcf7df8f573b7_0111111111111111110& E592
convertToDouble -302E176
} 0xe4fdcf7df8f573b7
test expr-28.326 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +921 E90 x 1c420a45fd70ff_0111111111111110& E308
convertToDouble +921E90
} 0x533c420a45fd70ff
test expr-28.327 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -604 E176 x -1dcf7df8f573b7_0111111111111111110& E593
convertToDouble -604E176
} 0xe50dcf7df8f573b7
test expr-28.328 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +823 E-206 x 14a48933c208ad_0111111111111110& E-675
convertToDouble +823E-206
} 0x15c4a48933c208ad
test expr-28.329 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -463 E-114 x -11d0c83f6378a5_011111111111110& E-370
convertToDouble -463E-114
} 0xa8d1d0c83f6378a5
test expr-28.330 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +348 E-274 x 12d36cf48e7abd_011111111111110& E-902
convertToDouble +348E-274
} 0x0792d36cf48e7abd
test expr-28.331 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9968 E100 x 1640a62f3a83de_10000000000000000001& E345
convertToDouble +9968E100
} 0x558640a62f3a83df
test expr-28.332 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -6230 E99 x -1640a62f3a83de_10000000000000000001& E341
convertToDouble -6230E99
} 0xd54640a62f3a83df
test expr-28.333 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +1246 E100 x 1640a62f3a83de_10000000000000000001& E342
convertToDouble +1246E100
} 0x555640a62f3a83df
test expr-28.334 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6676 E-296 x 15519ac5142aaa_1000000000000000000001& E-971
convertToDouble +6676E-296
} 0x0345519ac5142aab
test expr-28.335 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8345 E-297 x -15519ac5142aaa_1000000000000000000001& E-974
convertToDouble -8345E-297
} 0x8315519ac5142aab
test expr-28.336 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +1669 E-296 x 15519ac5142aaa_1000000000000000000001& E-973
convertToDouble +1669E-296
} 0x0325519ac5142aab
test expr-28.337 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3338 E-296 x -15519ac5142aaa_1000000000000000000001& E-972
convertToDouble -3338E-296
} 0x8335519ac5142aab
test expr-28.338 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3257 E58 x 1444b34a6fb3eb_01111111111111111110& E204
convertToDouble +3257E58
} 0x4cb444b34a6fb3eb
test expr-28.339 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -6514 E58 x -1444b34a6fb3eb_01111111111111111110& E205
convertToDouble -6514E58
} 0xccc444b34a6fb3eb
test expr-28.340 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2416 E176 x 1dcf7df8f573b7_0111111111111111110& E595
convertToDouble +2416E176
} 0x652dcf7df8f573b7
test expr-28.341 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8085 E-63 x 19fbf3c19b9a79_0111111111111111110& E-197
convertToDouble +8085E-63
} 0x33a9fbf3c19b9a79
test expr-28.342 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3234 E-62 x -19fbf3c19b9a79_0111111111111111110& E-195
convertToDouble -3234E-62
} 0xb3c9fbf3c19b9a79
test expr-28.343 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +1617 E-62 x 19fbf3c19b9a79_0111111111111111110& E-196
convertToDouble +1617E-62
} 0x33b9fbf3c19b9a79
test expr-28.344 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -6468 E-62 x -19fbf3c19b9a79_0111111111111111110& E-194
convertToDouble -6468E-62
} 0xb3d9fbf3c19b9a79
test expr-28.345 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +53418 E111 x 15b1051df943a8_1000000000000000000001& E384
convertToDouble +53418E111
} 0x57f5b1051df943a9
test expr-28.346 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -60513 E160 x -15043b64e56c72_1000000000000000000001& E547
convertToDouble -60513E160
} 0xe225043b64e56c73
test expr-28.347 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +26709 E111 x 15b1051df943a8_1000000000000000000001& E383
convertToDouble +26709E111
} 0x57e5b1051df943a9
test expr-28.348 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -99447 E166 x -10782189b336ae_1000000000000000000001& E568
convertToDouble -99447E166
} 0xe370782189b336af
test expr-28.349 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +12549 E48 x 10c52fe6dc6a1b_011111111111111111111110& E173
convertToDouble +12549E48
} 0x4ac0c52fe6dc6a1b
test expr-28.350 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -25098 E48 x -10c52fe6dc6a1b_011111111111111111111110& E174
convertToDouble -25098E48
} 0xcad0c52fe6dc6a1b
test expr-28.351 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +50196 E48 x 10c52fe6dc6a1b_011111111111111111111110& E175
convertToDouble +50196E48
} 0x4ae0c52fe6dc6a1b
test expr-28.352 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -62745 E47 x -10c52fe6dc6a1b_011111111111111111111110& E172
convertToDouble -62745E47
} 0xcab0c52fe6dc6a1b
test expr-28.353 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +83771 E-73 x 1ce886fb5ffd6d_0111111111111111111110& E-227
convertToDouble +83771E-73
} 0x31cce886fb5ffd6d
test expr-28.354 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -97451 E-167 x -1c0f220fb1c70d_01111111111111111111110& E-539
convertToDouble -97451E-167
} 0x9e4c0f220fb1c70d
test expr-28.355 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +86637 E-203 x 10943edb4e81db_0111111111111111111110& E-658
convertToDouble +86637E-203
} 0x16d0943edb4e81db
test expr-28.356 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -75569 E-254 x -15a462d91c6ab3_0111111111111111111111111110& E-828
convertToDouble -75569E-254
} 0x8c35a462d91c6ab3
test expr-28.357 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +473806 E83 x 17d15bf3186080_1000000000000000000000001& E294
convertToDouble +473806E83
} 0x5257d15bf3186081
test expr-28.358 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -947612 E83 x -17d15bf3186080_1000000000000000000000001& E295
convertToDouble -947612E83
} 0xd267d15bf3186081
test expr-28.359 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +292369 E76 x 18a85eb277e644_100000000000000000000000001& E270
convertToDouble +292369E76
} 0x50d8a85eb277e645
test expr-28.360 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -584738 E76 x -18a85eb277e644_100000000000000000000000001& E271
convertToDouble -584738E76
} 0xd0e8a85eb277e645
test expr-28.361 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +933587 E-140 x 1b248728b9c116_100000000000000000000000001& E-446
convertToDouble +933587E-140
} 0x241b248728b9c117
test expr-28.362 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -720919 E-14 x -1ef696965cbf04_10000000000000000000000001& E-28
convertToDouble -720919E-14
} 0xbe3ef696965cbf05
test expr-28.363 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +535001 E-149 x 10b38e07c745ae_1000000000000000000000001& E-476
convertToDouble +535001E-149
} 0x2230b38e07c745af
test expr-28.364 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -890521 E-235 x -114828ee39c852_1000000000000000000000001& E-761
convertToDouble -890521E-235
} 0x90614828ee39c853
test expr-28.365 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +548057 E81 x 11a1d9135cca53_0111111111111111111111110& E288
convertToDouble +548057E81
} 0x51f1a1d9135cca53
test expr-28.366 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -706181 E88 x -1b156ac4c2d1e5_0111111111111111111111110& E311
convertToDouble -706181E88
} 0xd36b156ac4c2d1e5
test expr-28.367 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +820997 E106 x 1b4f8b64fa125d_0111111111111111111111110& E371
convertToDouble +820997E106
} 0x572b4f8b64fa125d
test expr-28.368 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -320681 E63 x -17ca18a876c5ef_0111111111111111111111110& E227
convertToDouble -320681E63
} 0xce27ca18a876c5ef
test expr-28.369 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +928609 E-261 x 1be2dd66200bef_011111111111111111111111111110& E-848
convertToDouble +928609E-261
} 0x0afbe2dd66200bef
test expr-28.370 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -302276 E-254 x -15a462d91c6ab3_0111111111111111111111111110& E-826
convertToDouble -302276E-254
} 0x8c55a462d91c6ab3
test expr-28.371 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +151138 E-254 x 15a462d91c6ab3_0111111111111111111111111110& E-827
convertToDouble +151138E-254
} 0x0c45a462d91c6ab3
test expr-28.372 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +4691773 E45 x 19147b9330eaae_1000000000000000000000000001& E171
convertToDouble +4691773E45
} 0x4aa9147b9330eaaf
test expr-28.373 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9383546 E45 x -19147b9330eaae_1000000000000000000000000001& E172
convertToDouble -9383546E45
} 0xcab9147b9330eaaf
test expr-28.374 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3059949 E-243 x 13ecf22ea07862_10000000000000000000000000001& E-786
convertToDouble +3059949E-243
} 0x0ed3ecf22ea07863
test expr-28.375 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -6119898 E-243 x -13ecf22ea07862_10000000000000000000000000001& E-785
convertToDouble -6119898E-243
} 0x8ee3ecf22ea07863
test expr-28.376 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +5356626 E-213 x 1b84252abdf6ba_100000000000000000000000001& E-686
convertToDouble +5356626E-213
} 0x151b84252abdf6bb
test expr-28.377 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -4877378 E-199 x -11cd5cd90cb200_100000000000000000000000001& E-639
convertToDouble -4877378E-199
} 0x9801cd5cd90cb201
test expr-28.378 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7716693 E223 x 1972d9d2cff683_01111111111111111111111111110& E763
convertToDouble +7716693E223
} 0x6fa972d9d2cff683
test expr-28.379 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5452869 E109 x -16247b136fecc3_01111111111111111111111111110& E384
convertToDouble -5452869E109
} 0xd7f6247b136fecc3
test expr-28.380 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +4590831 E156 x 14689b4a5fa201_011111111111111111111111111110& E540
convertToDouble +4590831E156
} 0x61b4689b4a5fa201
test expr-28.381 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9181662 E156 x -14689b4a5fa201_011111111111111111111111111110& E541
convertToDouble -9181662E156
} 0xe1c4689b4a5fa201
test expr-28.382 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3714436 E-261 x -1be2dd66200bef_011111111111111111111111111110& E-846
convertToDouble -3714436E-261
} 0x8b1be2dd66200bef
test expr-28.383 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +4643045 E-262 x 1be2dd66200bef_011111111111111111111111111110& E-849
convertToDouble +4643045E-262
} 0x0aebe2dd66200bef
test expr-28.384 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7428872 E-261 x -1be2dd66200bef_011111111111111111111111111110& E-845
convertToDouble -7428872E-261
} 0x8b2be2dd66200bef
test expr-28.385 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +52942146 E130 x 16c31d08af89c2_10000000000000000000000000000001& E457
convertToDouble +52942146E130
} 0x5c86c31d08af89c3
test expr-28.386 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -27966061 E145 x -155bcf72fd10f8_1000000000000000000000000000000001& E506
convertToDouble -27966061E145
} 0xdf955bcf72fd10f9
test expr-28.387 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +26471073 E130 x 16c31d08af89c2_10000000000000000000000000000001& E456
convertToDouble +26471073E130
} 0x5c76c31d08af89c3
test expr-28.388 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -55932122 E145 x -155bcf72fd10f8_1000000000000000000000000000000001& E507
convertToDouble -55932122E145
} 0xdfa55bcf72fd10f9
test expr-28.389 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +95412548 E-99 x 18e0bfb98864c8_100000000000000000000000000000001& E-303
convertToDouble +95412548E-99
} 0x2d08e0bfb98864c9
test expr-28.390 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -47706274 E-99 x -18e0bfb98864c8_100000000000000000000000000000001& E-304
convertToDouble -47706274E-99
} 0xacf8e0bfb98864c9
test expr-28.391 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +23853137 E-99 x 18e0bfb98864c8_100000000000000000000000000000001& E-305
convertToDouble +23853137E-99
} 0x2ce8e0bfb98864c9
test expr-28.392 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -78493654 E-301 x -140d76077b648e_10000000000000000000000000000001& E-974
convertToDouble -78493654E-301
} 0x83140d76077b648f
test expr-28.393 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +65346417 E29 x 13aa1ad778f23b_0111111111111111111111111111110& E122
convertToDouble +65346417E29
} 0x4793aa1ad778f23b
test expr-28.394 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -51083099 E167 x -14a75eb58df47b_0111111111111111111111111111110& E580
convertToDouble -51083099E167
} 0xe434a75eb58df47b
test expr-28.395 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +89396333 E264 x 1526f061ca9053_0111111111111111111111111111111110& E903
convertToDouble +89396333E264
} 0x786526f061ca9053
test expr-28.396 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -84863171 E114 x -106e98f5ec8f37_0111111111111111111111111111111110& E405
convertToDouble -84863171E114
} 0xd9406e98f5ec8f37
test expr-28.397 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +59540836 E-251 x 10430c2d075c07_011111111111111111111111111111110& E-808
convertToDouble +59540836E-251
} 0x0d70430c2d075c07
test expr-28.398 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -74426045 E-252 x -10430c2d075c07_011111111111111111111111111111110& E-811
convertToDouble -74426045E-252
} 0x8d40430c2d075c07
test expr-28.399 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +14885209 E-251 x 10430c2d075c07_011111111111111111111111111111110& E-810
convertToDouble +14885209E-251
} 0x0d50430c2d075c07
test expr-28.400 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -29770418 E-251 x -10430c2d075c07_011111111111111111111111111111110& E-809
convertToDouble -29770418E-251
} 0x8d60430c2d075c07
test expr-28.401 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +982161308 E122 x 11b6231e18c5ca_100000000000000000000000000000000000000001& E435
convertToDouble +982161308E122
} 0x5b21b6231e18c5cb
test expr-28.402 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -245540327 E122 x -11b6231e18c5ca_100000000000000000000000000000000000000001& E433
convertToDouble -245540327E122
} 0xdb01b6231e18c5cb
test expr-28.403 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +491080654 E122 x 11b6231e18c5ca_100000000000000000000000000000000000000001& E434
convertToDouble +491080654E122
} 0x5b11b6231e18c5cb
test expr-28.404 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +525452622 E-310 x 12045136ce0340_1000000000000000000000000000000000001& E-1001
convertToDouble +525452622E-310
} 0x0162045136ce0341
test expr-28.405 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -771837113 E-134 x -14e61f991c4ed0_100000000000000000000000000000000001& E-416
convertToDouble -771837113E-134
} 0xa5f4e61f991c4ed1
test expr-28.406 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +820858081 E-150 x 14050669985a86_10000000000000000000000000000000001& E-469
convertToDouble +820858081E-150
} 0x22a4050669985a87
test expr-28.407 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -262726311 E-310 x -12045136ce0340_1000000000000000000000000000000000001& E-1002
convertToDouble -262726311E-310
} 0x8152045136ce0341
test expr-28.408 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +923091487 E209 x 10bc60e6896717_011111111111111111111111111111111110& E724
convertToDouble +923091487E209
} 0x6d30bc60e6896717
test expr-28.409 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -653777767 E273 x -120223f2b3a881_0111111111111111111111111111111111111110& E936
convertToDouble -653777767E273
} 0xfa720223f2b3a881
test expr-28.410 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +842116236 E-53 x 1809c5732cdc7f_0111111111111111111111111111111110& E-147
convertToDouble +842116236E-53
} 0x36c809c5732cdc7f
test expr-28.411 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -741111169 E-202 x -15a3e1d1b73099_01111111111111111111111111111111110& E-642
convertToDouble -741111169E-202
} 0x97d5a3e1d1b73099
test expr-28.412 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +839507247 E-284 x 129a1effc50859_0111111111111111111111111111111110& E-914
convertToDouble +839507247E-284
} 0x06d29a1effc50859
test expr-28.413 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -951487269 E-264 x -1c92befccb5f59_0111111111111111111111111111111110& E-848
convertToDouble -951487269E-264
} 0x8afc92befccb5f59
test expr-28.414 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9821613080 E121 x -11b6231e18c5ca_100000000000000000000000000000000000000001& E435
convertToDouble -9821613080E121
} 0xdb21b6231e18c5cb
test expr-28.415 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6677856011 E-31 x 193a6d11077292_100000000000000000000000000000000000001& E-71
convertToDouble +6677856011E-31
} 0x3b893a6d11077293
test expr-28.416 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3573796826 E-266 x -112be2041a79fc_100000000000000000000000000000000000001& E-852
convertToDouble -3573796826E-266
} 0x8ab12be2041a79fd
test expr-28.417 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7147593652 E-266 x 112be2041a79fc_100000000000000000000000000000000000001& E-851
convertToDouble +7147593652E-266
} 0x0ac12be2041a79fd
test expr-28.418 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9981396317 E-181 x -1edbd94cb50054_100000000000000000000000000000000000001& E-569
convertToDouble -9981396317E-181
} 0x9c6edbd94cb50055
test expr-28.419 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3268888835 E272 x 120223f2b3a881_0111111111111111111111111111111111111110& E935
convertToDouble +3268888835E272
} 0x7a620223f2b3a881
test expr-28.420 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -2615111068 E273 x -120223f2b3a881_0111111111111111111111111111111111111110& E938
convertToDouble -2615111068E273
} 0xfa920223f2b3a881
test expr-28.421 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +1307555534 E273 x 120223f2b3a881_0111111111111111111111111111111111111110& E937
convertToDouble +1307555534E273
} 0x7a820223f2b3a881
test expr-28.422 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2990671154 E-190 x 13db11ac608107_01111111111111111111111111111111111111110& E-600
convertToDouble +2990671154E-190
} 0x1a73db11ac608107
test expr-28.423 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1495335577 E-190 x -13db11ac608107_01111111111111111111111111111111111111110& E-601
convertToDouble -1495335577E-190
} 0x9a63db11ac608107
test expr-28.424 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +5981342308 E-190 x 13db11ac608107_01111111111111111111111111111111111111110& E-599
convertToDouble +5981342308E-190
} 0x1a83db11ac608107
test expr-28.425 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7476677885 E-191 x -13db11ac608107_01111111111111111111111111111111111111110& E-602
convertToDouble -7476677885E-191
} 0x9a53db11ac608107
test expr-28.426 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +82259684194 E-202 x 12c3e72d179606_1000000000000000000000000000000000000000001& E-635
convertToDouble +82259684194E-202
} 0x1842c3e72d179607
test expr-28.427 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -93227267727 E-49 x -1960fe08d5847e_100000000000000000000000000000000000000001& E-127
convertToDouble -93227267727E-49
} 0xb80960fe08d5847f
test expr-28.428 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +41129842097 E-202 x 12c3e72d179606_1000000000000000000000000000000000000000001& E-636
convertToDouble +41129842097E-202
} 0x1832c3e72d179607
test expr-28.429 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -47584241418 E-314 x -14e25dd3747e96_10000000000000000000000000000000000000001& E-1008
convertToDouble -47584241418E-314
} 0x80f4e25dd3747e97
test expr-28.430 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -79360293406 E92 x -1c58a00bb31863_01111111111111111111111111111111111111110& E341
convertToDouble -79360293406E92
} 0xd54c58a00bb31863
test expr-28.431 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +57332259349 E225 x 120811f528378b_01111111111111111111111111111111111111110& E783
convertToDouble +57332259349E225
} 0x70e20811f528378b
test expr-28.432 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -57202326162 E111 x -1626f1c480545b_01111111111111111111111111111111111111110& E404
convertToDouble -57202326162E111
} 0xd93626f1c480545b
test expr-28.433 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +86860597053 E-206 x 103b77d2b969d9_0111111111111111111111111111111111111111110& E-648
convertToDouble +86860597053E-206
} 0x17703b77d2b969d9
test expr-28.434 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -53827010643 E-200 x -132fa69a69bd6d_0111111111111111111111111111111111111111110& E-629
convertToDouble -53827010643E-200
} 0x98a32fa69a69bd6d
test expr-28.435 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +53587107423 E-61 x 100a19a3ffd981_011111111111111111111111111111111111111111110& E-167
convertToDouble +53587107423E-61
} 0x35800a19a3ffd981
test expr-28.436 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +635007636765 E200 x 1824e73a4f030e_100000000000000000000000000000000000000000001& E703
convertToDouble +635007636765E200
} 0x6be824e73a4f030f
test expr-28.437 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +508006109412 E201 x 1824e73a4f030e_100000000000000000000000000000000000000000001& E706
convertToDouble +508006109412E201
} 0x6c1824e73a4f030f
test expr-28.438 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -254003054706 E201 x -1824e73a4f030e_100000000000000000000000000000000000000000001& E705
convertToDouble -254003054706E201
} 0xec0824e73a4f030f
test expr-28.439 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +561029718715 E-72 x 1cd96a6972a14a_100000000000000000000000000000000000000000001& E-201
convertToDouble +561029718715E-72
} 0x336cd96a6972a14b
test expr-28.440 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -897647549944 E-71 x -1cd96a6972a14a_100000000000000000000000000000000000000000001& E-197
convertToDouble -897647549944E-71
} 0xb3acd96a6972a14b
test expr-28.441 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +112205943743 E-71 x 1cd96a6972a14a_100000000000000000000000000000000000000000001& E-200
convertToDouble +112205943743E-71
} 0x337cd96a6972a14b
test expr-28.442 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -873947086081 E-236 x -19e117541d04e6_1000000000000000000000000000000000000000000001& E-745
convertToDouble -873947086081E-236
} 0x9169e117541d04e7
test expr-28.443 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +809184709177 E116 x 1de27e59fb0679_011111111111111111111111111111111111111111110& E424
convertToDouble +809184709177E116
} 0x5a7de27e59fb0679
test expr-28.444 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -573112917422 E81 x -11958b36c5102b_01111111111111111111111111111111111111111111110& E308
convertToDouble -573112917422E81
} 0xd331958b36c5102b
test expr-28.445 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +286556458711 E81 x 11958b36c5102b_01111111111111111111111111111111111111111111110& E307
convertToDouble +286556458711E81
} 0x5321958b36c5102b
test expr-28.446 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +952805821491 E-259 x 1551767ef8a9a3_011111111111111111111111111111111111111111110& E-821
convertToDouble +952805821491E-259
} 0x0ca551767ef8a9a3
test expr-28.447 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -132189992873 E-44 x -1b746cf242410b_011111111111111111111111111111111111111111110& E-110
convertToDouble -132189992873E-44
} 0xb91b746cf242410b
test expr-28.448 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -173696038493 E-144 x -1f8fefbb3249d3_011111111111111111111111111111111111111111110& E-442
convertToDouble -173696038493E-144
} 0xa45f8fefbb3249d3
test expr-28.449 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +1831132757599 E-107 x 138e6edd48f2a2_1000000000000000000000000000000000000000000000001& E-315
convertToDouble +1831132757599E-107
} 0x2c438e6edd48f2a3
test expr-28.450 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9155663787995 E-108 x -138e6edd48f2a2_1000000000000000000000000000000000000000000000001& E-316
convertToDouble -9155663787995E-108
} 0xac338e6edd48f2a3
test expr-28.451 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7324531030396 E-107 x 138e6edd48f2a2_1000000000000000000000000000000000000000000000001& E-313
convertToDouble +7324531030396E-107
} 0x2c638e6edd48f2a3
test expr-28.452 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9277338894969 E-200 x -19d5a44fd99a6a_1000000000000000000000000000000000000000000000001& E-622
convertToDouble -9277338894969E-200
} 0x9919d5a44fd99a6b
test expr-28.453 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8188292423973 E287 x 1390273bf8f983_0111111111111111111111111111111111111111111111110& E996
convertToDouble +8188292423973E287
} 0x7e3390273bf8f983
test expr-28.454 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5672557437938 E59 x -148c2bd60a1523_011111111111111111111111111111111111111111111110& E238
convertToDouble -5672557437938E59
} 0xced48c2bd60a1523
test expr-28.455 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2836278718969 E59 x 148c2bd60a1523_011111111111111111111111111111111111111111111110& E237
convertToDouble +2836278718969E59
} 0x4ec48c2bd60a1523
test expr-28.456 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -9995153153494 E54 x -17ba37c4fbe993_01111111111111111111111111111111111111111111110& E222
convertToDouble -9995153153494E54
} 0xcdd7ba37c4fbe993
test expr-28.457 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9224786422069 E-291 x 14ee5d56b32957_011111111111111111111111111111111111111111111111110& E-924
convertToDouble +9224786422069E-291
} 0x0634ee5d56b32957
test expr-28.458 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3142213164987 E-294 x -1d3409dfbca26f_011111111111111111111111111111111111111111111111110& E-936
convertToDouble -3142213164987E-294
} 0x857d3409dfbca26f
test expr-28.459 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +6284426329974 E-294 x 1d3409dfbca26f_011111111111111111111111111111111111111111111111110& E-935
convertToDouble +6284426329974E-294
} 0x058d3409dfbca26f
test expr-28.460 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8340483752889 E-301 x -10419183e44b91_01111111111111111111111111111111111111111111111110& E-957
convertToDouble -8340483752889E-301
} 0x8420419183e44b91
test expr-28.461 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +67039371486466 E89 x 17f203339c9628_10000000000000000000000000000000000000000000000000001& E341
convertToDouble +67039371486466E89
} 0x5547f203339c9629
test expr-28.462 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -62150786615239 E197 x -12e79a035b9714_1000000000000000000000000000000000000000000000000001& E700
convertToDouble -62150786615239E197
} 0xebb2e79a035b9715
test expr-28.463 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +33519685743233 E89 x 17f203339c9628_10000000000000000000000000000000000000000000000000001& E340
convertToDouble +33519685743233E89
} 0x5537f203339c9629
test expr-28.464 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -52563419496999 E156 x -1bdb17625bf6e6_1000000000000000000000000000000000000000000000000001& E563
convertToDouble -52563419496999E156
} 0xe32bdb17625bf6e7
test expr-28.465 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +32599460466991 E-65 x 1f395d4c779d8e_1000000000000000000000000000000000000000000000000001& E-172
convertToDouble +32599460466991E-65
} 0x353f395d4c779d8f
test expr-28.466 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -41010988798007 E-133 x -152e1c9e04ee06_100000000000000000000000000000000000000000000000001& E-397
convertToDouble -41010988798007E-133
} 0xa7252e1c9e04ee07
test expr-28.467 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +65198920933982 E-65 x 1f395d4c779d8e_1000000000000000000000000000000000000000000000000001& E-171
convertToDouble +65198920933982E-65
} 0x354f395d4c779d8f
test expr-28.468 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -82021977596014 E-133 x -152e1c9e04ee06_100000000000000000000000000000000000000000000000001& E-396
convertToDouble -82021977596014E-133
} 0xa7352e1c9e04ee07
test expr-28.469 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +80527976643809 E61 x 1c7c5aea080a49_0111111111111111111111111111111111111111111111111110& E248
convertToDouble +80527976643809E61
} 0x4f7c7c5aea080a49
test expr-28.470 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -74712611505209 E158 x -1eeebe9ea010f3_011111111111111111111111111111111111111111111111110& E570
convertToDouble -74712611505209E158
} 0xe39eeebe9ea010f3
test expr-28.471 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +53390939710959 E261 x 18ac6d426a1cb1_0111111111111111111111111111111111111111111111111110& E912
convertToDouble +53390939710959E261
} 0x78f8ac6d426a1cb1
test expr-28.472 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -69277302659155 E225 x -1547166a3a2b0f_011111111111111111111111111111111111111111111111110& E793
convertToDouble -69277302659155E225
} 0xf18547166a3a2b0f
test expr-28.473 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +46202199371337 E-72 x 128f9edfbd341f_0111111111111111111111111111111111111111111111111111111110& E-194
convertToDouble +46202199371337E-72
} 0x33d28f9edfbd341f
test expr-28.474 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -23438635467783 E-179 x -1ba485b99e47af_0111111111111111111111111111111111111111111111111110& E-551
convertToDouble -23438635467783E-179
} 0x9d8ba485b99e47af
test expr-28.475 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +41921560615349 E-67 x 19b2a5c4041e4b_0111111111111111111111111111111111111111111111111110& E-178
convertToDouble +41921560615349E-67
} 0x34d9b2a5c4041e4b
test expr-28.476 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -92404398742674 E-72 x -128f9edfbd341f_0111111111111111111111111111111111111111111111111111111110& E-193
convertToDouble -92404398742674E-72
} 0xb3e28f9edfbd341f
test expr-28.477 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +738545606647197 E124 x 13d8886a766a20_100000000000000000000000000000000000000000000000000001& E461
convertToDouble +738545606647197E124
} 0x5cc3d8886a766a21
test expr-28.478 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -972708181182949 E117 x -15ed1f039cebfe_1000000000000000000000000000000000000000000000000000001& E438
convertToDouble -972708181182949E117
} 0xdb55ed1f039cebff
test expr-28.479 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -837992143580825 E87 x -17f203339c9628_10000000000000000000000000000000000000000000000000001& E338
convertToDouble -837992143580825E87
} 0xd517f203339c9629
test expr-28.480 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +609610927149051 E-255 x 104273b18918b0_100000000000000000000000000000000000000000000000000000001& E-798
convertToDouble +609610927149051E-255
} 0x0e104273b18918b1
test expr-28.481 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -475603213226859 E-41 x -178cfcab31064c_10000000000000000000000000000000000000000000000000000001& E-88
convertToDouble -475603213226859E-41
} 0xba778cfcab31064d
test expr-28.482 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +563002800671023 E-177 x 1035e7b5183922_10000000000000000000000000000000000000000000000000000001& E-539
convertToDouble +563002800671023E-177
} 0x1e4035e7b5183923
test expr-28.483 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -951206426453718 E-41 x -178cfcab31064c_10000000000000000000000000000000000000000000000000000001& E-87
convertToDouble -951206426453718E-41
} 0xba878cfcab31064d
test expr-28.484 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +805416432656519 E202 x 175d226331d039_01111111111111111111111111111111111111111111111111111110& E720
convertToDouble +805416432656519E202
} 0x6cf75d226331d039
test expr-28.485 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -530658674694337 E159 x -112a13daa46fe3_0111111111111111111111111111111111111111111111111111110& E577
convertToDouble -530658674694337E159
} 0xe4012a13daa46fe3
test expr-28.486 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +946574173863918 E208 x 1a2fbffdb7580b_011111111111111111111111111111111111111111111111111110& E740
convertToDouble +946574173863918E208
} 0x6e3a2fbffdb7580b
test expr-28.487 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -318329953318553 E113 x -178358811cbc95_011111111111111111111111111111111111111111111111111110& E423
convertToDouble -318329953318553E113
} 0xda678358811cbc95
test expr-28.488 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -462021993713370 E-73 x -128f9edfbd341f_0111111111111111111111111111111111111111111111111111111110& E-194
convertToDouble -462021993713370E-73
} 0xb3d28f9edfbd341f
test expr-28.489 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +369617594970696 E-72 x 128f9edfbd341f_0111111111111111111111111111111111111111111111111111111110& E-191
convertToDouble +369617594970696E-72
} 0x34028f9edfbd341f
test expr-28.490 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3666156212014994 E233 x 1a37935f3b71c8_100000000000000000000000000000000000000000000000000000001& E825
convertToDouble +3666156212014994E233
} 0x738a37935f3b71c9
test expr-28.491 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1833078106007497 E233 x -1a37935f3b71c8_100000000000000000000000000000000000000000000000000000001& E824
convertToDouble -1833078106007497E233
} 0xf37a37935f3b71c9
test expr-28.492 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +8301790508624232 E174 x 1dcfee6690ffc6_100000000000000000000000000000000000000000000000000000001& E630
convertToDouble +8301790508624232E174
} 0x675dcfee6690ffc7
test expr-28.493 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1037723813578029 E174 x -1dcfee6690ffc6_100000000000000000000000000000000000000000000000000000001& E627
convertToDouble -1037723813578029E174
} 0xe72dcfee6690ffc7
test expr-28.494 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7297662880581139 E-286 x 18ac8c79e1ff18_1000000000000000000000000000000000000000000000000000000000001& E-898
convertToDouble +7297662880581139E-286
} 0x07d8ac8c79e1ff19
test expr-28.495 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -5106185698912191 E-276 x -141934d77659be_1000000000000000000000000000000000000000000000000000000000001& E-865
convertToDouble -5106185698912191E-276
} 0x89e41934d77659bf
test expr-28.496 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7487252720986826 E-165 x 18823a57adbef8_100000000000000000000000000000000000000000000000000000000000001& E-496
convertToDouble +7487252720986826E-165
} 0x20f8823a57adbef9
test expr-28.497 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3743626360493413 E-165 x -18823a57adbef8_100000000000000000000000000000000000000000000000000000000000001& E-497
convertToDouble -3743626360493413E-165
} 0xa0e8823a57adbef9
test expr-28.498 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3773057430100257 E230 x 1ba10d818fdafd_0111111111111111111111111111111111111111111111111111111110& E815
convertToDouble +3773057430100257E230
} 0x72eba10d818fdafd
test expr-28.499 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7546114860200514 E230 x -1ba10d818fdafd_0111111111111111111111111111111111111111111111111111111110& E816
convertToDouble -7546114860200514E230
} 0xf2fba10d818fdafd
test expr-28.500 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +4321222892463822 E58 x 18750ea732fdad_011111111111111111111111111111111111111111111111111111110& E244
convertToDouble +4321222892463822E58
} 0x4f38750ea732fdad
test expr-28.501 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7793560217139653 E51 x -1280461b856ec5_0111111111111111111111111111111111111111111111111111111110& E222
convertToDouble -7793560217139653E51
} 0xcdd280461b856ec5
test expr-28.502 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +26525993941010681 E112 x 187dcbf6ad5cf8_10000000000000000000000000000000000000000000000000000000000001& E426
convertToDouble +26525993941010681E112
} 0x5a987dcbf6ad5cf9
test expr-28.503 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -53051987882021362 E112 x -187dcbf6ad5cf8_10000000000000000000000000000000000000000000000000000000000001& E427
convertToDouble -53051987882021362E112
} 0xdaa87dcbf6ad5cf9
test expr-28.504 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +72844871414247907 E77 x 1bf00baf60b70c_100000000000000000000000000000000000000000000000000000000001& E311
convertToDouble +72844871414247907E77
} 0x536bf00baf60b70d
test expr-28.505 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -88839359596763261 E105 x -1133b1a33a1108_100000000000000000000000000000000000000000000000000000000001& E405
convertToDouble -88839359596763261E105
} 0xd94133b1a33a1109
test expr-28.506 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +18718131802467065 E-166 x 18823a57adbef8_100000000000000000000000000000000000000000000000000000000000001& E-498
convertToDouble +18718131802467065E-166
} 0x20d8823a57adbef9
test expr-28.507 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -14974505441973652 E-165 x -18823a57adbef8_100000000000000000000000000000000000000000000000000000000000001& E-495
convertToDouble -14974505441973652E-165
} 0xa108823a57adbef9
test expr-28.508 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +73429396004640239 E106 x 11c5cb19ef3451_01111111111111111111111111111111111111111111111111111111111110& E408
convertToDouble +73429396004640239E106
} 0x5971c5cb19ef3451
test expr-28.509 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -58483921078398283 E57 x -108ce499519ce3_0111111111111111111111111111111111111111111111111111111111111110& E245
convertToDouble -58483921078398283E57
} 0xcf408ce499519ce3
test expr-28.510 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +41391519190645203 E165 x 13f33667156017_011111111111111111111111111111111111111111111111111111111111110& E603
convertToDouble +41391519190645203E165
} 0x65a3f33667156017
test expr-28.511 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -82783038381290406 E165 x -13f33667156017_011111111111111111111111111111111111111111111111111111111111110& E604
convertToDouble -82783038381290406E165
} 0xe5b3f33667156017
test expr-28.512 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +58767043776702677 E-163 x 12c92fee3a3867_0111111111111111111111111111111111111111111111111111111111110& E-486
convertToDouble +58767043776702677E-163
} 0x2192c92fee3a3867
test expr-28.513 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -90506231831231999 E-129 x -1bdc4114397ff3_01111111111111111111111111111111111111111111111111111111111110& E-373
convertToDouble -90506231831231999E-129
} 0xa8abdc4114397ff3
test expr-28.514 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +64409240769861689 E-159 x 192238f7987779_011111111111111111111111111111111111111111111111111111111111110& E-473
convertToDouble +64409240769861689E-159
} 0x22692238f7987779
test expr-28.515 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -77305427432277771 E-190 x -1e978b7780b613_0111111111111111111111111111111111111111111111111111111111110& E-576
convertToDouble -77305427432277771E-190
} 0x9bfe978b7780b613
test expr-28.516 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +476592356619258326 E273 x 1873cf8ee72812_10000000000000000000000000000000000000000000000000000000000000001& E965
convertToDouble +476592356619258326E273
} 0x7c4873cf8ee72813
test expr-28.517 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -953184713238516652 E273 x -1873cf8ee72812_10000000000000000000000000000000000000000000000000000000000000001& E966
convertToDouble -953184713238516652E273
} 0xfc5873cf8ee72813
test expr-28.518 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +899810892172646163 E283 x 1adf51fa055e02_100000000000000000000000000000000000000000000000000000000000000000001& E999
convertToDouble +899810892172646163E283
} 0x7e6adf51fa055e03
test expr-28.519 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -929167076892018333 E187 x -1da2c42fce2bc4_10000000000000000000000000000000000000000000000000000000000000000001& E680
convertToDouble -929167076892018333E187
} 0xea7da2c42fce2bc5
test expr-28.520 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +647761278967534239 E-312 x 1a7a2476ec0b3e_10000000000000000000000000000000000000000000000000000000000000001& E-978
convertToDouble +647761278967534239E-312
} 0x02da7a2476ec0b3f
test expr-28.521 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -644290479820542942 E-180 x -128d1407dfa832_10000000000000000000000000000000000000000000000000000000000000001& E-539
convertToDouble -644290479820542942E-180
} 0x9e428d1407dfa833
test expr-28.522 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +926145344610700019 E-225 x 1307a67f1f69fe_10000000000000000000000000000000000000000000000000000000000000000001& E-688
convertToDouble +926145344610700019E-225
} 0x14f307a67f1f69ff
test expr-28.523 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -958507931896511964 E-246 x -17406753df2f0c_10000000000000000000000000000000000000000000000000000000000000001& E-758
convertToDouble -958507931896511964E-246
} 0x9097406753df2f0d
test expr-28.524 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +272104041512242479 E200 x 13bbb4bf05f087_011111111111111111111111111111111111111111111111111111111111111111111110& E722
convertToDouble +272104041512242479E200
} 0x6d13bbb4bf05f087
test expr-28.525 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -792644927852378159 E79 x -1daff0048f3ec7_011111111111111111111111111111111111111111111111111111111111111111110& E321
convertToDouble -792644927852378159E79
} 0xd40daff0048f3ec7
test expr-28.526 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +544208083024484958 E200 x 13bbb4bf05f087_011111111111111111111111111111111111111111111111111111111111111111111110& E723
convertToDouble +544208083024484958E200
} 0x6d23bbb4bf05f087
test expr-28.527 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -929963218616126365 E290 x -108dcc0c505461_01111111111111111111111111111111111111111111111111111111111111110& E1023
convertToDouble -929963218616126365E290
} 0xffe08dcc0c505461
test expr-28.528 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +305574339166810102 E-219 x 17f399fe02c4b9_011111111111111111111111111111111111111111111111111111111111111110& E-670
convertToDouble +305574339166810102E-219
} 0x1617f399fe02c4b9
test expr-28.529 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -152787169583405051 E-219 x -17f399fe02c4b9_011111111111111111111111111111111111111111111111111111111111111110& E-671
convertToDouble -152787169583405051E-219
} 0x9607f399fe02c4b9
test expr-28.530 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +611148678333620204 E-219 x 17f399fe02c4b9_011111111111111111111111111111111111111111111111111111111111111110& E-669
convertToDouble +611148678333620204E-219
} 0x1627f399fe02c4b9
test expr-28.531 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -763935847917025255 E-220 x -17f399fe02c4b9_011111111111111111111111111111111111111111111111111111111111111110& E-672
convertToDouble -763935847917025255E-220
} 0x95f7f399fe02c4b9
test expr-28.532 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +7439550220920798612 E158 x 177fe14f40159a_10000000000000000000000000000000000000000000000000000000000000000000001& E587
convertToDouble +7439550220920798612E158
} 0x64a77fe14f40159b
test expr-28.533 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -3719775110460399306 E158 x -177fe14f40159a_10000000000000000000000000000000000000000000000000000000000000000000001& E586
convertToDouble -3719775110460399306E158
} 0xe4977fe14f40159b
test expr-28.534 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +9299437776150998265 E157 x 177fe14f40159a_10000000000000000000000000000000000000000000000000000000000000000000001& E584
convertToDouble +9299437776150998265E157
} 0x64777fe14f40159b
test expr-28.535 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7120190517612959703 E120 x -13220dcd5899fc_1000000000000000000000000000000000000000000000000000000000000000000000001& E461
convertToDouble -7120190517612959703E120
} 0xdcc3220dcd5899fd
test expr-28.536 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +3507665085003296281 E-73 x 11339818257f0e_100000000000000000000000000000000000000000000000000000000000000000000001& E-181
convertToDouble +3507665085003296281E-73
} 0x34a1339818257f0f
test expr-28.537 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -7015330170006592562 E-73 x -11339818257f0e_100000000000000000000000000000000000000000000000000000000000000000000001& E-180
convertToDouble -7015330170006592562E-73
} 0xb4b1339818257f0f
test expr-28.538 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -6684428762278255956 E-294 x -1d9f82a1a6b1b8_10000000000000000000000000000000000000000000000000000000000000000001& E-915
convertToDouble -6684428762278255956E-294
} 0x86cd9f82a1a6b1b9
test expr-28.539 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -1088416166048969916 E200 x -13bbb4bf05f087_011111111111111111111111111111111111111111111111111111111111111111111110& E724
convertToDouble -1088416166048969916E200
} 0xed33bbb4bf05f087
test expr-28.540 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8707329328391759328 E200 x -13bbb4bf05f087_011111111111111111111111111111111111111111111111111111111111111111111110& E727
convertToDouble -8707329328391759328E200
} 0xed63bbb4bf05f087
test expr-28.541 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +4439021781608558002 E-65 x 1038168b71e2c9_01111111111111111111111111111111111111111111111111111111111111111110& E-154
convertToDouble +4439021781608558002E-65
} 0x365038168b71e2c9
test expr-28.542 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -8878043563217116004 E-65 x -1038168b71e2c9_01111111111111111111111111111111111111111111111111111111111111111110& E-153
convertToDouble -8878043563217116004E-65
} 0xb66038168b71e2c9
test expr-28.543 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +2219510890804279001 E-65 x 1038168b71e2c9_01111111111111111111111111111111111111111111111111111111111111111110& E-155
convertToDouble +2219510890804279001E-65
} 0x364038168b71e2c9
test expr-28.544 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +33051223951904955802 E55 x 1762068a24fd54_1000000000000000000000000000000000000000000000000000000000000000000000001& E247
convertToDouble +33051223951904955802E55
} 0x4f6762068a24fd55
test expr-28.545 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -56961524140903677624 E120 x -13220dcd5899fc_1000000000000000000000000000000000000000000000000000000000000000000000001& E464
convertToDouble -56961524140903677624E120
} 0xdcf3220dcd5899fd
test expr-28.546 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +71201905176129597030 E119 x 13220dcd5899fc_1000000000000000000000000000000000000000000000000000000000000000000000001& E461
convertToDouble +71201905176129597030E119
} 0x5cc3220dcd5899fd
test expr-28.547 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +14030660340013185124 E-73 x 11339818257f0e_100000000000000000000000000000000000000000000000000000000000000000000001& E-179
convertToDouble +14030660340013185124E-73
} 0x34c1339818257f0f
test expr-28.548 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -17538325425016481405 E-74 x -11339818257f0e_100000000000000000000000000000000000000000000000000000000000000000000001& E-182
convertToDouble -17538325425016481405E-74
} 0xb491339818257f0f
test expr-28.549 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +67536228609141569109 E-133 x 10a1b35cf2a635_01111111111111111111111111111111111111111111111111111111111111111111110& E-376
convertToDouble +67536228609141569109E-133
} 0x2870a1b35cf2a635
test expr-28.550 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -35620497849450218807 E-306 x -15b22082529425_0111111111111111111111111111111111111111111111111111111111111111111111110& E-952
convertToDouble -35620497849450218807E-306
} 0x8475b22082529425
test expr-28.551 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN +66550376797582521751 E-126 x 13897c0ede6c69_01111111111111111111111111111111111111111111111111111111111111111111110& E-353
convertToDouble +66550376797582521751E-126
} 0x29e3897c0ede6c69
test expr-28.552 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b d UN -71240995698900437614 E-306 x -15b22082529425_0111111111111111111111111111111111111111111111111111111111111111111111110& E-951
convertToDouble -71240995698900437614E-306
} 0x8485b22082529425
test expr-28.553 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +3 E24 x 13da329b633647_0001& E81
convertToDouble +3E24
} 0x4503da329b633647
test expr-28.554 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -6 E24 x -13da329b633647_0001& E82
convertToDouble -6E24
} 0xc513da329b633647
test expr-28.555 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6 E26 x 1f04ef12cb04cf_0001& E88
convertToDouble +6E26
} 0x457f04ef12cb04cf
test expr-28.556 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -7 E25 x -1cf389cd46047d_0000001& E85
convertToDouble -7E25
} 0xc54cf389cd46047d
test expr-28.557 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +1 E-14 x 16849b86a12b9b_00000001& E-47
convertToDouble +1E-14
} 0x3d06849b86a12b9b
test expr-28.558 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2 E-14 x -16849b86a12b9b_00000001& E-46
convertToDouble -2E-14
} 0xbd16849b86a12b9b
test expr-28.559 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4 E-14 x 16849b86a12b9b_00000001& E-45
convertToDouble +4E-14
} 0x3d26849b86a12b9b
test expr-28.560 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8 E-14 x -16849b86a12b9b_00000001& E-44
convertToDouble -8E-14
} 0xbd36849b86a12b9b
test expr-28.561 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +5 E26 x 19d971e4fe8401_1110& E88
convertToDouble +5E26
} 0x4579d971e4fe8402
test expr-28.562 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8 E27 x -19d971e4fe8401_1110& E92
convertToDouble -8E27
} 0xc5b9d971e4fe8402
test expr-28.563 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +1 E27 x 19d971e4fe8401_1110& E89
convertToDouble +1E27
} 0x4589d971e4fe8402
test expr-28.564 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4 E27 x -19d971e4fe8401_1110& E91
convertToDouble -4E27
} 0xc5a9d971e4fe8402
test expr-28.565 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9 E-13 x 1faa7ab552a551_111110& E-41
convertToDouble +9E-13
} 0x3d6faa7ab552a552
test expr-28.566 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -7 E-20 x -14a90ceafff9de_11110& E-64
convertToDouble -7E-20
} 0xbbf4a90ceafff9df
test expr-28.567 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +56 E25 x 1cf389cd46047d_0000001& E88
convertToDouble +56E25
} 0x457cf389cd46047d
test expr-28.568 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -70 E24 x -1cf389cd46047d_0000001& E85
convertToDouble -70E24
} 0xc54cf389cd46047d
test expr-28.569 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +51 E26 x 107a9f01fbda8e_0000001& E92
convertToDouble +51E26
} 0x45b07a9f01fbda8e
test expr-28.570 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +71 E-17 x 19949819f693d7_00000000001& E-51
convertToDouble +71E-17
} 0x3cc9949819f693d7
test expr-28.571 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -31 E-5 x -1450efdc9c4da9_00000000001& E-12
convertToDouble -31E-5
} 0xbf3450efdc9c4da9
test expr-28.572 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +62 E-5 x 1450efdc9c4da9_00000000001& E-11
convertToDouble +62E-5
} 0x3f4450efdc9c4da9
test expr-28.573 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -94 E-8 x -1f8a89dc374df5_0000000001& E-21
convertToDouble -94E-8
} 0xbeaf8a89dc374df5
test expr-28.574 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +67 E27 x 1b0fa33bba7231_11111110& E95
convertToDouble +67E27
} 0x45eb0fa33bba7232
test expr-28.575 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -81 E24 x -10c01ab31bb5cb_1111110& E86
convertToDouble -81E24
} 0xc550c01ab31bb5cc
test expr-28.576 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +54 E23 x 11ddfa58a6173f_111110& E82
convertToDouble +54E23
} 0x4511ddfa58a61740
test expr-28.577 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -54 E25 x -1bead72a838453_111110& E88
convertToDouble -54E25
} 0xc57bead72a838454
test expr-28.578 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +63 E-22 x 1dc03b8fd70169_11111111110& E-68
convertToDouble +63E-22
} 0x3bbdc03b8fd7016a
test expr-28.579 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -63 E-23 x -17ccfc73126787_11111111110& E-71
convertToDouble -63E-23
} 0xbb87ccfc73126788
test expr-28.580 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +43 E-4 x 119ce075f6fd21_111111110& E-8
convertToDouble +43E-4
} 0x3f719ce075f6fd22
test expr-28.581 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -86 E-4 x -119ce075f6fd21_111111110& E-7
convertToDouble -86E-4
} 0xbf819ce075f6fd22
test expr-28.582 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +942 E26 x 1306069e8681f3_00000000001& E96
convertToDouble +942E26
} 0x45f306069e8681f3
test expr-28.583 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -471 E25 x -1e700a973d9cb8_0000000001& E91
convertToDouble -471E25
} 0xc5ae700a973d9cb8
test expr-28.584 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +803 E24 x 14c1cee9cd666b_000000000001& E89
convertToDouble +803E24
} 0x4584c1cee9cd666b
test expr-28.585 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -471 E26 x -1306069e8681f3_00000000001& E95
convertToDouble -471E26
} 0xc5e306069e8681f3
test expr-28.586 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -409 E-21 x -1e2dcaa4115622_000000000001& E-62
convertToDouble -409E-21
} 0xbc1e2dcaa4115622
test expr-28.587 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +818 E-21 x 1e2dcaa4115622_000000000001& E-61
convertToDouble +818E-21
} 0x3c2e2dcaa4115622
test expr-28.588 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -867 E-8 x -122eabba029aba_000000000001& E-17
convertToDouble -867E-8
} 0xbee22eabba029aba
test expr-28.589 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +538 E27 x 1b297cad9f70b5_1111111111111110& E98
convertToDouble +538E27
} 0x461b297cad9f70b6
test expr-28.590 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -857 E24 x -16272678ba603b_11111111110& E89
convertToDouble -857E24
} 0xc586272678ba603c
test expr-28.591 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +269 E27 x 1b297cad9f70b5_1111111111111110& E97
convertToDouble +269E27
} 0x460b297cad9f70b6
test expr-28.592 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -403 E26 x -1046ec1e31dd85_1111111110& E95
convertToDouble -403E26
} 0xc5e046ec1e31dd86
test expr-28.593 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +959 E-7 x 1923bd746a3527_11111111111110& E-14
convertToDouble +959E-7
} 0x3f1923bd746a3528
test expr-28.594 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -959 E-6 x -1f6cacd184c271_1111111111110& E-11
convertToDouble -959E-6
} 0xbf4f6cacd184c272
test expr-28.595 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +373 E-27 x 1cdc06b20ef182_1111111111110& E-82
convertToDouble +373E-27
} 0x3adcdc06b20ef183
test expr-28.596 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -746 E-27 x -1cdc06b20ef182_1111111111110& E-81
convertToDouble -746E-27
} 0xbaecdc06b20ef183
test expr-28.597 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4069 E24 x 1a4b9887fbfe7a_0000000000001& E91
convertToDouble +4069E24
} 0x45aa4b9887fbfe7a
test expr-28.598 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4069 E23 x -150946d32ffec8_0000000000001& E88
convertToDouble -4069E23
} 0xc5750946d32ffec8
test expr-28.599 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8138 E24 x -1a4b9887fbfe7a_0000000000001& E92
convertToDouble -8138E24
} 0xc5ba4b9887fbfe7a
test expr-28.600 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8294 E-15 x 123d1b5eb1d778_000000000000000001& E-37
convertToDouble +8294E-15
} 0x3da23d1b5eb1d778
test expr-28.601 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4147 E-14 x -16cc62365e4d56_00000000000000001& E-35
convertToDouble -4147E-14
} 0xbdc6cc62365e4d56
test expr-28.602 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4147 E-15 x 123d1b5eb1d778_000000000000000001& E-38
convertToDouble +4147E-15
} 0x3d923d1b5eb1d778
test expr-28.603 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8294 E-14 x -16cc62365e4d56_00000000000000001& E-34
convertToDouble -8294E-14
} 0xbdd6cc62365e4d56
test expr-28.604 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +538 E27 x 1b297cad9f70b5_1111111111111110& E98
convertToDouble +538E27
} 0x461b297cad9f70b6
test expr-28.605 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2690 E26 x -1b297cad9f70b5_1111111111111110& E97
convertToDouble -2690E26
} 0xc60b297cad9f70b6
test expr-28.606 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +269 E27 x 1b297cad9f70b5_1111111111111110& E97
convertToDouble +269E27
} 0x460b297cad9f70b6
test expr-28.607 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2152 E27 x -1b297cad9f70b5_1111111111111110& E100
convertToDouble -2152E27
} 0xc63b297cad9f70b6
test expr-28.608 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +1721 E-17 x 136071dcae4564_111111111111110& E-46
convertToDouble +1721E-17
} 0x3d136071dcae4565
test expr-28.609 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -7979 E-27 x -134ac304747faf_111111111111110& E-77
convertToDouble -7979E-27
} 0xbb234ac304747fb0
test expr-28.610 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6884 E-17 x 136071dcae4564_111111111111110& E-44
convertToDouble +6884E-17
} 0x3d336071dcae4565
test expr-28.611 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8605 E-18 x -136071dcae4564_111111111111110& E-47
convertToDouble -8605E-18
} 0xbd036071dcae4565
test expr-28.612 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +82854 E27 x 10570ed9e3cecc_00000000000000001& E106
convertToDouble +82854E27
} 0x4690570ed9e3cecc
test expr-28.613 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -55684 E24 x -167d9735144ae3_00000000000000001& E95
convertToDouble -55684E24
} 0xc5e67d9735144ae3
test expr-28.614 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +27842 E24 x 167d9735144ae3_00000000000000001& E94
convertToDouble +27842E24
} 0x45d67d9735144ae3
test expr-28.615 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -48959 E25 x -18b7cd6ca56f85_00000000000000001& E98
convertToDouble -48959E25
} 0xc618b7cd6ca56f85
test expr-28.616 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +81921 E-17 x 1cd2c9a6cdd003_000000000000000000001& E-41
convertToDouble +81921E-17
} 0x3d6cd2c9a6cdd003
test expr-28.617 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -76207 E-8 x -18f8b4dd16f1df_0000000000000000001& E-11
convertToDouble -76207E-8
} 0xbf48f8b4dd16f1df
test expr-28.618 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4147 E-15 x 123d1b5eb1d778_000000000000000001& E-38
convertToDouble +4147E-15
} 0x3d923d1b5eb1d778
test expr-28.619 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -41470 E-16 x -123d1b5eb1d778_000000000000000001& E-38
convertToDouble -41470E-16
} 0xbd923d1b5eb1d778
test expr-28.620 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +89309 E24 x 12092ac5f2019e_1111111111111111110& E96
convertToDouble +89309E24
} 0x45f2092ac5f2019f
test expr-28.621 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +75859 E26 x 17efd75a2938eb_1111111111111111111110& E102
convertToDouble +75859E26
} 0x4657efd75a2938ec
test expr-28.622 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -75859 E25 x -132645e1ba93ef_1111111111111111111110& E99
convertToDouble -75859E25
} 0xc6232645e1ba93f0
test expr-28.623 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +14257 E-23 x 150a246ecd44f2_1111111111111111110& E-63
convertToDouble +14257E-23
} 0x3c050a246ecd44f3
test expr-28.624 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -28514 E-23 x -150a246ecd44f2_1111111111111111110& E-62
convertToDouble -28514E-23
} 0xbc150a246ecd44f3
test expr-28.625 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +57028 E-23 x 150a246ecd44f2_1111111111111111110& E-61
convertToDouble +57028E-23
} 0x3c250a246ecd44f3
test expr-28.626 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -71285 E-24 x -150a246ecd44f2_1111111111111111110& E-64
convertToDouble -71285E-24
} 0xbbf50a246ecd44f3
test expr-28.627 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +344863 E27 x 1100c873963d6d_00000000000000000001& E108
convertToDouble +344863E27
} 0x46b100c873963d6d
test expr-28.628 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -951735 E27 x -17764ad224e24a_000000000000000000001& E109
convertToDouble -951735E27
} 0xc6c7764ad224e24a
test expr-28.629 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +200677 E23 x 1035e73135b834_0000000000000000001& E94
convertToDouble +200677E23
} 0x45d035e73135b834
test expr-28.630 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -401354 E24 x -144360fd832641_0000000000000000001& E98
convertToDouble -401354E24
} 0xc6144360fd832641
test expr-28.631 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +839604 E-11 x 119b96f36ec68b_00000000000000000000000001& E-17
convertToDouble +839604E-11
} 0x3ee19b96f36ec68b
test expr-28.632 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -209901 E-11 x -119b96f36ec68b_00000000000000000000000001& E-19
convertToDouble -209901E-11
} 0xbec19b96f36ec68b
test expr-28.633 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +419802 E-11 x 119b96f36ec68b_00000000000000000000000001& E-18
convertToDouble +419802E-11
} 0x3ed19b96f36ec68b
test expr-28.634 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -537734 E-24 x -13d6c1088ae40e_0000000000000000000001& E-61
convertToDouble -537734E-24
} 0xbc23d6c1088ae40e
test expr-28.635 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +910308 E26 x 11f3e1839eeab0_11111111111111111111110& E106
convertToDouble +910308E26
} 0x4691f3e1839eeab1
test expr-28.636 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -227577 E26 x -11f3e1839eeab0_11111111111111111111110& E104
convertToDouble -227577E26
} 0xc671f3e1839eeab1
test expr-28.637 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +455154 E26 x 11f3e1839eeab0_11111111111111111111110& E105
convertToDouble +455154E26
} 0x4681f3e1839eeab1
test expr-28.638 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -531013 E25 x -10c17d25834171_11111111111111111111110& E102
convertToDouble -531013E25
} 0xc650c17d25834172
test expr-28.639 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +963019 E-21 x 11592429784914_11111111111111111111110& E-50
convertToDouble +963019E-21
} 0x3cd1592429784915
test expr-28.640 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -519827 E-13 x -1be872a8b30d7c_11111111111111111111110& E-25
convertToDouble -519827E-13
} 0xbe6be872a8b30d7d
test expr-28.641 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +623402 E-27 x 178d2c97bde2a0_11111111111111111111110& E-71
convertToDouble +623402E-27
} 0x3b878d2c97bde2a1
test expr-28.642 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -311701 E-27 x -178d2c97bde2a0_11111111111111111111110& E-72
convertToDouble -311701E-27
} 0xbb778d2c97bde2a1
test expr-28.643 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9613651 E26 x 17b31116270d9b_000000000000000000000001& E109
convertToDouble +9613651E26
} 0x46c7b31116270d9b
test expr-28.644 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -9191316 E23 x -1733bfae0801fd_0000000000000000000001& E99
convertToDouble -9191316E23
} 0xc62733bfae0801fd
test expr-28.645 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4595658 E23 x 1733bfae0801fd_0000000000000000000001& E98
convertToDouble +4595658E23
} 0x461733bfae0801fd
test expr-28.646 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2297829 E23 x -1733bfae0801fd_0000000000000000000001& E97
convertToDouble -2297829E23
} 0xc60733bfae0801fd
test expr-28.647 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -1679208 E-11 x -119b96f36ec68b_00000000000000000000000001& E-16
convertToDouble -1679208E-11
} 0xbef19b96f36ec68b
test expr-28.648 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +3379223 E27 x 14d3794ce2fc25_1111111111111111111111110& E111
convertToDouble +3379223E27
} 0x46e4d3794ce2fc26
test expr-28.649 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -6758446 E27 x -14d3794ce2fc25_1111111111111111111111110& E112
convertToDouble -6758446E27
} 0xc6f4d3794ce2fc26
test expr-28.650 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +5444097 E-21 x 18849dd33c95ae_11111111111111111111111111110& E-48
convertToDouble +5444097E-21
} 0x3cf8849dd33c95af
test expr-28.651 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8399969 E-27 x -13d5783e85fcf7_1111111111111111111111110& E-67
convertToDouble -8399969E-27
} 0xbbc3d5783e85fcf8
test expr-28.652 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8366487 E-16 x 1cbf3d630403af_1111111111111111111111110& E-31
convertToDouble +8366487E-16
} 0x3e0cbf3d630403b0
test expr-28.653 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8366487 E-15 x -11f7865de2824d_11111111111111111111111110& E-27
convertToDouble -8366487E-15
} 0xbe41f7865de2824e
test expr-28.654 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +65060671 E25 x 1009e7d474572a_0000000000000000000000000001& E109
convertToDouble +65060671E25
} 0x46c009e7d474572a
test expr-28.655 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +65212389 E23 x 1493d098d37657_000000000000000000000000001& E102
convertToDouble +65212389E23
} 0x465493d098d37657
test expr-28.656 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +55544957 E-13 x 174c1826f3010c_00000000000000000000000000001& E-18
convertToDouble +55544957E-13
} 0x3ed74c1826f3010c
test expr-28.657 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -51040905 E-20 x -11f55b23c8bf2d_0000000000000000000000000001& E-41
convertToDouble -51040905E-20
} 0xbd61f55b23c8bf2d
test expr-28.658 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +99585767 E-22 x 166cba8699f0f2_0000000000000000000000000001& E-47
convertToDouble +99585767E-22
} 0x3d066cba8699f0f2
test expr-28.659 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -99585767 E-23 x -11f095387b2728_0000000000000000000000000001& E-50
convertToDouble -99585767E-23
} 0xbcd1f095387b2728
test expr-28.660 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +40978393 E26 x 1941401cca2bfd_1111111111111111111111111110& E111
convertToDouble +40978393E26
} 0x46e941401cca2bfe
test expr-28.661 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -67488159 E24 x -1a9e90059d12db_11111111111111111111111111110& E105
convertToDouble -67488159E24
} 0xc68a9e90059d12dc
test expr-28.662 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +69005339 E23 x 15c634f6ef1f95_111111111111111111111111110& E102
convertToDouble +69005339E23
} 0x4655c634f6ef1f96
test expr-28.663 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -81956786 E26 x -1941401cca2bfd_1111111111111111111111111110& E112
convertToDouble -81956786E26
} 0xc6f941401cca2bfe
test expr-28.664 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -87105552 E-21 x -18849dd33c95ae_11111111111111111111111111110& E-44
convertToDouble -87105552E-21
} 0xbd38849dd33c95af
test expr-28.665 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +10888194 E-21 x 18849dd33c95ae_11111111111111111111111111110& E-47
convertToDouble +10888194E-21
} 0x3d08849dd33c95af
test expr-28.666 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -21776388 E-21 x -18849dd33c95ae_11111111111111111111111111110& E-46
convertToDouble -21776388E-21
} 0xbd18849dd33c95af
test expr-28.667 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +635806667 E27 x 1e9cec176c96f8_000000000000000000000000000000001& E118
convertToDouble +635806667E27
} 0x475e9cec176c96f8
test expr-28.668 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -670026614 E25 x -14a593f89f4194_00000000000000000000000000000001& E112
convertToDouble -670026614E25
} 0xc6f4a593f89f4194
test expr-28.669 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +335013307 E26 x 19cef8f6c711f9_0000000000000000000000000000001& E114
convertToDouble +335013307E26
} 0x4719cef8f6c711f9
test expr-28.670 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -335013307 E25 x -14a593f89f4194_00000000000000000000000000000001& E111
convertToDouble -335013307E25
} 0xc6e4a593f89f4194
test expr-28.671 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +371790617 E-24 x 1aca538c61ba9c_000000000000000000000000000000001& E-52
convertToDouble +371790617E-24
} 0x3cbaca538c61ba9c
test expr-28.672 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -371790617 E-25 x -156ea93d1afbb0_0000000000000000000000000000000001& E-55
convertToDouble -371790617E-25
} 0xbc856ea93d1afbb0
test expr-28.673 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +743581234 E-24 x 1aca538c61ba9c_000000000000000000000000000000001& E-51
convertToDouble +743581234E-24
} 0x3ccaca538c61ba9c
test expr-28.674 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -743581234 E-25 x -156ea93d1afbb0_0000000000000000000000000000000001& E-54
convertToDouble -743581234E-25
} 0xbc956ea93d1afbb0
test expr-28.675 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +202464477 E24 x 13f6ec0435ce24_111111111111111111111111111110& E107
convertToDouble +202464477E24
} 0x46a3f6ec0435ce25
test expr-28.676 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -404928954 E24 x -13f6ec0435ce24_111111111111111111111111111110& E108
convertToDouble -404928954E24
} 0xc6b3f6ec0435ce25
test expr-28.677 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +997853758 E27 x 1805bfa33b98fa_111111111111111111111111111110& E119
convertToDouble +997853758E27
} 0x476805bfa33b98fb
test expr-28.678 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -997853758 E26 x -1337cc829613fb_111111111111111111111111111110& E116
convertToDouble -997853758E26
} 0xc73337cc829613fc
test expr-28.679 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +405498418 E-17 x 116a8093df66a6_111111111111111111111111111111110& E-28
convertToDouble +405498418E-17
} 0x3e316a8093df66a7
test expr-28.680 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -582579084 E-14 x -186f653140a658_111111111111111111111111111111110& E-18
convertToDouble -582579084E-14
} 0xbed86f653140a659
test expr-28.681 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +608247627 E-18 x 14e633e4a5ae61_111111111111111111111111111111110& E-31
convertToDouble +608247627E-18
} 0x3e04e633e4a5ae62
test expr-28.682 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -291289542 E-14 x -186f653140a658_111111111111111111111111111111110& E-19
convertToDouble -291289542E-14
} 0xbec86f653140a659
test expr-28.683 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -9537100005 E26 x -16f5b11191713a_000000000000000000000000000000001& E119
convertToDouble -9537100005E26
} 0xc766f5b11191713a
test expr-28.684 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6358066670 E27 x 1322138ea3de5b_000000000000000000000000000000001& E122
convertToDouble +6358066670E27
} 0x479322138ea3de5b
test expr-28.685 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -1271613334 E27 x -1e9cec176c96f8_000000000000000000000000000000001& E119
convertToDouble -1271613334E27
} 0xc76e9cec176c96f8
test expr-28.686 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +5229646999 E-16 x 118c3b89731f3d_000000000000000000000000000000000001& E-21
convertToDouble +5229646999E-16
} 0x3ea18c3b89731f3d
test expr-28.687 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +5229646999 E-17 x 1c13927584fec8_00000000000000000000000000000000001& E-25
convertToDouble +5229646999E-17
} 0x3e6c13927584fec8
test expr-28.688 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4429943614 E24 x 1b4d37fa06864a_1111111111111111111111111111111110& E111
convertToDouble +4429943614E24
} 0x46eb4d37fa06864b
test expr-28.689 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8859887228 E24 x -1b4d37fa06864a_1111111111111111111111111111111110& E112
convertToDouble -8859887228E24
} 0xc6fb4d37fa06864b
test expr-28.690 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +2214971807 E24 x 1b4d37fa06864a_1111111111111111111111111111111110& E110
convertToDouble +2214971807E24
} 0x46db4d37fa06864b
test expr-28.691 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4176887093 E26 x -141c692c5bd07a_111111111111111111111111111111110& E118
convertToDouble -4176887093E26
} 0xc7541c692c5bd07b
test expr-28.692 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4003495257 E-20 x 16026b2e07ec06_111111111111111111111111111111111110& E-35
convertToDouble +4003495257E-20
} 0x3dc6026b2e07ec07
test expr-28.693 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4361901637 E-23 x -188e29a9d7c5b8_11111111111111111111111111111111110& E-45
convertToDouble -4361901637E-23
} 0xbd288e29a9d7c5b9
test expr-28.694 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8723803274 E-23 x 188e29a9d7c5b8_11111111111111111111111111111111110& E-44
convertToDouble +8723803274E-23
} 0x3d388e29a9d7c5b9
test expr-28.695 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8006990514 E-20 x -16026b2e07ec06_111111111111111111111111111111111110& E-34
convertToDouble -8006990514E-20
} 0xbdd6026b2e07ec07
test expr-28.696 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +72835110098 E27 x 1b65c41711fb6d_0000000000000000000000000000000000001& E125
convertToDouble +72835110098E27
} 0x47cb65c41711fb6d
test expr-28.697 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -36417555049 E27 x -1b65c41711fb6d_0000000000000000000000000000000000001& E124
convertToDouble -36417555049E27
} 0xc7bb65c41711fb6d
test expr-28.698 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +84279630104 E25 x 144a221b1cf62e_000000000000000000000000000000000001& E119
convertToDouble +84279630104E25
} 0x47644a221b1cf62e
test expr-28.699 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -84279630104 E24 x -103b4e7c172b58_000000000000000000000000000000000001& E116
convertToDouble -84279630104E24
} 0xc7303b4e7c172b58
test expr-28.700 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +21206176437 E-27 x 1872f563ae0cc9_0000000000000000000000000000000000001& E-56
convertToDouble +21206176437E-27
} 0x3c7872f563ae0cc9
test expr-28.701 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -66461566917 E-22 x -1d3ae83e4322b3_00000000000000000000000000000000000001& E-38
convertToDouble -66461566917E-22
} 0xbd9d3ae83e4322b3
test expr-28.702 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +64808355539 E-16 x 1b2ebe83265fbf_00000000000000000000000000000000000001& E-18
convertToDouble +64808355539E-16
} 0x3edb2ebe83265fbf
test expr-28.703 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -84932679673 E-19 x -123d39339f1bf6_00000000000000000000000000000000000001& E-27
convertToDouble -84932679673E-19
} 0xbe423d39339f1bf6
test expr-28.704 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +65205430094 E26 x 139f3e5d7fd76a_1111111111111111111111111111111111110& E122
convertToDouble +65205430094E26
} 0x47939f3e5d7fd76b
test expr-28.705 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -68384463429 E25 x -107684982f634e_1111111111111111111111111111111111111110& E119
convertToDouble -68384463429E25
} 0xc7607684982f634f
test expr-28.706 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +32602715047 E26 x 139f3e5d7fd76a_1111111111111111111111111111111111110& E121
convertToDouble +32602715047E26
} 0x47839f3e5d7fd76b
test expr-28.707 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -62662203426 E27 x -1792269424688d_111111111111111111111111111111111110& E125
convertToDouble -62662203426E27
} 0xc7c792269424688e
test expr-28.708 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +58784444678 E-18 x 1f8f45c64b4682_111111111111111111111111111111111111110& E-25
convertToDouble +58784444678E-18
} 0x3e6f8f45c64b4683
test expr-28.709 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -50980203373 E-21 x -1c06d366394440_11111111111111111111111111111111111111111110& E-35
convertToDouble -50980203373E-21
} 0xbdcc06d366394441
test expr-28.710 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +29392222339 E-18 x 1f8f45c64b4682_111111111111111111111111111111111111110& E-26
convertToDouble +29392222339E-18
} 0x3e5f8f45c64b4683
test expr-28.711 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -75529940323 E-27 x -15c5203c0aad52_1111111111111111111111111111111111111110& E-54
convertToDouble -75529940323E-27
} 0xbc95c5203c0aad53
test expr-28.712 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -937495906299 E26 x -11a1e0ebb6af11_000000000000000000000000000000000000000001& E126
convertToDouble -937495906299E26
} 0xc7d1a1e0ebb6af11
test expr-28.713 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +842642485799 E-20 x 121879decdd7cb_000000000000000000000000000000000000000001& E-27
convertToDouble +842642485799E-20
} 0x3e421879decdd7cb
test expr-28.714 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -387824150699 E-23 x -110e8302245571_00000000000000000000000000000000000000001& E-38
convertToDouble -387824150699E-23
} 0xbd910e8302245571
test expr-28.715 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +924948814726 E-27 x 10a992d1fc6ded_00000000000000000000000000000000000000001& E-50
convertToDouble +924948814726E-27
} 0x3cd0a992d1fc6ded
test expr-28.716 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -775648301398 E-23 x -110e8302245571_00000000000000000000000000000000000000001& E-37
convertToDouble -775648301398E-23
} 0xbda10e8302245571
test expr-28.717 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +547075707432 E25 x 107684982f634e_1111111111111111111111111111111111111110& E122
convertToDouble +547075707432E25
} 0x47907684982f634f
test expr-28.718 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +683844634290 E24 x 107684982f634e_1111111111111111111111111111111111111110& E119
convertToDouble +683844634290E24
} 0x47607684982f634f
test expr-28.719 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -136768926858 E25 x -107684982f634e_1111111111111111111111111111111111111110& E120
convertToDouble -136768926858E25
} 0xc7707684982f634f
test expr-28.720 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +509802033730 E-22 x 1c06d366394440_11111111111111111111111111111111111111111110& E-35
convertToDouble +509802033730E-22
} 0x3dcc06d366394441
test expr-28.721 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +101960406746 E-21 x 1c06d366394440_11111111111111111111111111111111111111111110& E-34
convertToDouble +101960406746E-21
} 0x3ddc06d366394441
test expr-28.722 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -815683253968 E-21 x -1c06d366394440_11111111111111111111111111111111111111111110& E-31
convertToDouble -815683253968E-21
} 0xbe0c06d366394441
test expr-28.723 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +7344124123524 E24 x 1619b519dd6833_00000000000000000000000000000000000000000001& E122
convertToDouble +7344124123524E24
} 0x479619b519dd6833
test expr-28.724 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -9180155154405 E23 x -1619b519dd6833_00000000000000000000000000000000000000000001& E119
convertToDouble -9180155154405E23
} 0xc76619b519dd6833
test expr-28.725 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6479463327323 E27 x 130a9b3e9bd05e_00000000000000000000000000000000000000000001& E132
convertToDouble +6479463327323E27
} 0x48330a9b3e9bd05e
test expr-28.726 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -1836031030881 E24 x -1619b519dd6833_00000000000000000000000000000000000000000001& E120
convertToDouble -1836031030881E24
} 0xc77619b519dd6833
test expr-28.727 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4337269293039 E-19 x 1d1b5f354c63d6_00000000000000000000000000000000000000000001& E-22
convertToDouble +4337269293039E-19
} 0x3e9d1b5f354c63d6
test expr-28.728 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4599163554373 E-23 x -1948bf4d34088d_00000000000000000000000000000000000000000001& E-35
convertToDouble -4599163554373E-23
} 0xbdc948bf4d34088d
test expr-28.729 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9198327108746 E-23 x 1948bf4d34088d_00000000000000000000000000000000000000000001& E-34
convertToDouble +9198327108746E-23
} 0x3dd948bf4d34088d
test expr-28.730 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4812803938347 E27 x 1c4980a4ee94ce_111111111111111111111111111111111111111111110& E131
convertToDouble +4812803938347E27
} 0x482c4980a4ee94cf
test expr-28.731 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8412030890011 E23 x -14405075e52db9_11111111111111111111111111111111111111111110& E119
convertToDouble -8412030890011E23
} 0xc764405075e52dba
test expr-28.732 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9625607876694 E27 x 1c4980a4ee94ce_111111111111111111111111111111111111111111110& E132
convertToDouble +9625607876694E27
} 0x483c4980a4ee94cf
test expr-28.733 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4739968828249 E24 x -1c87140cdf8a1d_1111111111111111111111111111111111111111110& E121
convertToDouble -4739968828249E24
} 0xc78c87140cdf8a1e
test expr-28.734 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9697183891673 E-23 x 1aa7c959b6a666_11111111111111111111111111111111111111111111110& E-34
convertToDouble +9697183891673E-23
} 0x3ddaa7c959b6a667
test expr-28.735 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -7368108517543 E-20 x -13c7535bbd85a1_1111111111111111111111111111111111111111111110& E-24
convertToDouble -7368108517543E-20
} 0xbe73c7535bbd85a2
test expr-28.736 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +51461358161422 E25 x 18326f87d4cae0_0000000000000000000000000000000000000000000000001& E128
convertToDouble +51461358161422E25
} 0x47f8326f87d4cae0
test expr-28.737 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -77192037242133 E26 x -16af488f577e32_0000000000000000000000000000000000000000000000001& E132
convertToDouble -77192037242133E26
} 0xc836af488f577e32
test expr-28.738 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +77192037242133 E25 x 1225d3a5df9828_0000000000000000000000000000000000000000000000001& E129
convertToDouble +77192037242133E25
} 0x480225d3a5df9828
test expr-28.739 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -51461358161422 E27 x -12e767221e3e7f_0000000000000000000000000000000000000000000000001& E135
convertToDouble -51461358161422E27
} 0xc862e767221e3e7f
test expr-28.740 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +43999661561541 E-21 x 179f4476d372a3_0000000000000000000000000000000000000000000000001& E-25
convertToDouble +43999661561541E-21
} 0x3e679f4476d372a3
test expr-28.741 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -87999323123082 E-21 x -179f4476d372a3_0000000000000000000000000000000000000000000000001& E-24
convertToDouble -87999323123082E-21
} 0xbe779f4476d372a3
test expr-28.742 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +48374886826137 E-26 x 110538f23350d5_00000000000000000000000000000000000000000000001& E-41
convertToDouble +48374886826137E-26
} 0x3d610538f23350d5
test expr-28.743 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -57684246567111 E-23 x -13d1f5c1b8a912_00000000000000000000000000000000000000000000001& E-31
convertToDouble -57684246567111E-23
} 0xbe03d1f5c1b8a912
test expr-28.744 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +87192805957686 E23 x 1a3d16e55a9664_1111111111111111111111111111111111111111111110& E122
convertToDouble +87192805957686E23
} 0x479a3d16e55a9665
test expr-28.745 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -75108713005913 E24 x -1c40b4baa79655_11111111111111111111111111111111111111111111110& E125
convertToDouble -75108713005913E24
} 0xc7cc40b4baa79656
test expr-28.746 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +64233110587487 E27 x 179873e38669a6_1111111111111111111111111111111111111111111110& E135
convertToDouble +64233110587487E27
} 0x48679873e38669a7
test expr-28.747 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -77577471133384 E-23 x -1aa7c959b6a666_11111111111111111111111111111111111111111111110& E-31
convertToDouble -77577471133384E-23
} 0xbe0aa7c959b6a667
test expr-28.748 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +48485919458365 E-24 x 1aa7c959b6a666_11111111111111111111111111111111111111111111110& E-35
convertToDouble +48485919458365E-24
} 0x3dcaa7c959b6a667
test expr-28.749 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -56908598265713 E-26 x -1405deef4bdef5_111111111111111111111111111111111111111111111110& E-41
convertToDouble -56908598265713E-26
} 0xbd6405deef4bdef6
test expr-28.750 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +589722294620133 E23 x 162ed1b287caef_00000000000000000000000000000000000000000000000001& E125
convertToDouble +589722294620133E23
} 0x47c62ed1b287caef
test expr-28.751 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +652835804449289 E-22 x 118640e490b087_0000000000000000000000000000000000000000000000000001& E-24
convertToDouble +652835804449289E-22
} 0x3e718640e490b087
test expr-28.752 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -656415363936202 E-23 x -1c315cfe25d201_00000000000000000000000000000000000000000000000001& E-28
convertToDouble -656415363936202E-23
} 0xbe3c315cfe25d201
test expr-28.753 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +579336749585745 E-25 x 1fd9709d9aeb19_00000000000000000000000000000000000000000000000001& E-35
convertToDouble +579336749585745E-25
} 0x3dcfd9709d9aeb19
test expr-28.754 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -381292764980839 E-26 x -10c4f9921c3f8f_00000000000000000000000000000000000000000000000001& E-38
convertToDouble -381292764980839E-26
} 0xbd90c4f9921c3f8f
test expr-28.755 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +965265859649698 E23 x 12279607edcb0c_1111111111111111111111111111111111111111111111110& E126
convertToDouble +965265859649698E23
} 0x47d2279607edcb0d
test expr-28.756 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -848925235434882 E27 x -137d88ba4b43e3_1111111111111111111111111111111111111111111111111110& E139
convertToDouble -848925235434882E27
} 0xc8a37d88ba4b43e4
test expr-28.757 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +536177612222491 E23 x 142b33dd3acafd_11111111111111111111111111111111111111111111111110& E125
convertToDouble +536177612222491E23
} 0x47c42b33dd3acafe
test expr-28.758 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -424462617717441 E27 x -137d88ba4b43e3_1111111111111111111111111111111111111111111111111110& E138
convertToDouble -424462617717441E27
} 0xc8937d88ba4b43e4
test expr-28.759 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +276009279888989 E-27 x 136c242313c288_111111111111111111111111111111111111111111111111110& E-42
convertToDouble +276009279888989E-27
} 0x3d536c242313c289
test expr-28.760 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -608927158043691 E-26 x -1ac7e909c22f09_11111111111111111111111111111111111111111111111110& E-38
convertToDouble -608927158043691E-26
} 0xbd9ac7e909c22f0a
test expr-28.761 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +552018559777978 E-27 x 136c242313c288_111111111111111111111111111111111111111111111111110& E-41
convertToDouble +552018559777978E-27
} 0x3d636c242313c289
test expr-28.762 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -425678377667758 E-22 x -16da7aa49bdcd5_1111111111111111111111111111111111111111111111110& E-25
convertToDouble -425678377667758E-22
} 0xbe66da7aa49bdcd6
test expr-28.763 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8013702726927119 E26 x 126607f8f1b29e_00000000000000000000000000000000000000000000000000001& E139
convertToDouble +8013702726927119E26
} 0x48a26607f8f1b29e
test expr-28.764 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8862627962362001 E27 x 196f3b0e7787c2_00000000000000000000000000000000000000000000000000001& E142
convertToDouble +8862627962362001E27
} 0x48d96f3b0e7787c2
test expr-28.765 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -5068007907757162 E26 x -17456a27848397_00000000000000000000000000000000000000000000000000001& E138
convertToDouble -5068007907757162E26
} 0xc897456a27848397
test expr-28.766 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -7379714799828406 E-23 x -13cf4d2839e036_00000000000000000000000000000000000000000000000000001& E-24
convertToDouble -7379714799828406E-23
} 0xbe73cf4d2839e036
test expr-28.767 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4114538064016107 E-27 x 12188eda98010c_0000000000000000000000000000000000000000000000000001& E-38
convertToDouble +4114538064016107E-27
} 0x3d92188eda98010c
test expr-28.768 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -3689857399914203 E-23 x -13cf4d2839e036_00000000000000000000000000000000000000000000000000001& E-25
convertToDouble -3689857399914203E-23
} 0xbe63cf4d2839e036
test expr-28.769 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +5575954851815478 E23 x 1a37cfbf2ffdb5_1111111111111111111111111111111111111111111111111110& E128
convertToDouble +5575954851815478E23
} 0x47fa37cfbf2ffdb6
test expr-28.770 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +3395700941739528 E27 x 137d88ba4b43e3_1111111111111111111111111111111111111111111111111110& E141
convertToDouble +3395700941739528E27
} 0x48c37d88ba4b43e4
test expr-28.771 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4115535777581961 E-23 x 1618596be30fe4_111111111111111111111111111111111111111111111111111110& E-25
convertToDouble +4115535777581961E-23
} 0x3e6618596be30fe5
test expr-28.772 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8231071555163922 E-23 x -1618596be30fe4_111111111111111111111111111111111111111111111111111110& E-24
convertToDouble -8231071555163922E-23
} 0xbe7618596be30fe5
test expr-28.773 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6550246696190871 E-26 x 1201538b0f8c69_111111111111111111111111111111111111111111111111111110& E-34
convertToDouble +6550246696190871E-26
} 0x3dd201538b0f8c6a
test expr-28.774 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -68083046403986701 E27 x -186c70ba8ba28d_000000000000000000000000000000000000000000000000000000001& E145
convertToDouble -68083046403986701E27
} 0xc9086c70ba8ba28d
test expr-28.775 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +43566388595783643 E27 x 1f41e1bf48b03f_111111111111111111111111111111111111111111111111111111110& E144
convertToDouble +43566388595783643E27
} 0x48ff41e1bf48b040
test expr-28.776 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -87132777191567286 E27 x -1f41e1bf48b03f_111111111111111111111111111111111111111111111111111111110& E145
convertToDouble -87132777191567286E27
} 0xc90f41e1bf48b040
test expr-28.777 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +59644881059342141 E25 x 1b6338d9d8ae38_11111111111111111111111111111111111111111111111111111110& E138
convertToDouble +59644881059342141E25
} 0x489b6338d9d8ae39
test expr-28.778 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -83852770718576667 E23 x -18a4619ed6f442_111111111111111111111111111111111111111111111111111111110& E132
convertToDouble -83852770718576667E23
} 0xc838a4619ed6f443
test expr-28.779 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +99482967418206961 E-25 x 155d224bfed7ac_11111111111111111111111111111111111111111111111111111111110& E-27
convertToDouble +99482967418206961E-25
} 0x3e455d224bfed7ad
test expr-28.780 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -99482967418206961 E-26 x -11174ea3324623_11111111111111111111111111111111111111111111111111111111110& E-30
convertToDouble -99482967418206961E-26
} 0xbe11174ea3324624
test expr-28.781 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +87446669969994614 E-27 x 1809832942376d_11111111111111111111111111111111111111111111111111111110& E-34
convertToDouble +87446669969994614E-27
} 0x3dd809832942376e
test expr-28.782 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -43723334984997307 E-27 x -1809832942376d_11111111111111111111111111111111111111111111111111111110& E-35
convertToDouble -43723334984997307E-27
} 0xbdc809832942376e
test expr-28.783 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +5 E24 x 108b2a2c280290_1001& E82
convertToDouble +5E24
} 0x45108b2a2c280291
test expr-28.784 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8 E25 x -108b2a2c280290_1001& E86
convertToDouble -8E25
} 0xc5508b2a2c280291
test expr-28.785 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +1 E25 x 108b2a2c280290_1001& E83
convertToDouble +1E25
} 0x45208b2a2c280291
test expr-28.786 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4 E25 x -108b2a2c280290_1001& E85
convertToDouble -4E25
} 0xc5408b2a2c280291
test expr-28.787 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +2 E-5 x 14f8b588e368f0_100001& E-16
convertToDouble +2E-5
} 0x3ef4f8b588e368f1
test expr-28.788 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -5 E-6 x -14f8b588e368f0_100001& E-18
convertToDouble -5E-6
} 0xbed4f8b588e368f1
test expr-28.789 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4 E-5 x 14f8b588e368f0_100001& E-15
convertToDouble +4E-5
} 0x3f04f8b588e368f1
test expr-28.790 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -3 E-20 x -11b578c96db19a_100001& E-65
convertToDouble -3E-20
} 0xbbe1b578c96db19b
test expr-28.791 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +3 E27 x 1363156bbee301_0110& E91
convertToDouble +3E27
} 0x45a363156bbee301
test expr-28.792 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -9 E26 x -1743b34e18439b_010& E89
convertToDouble -9E26
} 0xc58743b34e18439b
test expr-28.793 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +7 E25 x 1cf389cd46047d_00& E85
convertToDouble +7E25
} 0x454cf389cd46047d
test expr-28.794 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -6 E27 x -1363156bbee301_0110& E92
convertToDouble -6E27
} 0xc5b363156bbee301
test expr-28.795 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +2 E-21 x 12e3b40a0e9b4f_0111110& E-69
convertToDouble +2E-21
} 0x3ba2e3b40a0e9b4f
test expr-28.796 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -5 E-22 x -12e3b40a0e9b4f_0111110& E-71
convertToDouble -5E-22
} 0xbb82e3b40a0e9b4f
test expr-28.797 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4 E-21 x -12e3b40a0e9b4f_0111110& E-68
convertToDouble -4E-21
} 0xbbb2e3b40a0e9b4f
test expr-28.798 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +87 E25 x 167d2d5406637c_10001& E89
convertToDouble +87E25
} 0x45867d2d5406637d
test expr-28.799 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -97 E24 x -140f232256e982_1000000001& E86
convertToDouble -97E24
} 0xc5540f232256e983
test expr-28.800 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +82 E-24 x 18c87154dff6c6_1000000001& E-74
convertToDouble +82E-24
} 0x3b58c87154dff6c7
test expr-28.801 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -41 E-24 x -18c87154dff6c6_1000000001& E-75
convertToDouble -41E-24
} 0xbb48c87154dff6c7
test expr-28.802 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +76 E-23 x 1cb644dc1633c0_10000001& E-71
convertToDouble +76E-23
} 0x3b8cb644dc1633c1
test expr-28.803 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +83 E25 x 15747ab143e353_011111111110& E89
convertToDouble +83E25
} 0x4585747ab143e353
test expr-28.804 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -50 E27 x -1431e0fae6d721_0111110& E95
convertToDouble -50E27
} 0xc5e431e0fae6d721
test expr-28.805 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +25 E27 x 1431e0fae6d721_0111110& E94
convertToDouble +25E27
} 0x45d431e0fae6d721
test expr-28.806 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -99 E27 x -13fe2e171cda19_011110& E96
convertToDouble -99E27
} 0xc5f3fe2e171cda19
test expr-28.807 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +97 E-10 x 14d4a1a3157dc7_011111110& E-27
convertToDouble +97E-10
} 0x3e44d4a1a3157dc7
test expr-28.808 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -57 E-20 x -15077f6f3242e7_011111110& E-61
convertToDouble -57E-20
} 0xbc25077f6f3242e7
test expr-28.809 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +997 E23 x 149e12f51c1a3c_10000000001& E86
convertToDouble +997E23
} 0x45549e12f51c1a3d
test expr-28.810 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +776 E24 x 140f232256e982_1000000001& E89
convertToDouble +776E24
} 0x45840f232256e983
test expr-28.811 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -388 E24 x -140f232256e982_1000000001& E88
convertToDouble -388E24
} 0xc5740f232256e983
test expr-28.812 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +521 E-10 x 1bf891c92c0890_100000000001& E-25
convertToDouble +521E-10
} 0x3e6bf891c92c0891
test expr-28.813 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -506 E-26 x -1877fa0260beb2_10000000001& E-78
convertToDouble -506E-26
} 0xbb1877fa0260beb3
test expr-28.814 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +739 E-10 x 13d65e8c76722c_10000000001& E-24
convertToDouble +739E-10
} 0x3e73d65e8c76722d
test expr-28.815 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -867 E-7 x -16ba56a8834168_100000000001& E-14
convertToDouble -867E-7
} 0xbf16ba56a8834169
test expr-28.816 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -415 E24 x -15747ab143e353_011111111110& E88
convertToDouble -415E24
} 0xc575747ab143e353
test expr-28.817 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +332 E25 x 15747ab143e353_011111111110& E91
convertToDouble +332E25
} 0x45a5747ab143e353
test expr-28.818 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -664 E25 x -15747ab143e353_011111111110& E92
convertToDouble -664E25
} 0xc5b5747ab143e353
test expr-28.819 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +291 E-13 x 1ffeebfc8b81b5_01111111111110& E-36
convertToDouble +291E-13
} 0x3dbffeebfc8b81b5
test expr-28.820 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -982 E-8 x -14981285e98e79_0111111111110& E-17
convertToDouble -982E-8
} 0xbee4981285e98e79
test expr-28.821 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +582 E-13 x 1ffeebfc8b81b5_01111111111110& E-35
convertToDouble +582E-13
} 0x3dcffeebfc8b81b5
test expr-28.822 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -491 E-8 x -14981285e98e79_0111111111110& E-18
convertToDouble -491E-8
} 0xbed4981285e98e79
test expr-28.823 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4574 E26 x 1717c1a612f954_100000000001& E98
convertToDouble +4574E26
} 0x461717c1a612f955
test expr-28.824 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8609 E26 x -15bb6f942546ee_1000000000001& E99
convertToDouble -8609E26
} 0xc625bb6f942546ef
test expr-28.825 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +2287 E26 x 1717c1a612f954_100000000001& E97
convertToDouble +2287E26
} 0x460717c1a612f955
test expr-28.826 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4818 E24 x -1f22b65eb419a0_10000000001& E91
convertToDouble -4818E24
} 0xc5af22b65eb419a1
test expr-28.827 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6529 E-8 x 111d89a8b5c142_100000000000001& E-14
convertToDouble +6529E-8
} 0x3f111d89a8b5c143
test expr-28.828 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8151 E-21 x -12cb804b61b898_1000000000000001& E-57
convertToDouble -8151E-21
} 0xbc62cb804b61b899
test expr-28.829 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +1557 E-12 x 1abfc227ab1026_10000000000001& E-30
convertToDouble +1557E-12
} 0x3e1abfc227ab1027
test expr-28.830 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2573 E-18 x -172cef1ebbca44_10000000000001& E-49
convertToDouble -2573E-18
} 0xbce72cef1ebbca45
test expr-28.831 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4929 E-16 x 1157a604ed019f_0111111111111110& E-41
convertToDouble +4929E-16
} 0x3d6157a604ed019f
test expr-28.832 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -3053 E-22 x -1686f435fe6b6b_011111111111110& E-62
convertToDouble -3053E-22
} 0xbc1686f435fe6b6b
test expr-28.833 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9858 E-16 x 1157a604ed019f_0111111111111110& E-40
convertToDouble +9858E-16
} 0x3d7157a604ed019f
test expr-28.834 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -7767 E-11 x -14d971170ed055_011111111111110& E-24
convertToDouble -7767E-11
} 0xbe74d971170ed055
test expr-28.835 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +54339 E26 x 1125782ec15cbe_100000000000000001& E102
convertToDouble +54339E26
} 0x465125782ec15cbf
test expr-28.836 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -62409 E25 x -1f822c980d4bb2_100000000000000001& E98
convertToDouble -62409E25
} 0xc61f822c980d4bb3
test expr-28.837 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +32819 E27 x 19e3be885fc16a_100000000000001& E104
convertToDouble +32819E27
} 0x4679e3be885fc16b
test expr-28.838 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -89849 E27 x -11b8371b6dda04_1000000000000001& E106
convertToDouble -89849E27
} 0xc691b8371b6dda05
test expr-28.839 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +63876 E-20 x 1703856844bdbe_1000000000000000000001& E-51
convertToDouble +63876E-20
} 0x3cc703856844bdbf
test expr-28.840 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -15969 E-20 x -1703856844bdbe_1000000000000000000001& E-53
convertToDouble -15969E-20
} 0xbca703856844bdbf
test expr-28.841 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +31938 E-20 x 1703856844bdbe_1000000000000000000001& E-52
convertToDouble +31938E-20
} 0x3cb703856844bdbf
test expr-28.842 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -79845 E-21 x -1703856844bdbe_1000000000000000000001& E-54
convertToDouble -79845E-21
} 0xbc9703856844bdbf
test expr-28.843 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +89306 E27 x 119cccff237e17_011111111111110& E106
convertToDouble +89306E27
} 0x46919cccff237e17
test expr-28.844 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -25487 E24 x -1496968ba07117_01111111111110& E94
convertToDouble -25487E24
} 0xc5d496968ba07117
test expr-28.845 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +79889 E24 x 10222a1c7e27d3_01111111111110& E96
convertToDouble +79889E24
} 0x45f0222a1c7e27d3
test expr-28.846 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -97379 E26 x -1eba3685911519_011111111111111110& E102
convertToDouble -97379E26
} 0xc65eba3685911519
test expr-28.847 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +81002 E-8 x 1a8af0b45d9531_0111111111111111110& E-11
convertToDouble +81002E-8
} 0x3f4a8af0b45d9531
test expr-28.848 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -43149 E-25 x -146064de6ecbed_011111111111111110& E-68
convertToDouble -43149E-25
} 0xbbb46064de6ecbed
test expr-28.849 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +40501 E-8 x 1a8af0b45d9531_0111111111111111110& E-12
convertToDouble +40501E-8
} 0x3f3a8af0b45d9531
test expr-28.850 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -60318 E-10 x -194c988f217e51_011111111111111110& E-18
convertToDouble -60318E-10
} 0xbed94c988f217e51
test expr-28.851 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -648299 E27 x -1ff6af0bf00100_10000000000000000001& E108
convertToDouble -648299E27
} 0xc6bff6af0bf00101
test expr-28.852 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +780649 E24 x 13b4d36f9edd18_10000000000000000001& E99
convertToDouble +780649E24
} 0x4623b4d36f9edd19
test expr-28.853 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +720919 E-14 x 1ef696965cbf04_10000000000000000000000001& E-28
convertToDouble +720919E-14
} 0x3e3ef696965cbf05
test expr-28.854 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -629703 E-11 x -1a69626d2629d0_1000000000000000000000001& E-18
convertToDouble -629703E-11
} 0xbeda69626d2629d1
test expr-28.855 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +557913 E24 x 1c2adb44b394bf_01111111111111111110& E98
convertToDouble +557913E24
} 0x461c2adb44b394bf
test expr-28.856 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -847899 E23 x -111f88fb93dce9_011111111111111111110& E96
convertToDouble -847899E23
} 0xc5f11f88fb93dce9
test expr-28.857 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +565445 E27 x 1be0eb55770d4d_0111111111111111110& E108
convertToDouble +565445E27
} 0x46bbe0eb55770d4d
test expr-28.858 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -736531 E24 x -1297b853d64ac7_01111111111111111110& E99
convertToDouble -736531E24
} 0xc62297b853d64ac7
test expr-28.859 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +680013 E-19 x 13240293e95c3b_01111111111111111111110& E-44
convertToDouble +680013E-19
} 0x3d33240293e95c3b
test expr-28.860 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -529981 E-10 x -1bc948d999ac11_011111111111111111110& E-15
convertToDouble -529981E-10
} 0xbf0bc948d999ac11
test expr-28.861 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +382923 E-23 x 11a8c1c10a1fc5_011111111111111111110& E-58
convertToDouble +382923E-23
} 0x3c51a8c1c10a1fc5
test expr-28.862 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -633614 E-18 x -164b166995a9b7_011111111111111111110& E-41
convertToDouble -633614E-18
} 0xbd664b166995a9b7
test expr-28.863 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +2165479 E27 x 1ab10c016c34b8_100000000000000000000001& E110
convertToDouble +2165479E27
} 0x46dab10c016c34b9
test expr-28.864 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8661916 E27 x -1ab10c016c34b8_100000000000000000000001& E112
convertToDouble -8661916E27
} 0xc6fab10c016c34b9
test expr-28.865 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4330958 E27 x 1ab10c016c34b8_100000000000000000000001& E111
convertToDouble +4330958E27
} 0x46eab10c016c34b9
test expr-28.866 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -9391993 E22 x -12f78bec748c98_1000000000000000000001& E96
convertToDouble -9391993E22
} 0xc5f2f78bec748c99
test expr-28.867 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -5767352 E-14 x -1ef696965cbf04_10000000000000000000000001& E-25
convertToDouble -5767352E-14
} 0xbe6ef696965cbf05
test expr-28.868 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +7209190 E-15 x 1ef696965cbf04_10000000000000000000000001& E-28
convertToDouble +7209190E-15
} 0x3e3ef696965cbf05
test expr-28.869 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -1441838 E-14 x -1ef696965cbf04_10000000000000000000000001& E-27
convertToDouble -1441838E-14
} 0xbe4ef696965cbf05
test expr-28.870 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8478990 E22 x 111f88fb93dce9_011111111111111111110& E96
convertToDouble +8478990E22
} 0x45f11f88fb93dce9
test expr-28.871 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +1473062 E24 x 1297b853d64ac7_01111111111111111110& E100
convertToDouble +1473062E24
} 0x463297b853d64ac7
test expr-28.872 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8366487 E-14 x 167567f55b22e1_0111111111111111111111110& E-24
convertToDouble +8366487E-14
} 0x3e767567f55b22e1
test expr-28.873 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8399969 E-25 x -1efd8be1b15b43_011111111111111111111110& E-61
convertToDouble -8399969E-25
} 0xbc2efd8be1b15b43
test expr-28.874 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9366737 E-12 x 13a4ba87ddc13f_011111111111111111111110& E-17
convertToDouble +9366737E-12
} 0x3ee3a4ba87ddc13f
test expr-28.875 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -9406141 E-13 x -1f8fd047c84d49_0111111111111111111111110& E-21
convertToDouble -9406141E-13
} 0xbeaf8fd047c84d49
test expr-28.876 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +65970979 E24 x 1a055dd68f3e3c_1000000000000000000000000001& E105
convertToDouble +65970979E24
} 0x468a055dd68f3e3d
test expr-28.877 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -65060671 E26 x -140c61c9916cf4_100000000000000000000000001& E112
convertToDouble -65060671E26
} 0xc6f40c61c9916cf5
test expr-28.878 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +54923002 E27 x 1527d37d8b38ea_10000000000000000000000001& E115
convertToDouble +54923002E27
} 0x472527d37d8b38eb
test expr-28.879 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -63846927 E25 x -1f7a9d79dad9b4_10000000000000000000000001& E108
convertToDouble -63846927E25
} 0xc6bf7a9d79dad9b5
test expr-28.880 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +99585767 E-21 x 1c07e928406d2e_100000000000000000000000001& E-44
convertToDouble +99585767E-21
} 0x3d3c07e928406d2f
test expr-28.881 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +67488159 E25 x 10a31a03822bc9_011111111111111111111111111110& E109
convertToDouble +67488159E25
} 0x46c0a31a03822bc9
test expr-28.882 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -69005339 E24 x -1b37c234aae77b_011111111111111111111111110& E105
convertToDouble -69005339E24
} 0xc68b37c234aae77b
test expr-28.883 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +81956786 E27 x 1f919023fcb6fd_0111111111111111111111111110& E115
convertToDouble +81956786E27
} 0x472f919023fcb6fd
test expr-28.884 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -40978393 E27 x -1f919023fcb6fd_0111111111111111111111111110& E114
convertToDouble -40978393E27
} 0xc71f919023fcb6fd
test expr-28.885 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +77505754 E-12 x 145152b6f85e09_0111111111111111111111111110& E-14
convertToDouble +77505754E-12
} 0x3f145152b6f85e09
test expr-28.886 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -38752877 E-12 x -145152b6f85e09_0111111111111111111111111110& E-15
convertToDouble -38752877E-12
} 0xbf045152b6f85e09
test expr-28.887 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +82772981 E-15 x 16381dae63505f_0111111111111111111111111111110& E-24
convertToDouble +82772981E-15
} 0x3e76381dae63505f
test expr-28.888 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -95593517 E-25 x -160ad862d8537d_0111111111111111111111111110& E-57
convertToDouble -95593517E-25
} 0xbc660ad862d8537d
test expr-28.889 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +200036989 E25 x 18a80dedbc575e_10000000000000000000000000001& E110
convertToDouble +200036989E25
} 0x46d8a80dedbc575f
test expr-28.890 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -772686455 E27 x -129a0c45ceca7a_1000000000000000000000000000001& E119
convertToDouble -772686455E27
} 0xc7629a0c45ceca7b
test expr-28.891 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +859139907 E23 x 10f18c4dd0ffe2_10000000000000000000000000001& E106
convertToDouble +859139907E23
} 0x4690f18c4dd0ffe3
test expr-28.892 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -400073978 E25 x -18a80dedbc575e_10000000000000000000000000001& E111
convertToDouble -400073978E25
} 0xc6e8a80dedbc575f
test expr-28.893 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +569014327 E-14 x 17ddbeac19d3b2_100000000000000000000000000001& E-18
convertToDouble +569014327E-14
} 0x3ed7ddbeac19d3b3
test expr-28.894 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -794263862 E-15 x -1aa6acb41dfc52_1000000000000000000000000000001& E-21
convertToDouble -794263862E-15
} 0xbeaaa6acb41dfc53
test expr-28.895 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +397131931 E-15 x 1aa6acb41dfc52_1000000000000000000000000000001& E-22
convertToDouble +397131931E-15
} 0x3e9aa6acb41dfc53
test expr-28.896 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -380398957 E-16 x -146c29d8331024_100000000000000000000000000001& E-25
convertToDouble -380398957E-16
} 0xbe646c29d8331025
test expr-28.897 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +567366773 E27 x 1b5155dd5417f9_0111111111111111111111111111110& E118
convertToDouble +567366773E27
} 0x475b5155dd5417f9
test expr-28.898 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -337440795 E24 x -10a31a03822bc9_011111111111111111111111111110& E108
convertToDouble -337440795E24
} 0xc6b0a31a03822bc9
test expr-28.899 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +134976318 E25 x 10a31a03822bc9_011111111111111111111111111110& E110
convertToDouble +134976318E25
} 0x46d0a31a03822bc9
test expr-28.900 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -269952636 E25 x -10a31a03822bc9_011111111111111111111111111110& E111
convertToDouble -269952636E25
} 0xc6e0a31a03822bc9
test expr-28.901 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +932080597 E-20 x 147f25b4941e5b_0111111111111111111111111111110& E-37
convertToDouble +932080597E-20
} 0x3da47f25b4941e5b
test expr-28.902 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -331091924 E-15 x -16381dae63505f_0111111111111111111111111111110& E-22
convertToDouble -331091924E-15
} 0xbe96381dae63505f
test expr-28.903 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -413864905 E-16 x -16381dae63505f_0111111111111111111111111111110& E-25
convertToDouble -413864905E-16
} 0xbe66381dae63505f
test expr-28.904 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8539246247 E26 x 148eb7813eaeba_10000000000000000000000000000001& E119
convertToDouble +8539246247E26
} 0x47648eb7813eaebb
test expr-28.905 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -5859139791 E26 x -1c35f28719d478_10000000000000000000000000000001& E118
convertToDouble -5859139791E26
} 0xc75c35f28719d479
test expr-28.906 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6105010149 E24 x 12d000fb2b138a_1000000000000000000000000000000001& E112
convertToDouble +6105010149E24
} 0x46f2d000fb2b138b
test expr-28.907 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -3090745820 E27 x -129a0c45ceca7a_1000000000000000000000000000001& E121
convertToDouble -3090745820E27
} 0xc7829a0c45ceca7b
test expr-28.908 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +3470877773 E-20 x 1314d381f2c31e_1000000000000000000000000000000001& E-35
convertToDouble +3470877773E-20
} 0x3dc314d381f2c31f
test expr-28.909 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -6136309089 E-27 x -1c4c799fab4328_1000000000000000000000000000000001& E-58
convertToDouble -6136309089E-27
} 0xbc5c4c799fab4329
test expr-28.910 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8917758713 E-19 x 1ea424bda7d7f4_100000000000000000000000000000001& E-31
convertToDouble +8917758713E-19
} 0x3e0ea424bda7d7f5
test expr-28.911 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -6941755546 E-20 x -1314d381f2c31e_1000000000000000000000000000000001& E-34
convertToDouble -6941755546E-20
} 0xbdd314d381f2c31f
test expr-28.912 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9194900535 E25 x 11b56f9c090dfb_011111111111111111111111111111111110& E116
convertToDouble +9194900535E25
} 0x4731b56f9c090dfb
test expr-28.913 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -1838980107 E26 x -11b56f9c090dfb_011111111111111111111111111111111110& E117
convertToDouble -1838980107E26
} 0xc741b56f9c090dfb
test expr-28.914 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +7355920428 E26 x 11b56f9c090dfb_011111111111111111111111111111111110& E119
convertToDouble +7355920428E26
} 0x4761b56f9c090dfb
test expr-28.915 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -3677960214 E26 x -11b56f9c090dfb_011111111111111111111111111111111110& E118
convertToDouble -3677960214E26
} 0xc751b56f9c090dfb
test expr-28.916 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8473634343 E-17 x 16bf0984b232b7_0111111111111111111111111111111110& E-24
convertToDouble +8473634343E-17
} 0x3e76bf0984b232b7
test expr-28.917 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8870766274 E-16 x -1dc3ee22137269_0111111111111111111111111111111110& E-21
convertToDouble -8870766274E-16
} 0xbeadc3ee22137269
test expr-28.918 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +4435383137 E-16 x 1dc3ee22137269_0111111111111111111111111111111110& E-22
convertToDouble +4435383137E-16
} 0x3e9dc3ee22137269
test expr-28.919 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -9598990129 E-15 x -14216b286031e7_01111111111111111111111111111111110& E-17
convertToDouble -9598990129E-15
} 0xbee4216b286031e7
test expr-28.920 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +71563496764 E26 x 15890d1ef6a0da_10000000000000000000000000000000000001& E122
convertToDouble +71563496764E26
} 0x4795890d1ef6a0db
test expr-28.921 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -89454370955 E25 x -15890d1ef6a0da_10000000000000000000000000000000000001& E119
convertToDouble -89454370955E25
} 0xc765890d1ef6a0db
test expr-28.922 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +17890874191 E26 x 15890d1ef6a0da_10000000000000000000000000000000000001& E120
convertToDouble +17890874191E26
} 0x4775890d1ef6a0db
test expr-28.923 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -35781748382 E26 x -15890d1ef6a0da_10000000000000000000000000000000000001& E121
convertToDouble -35781748382E26
} 0xc785890d1ef6a0db
test expr-28.924 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +57973447842 E-19 x 18e63f7cf5313c_1000000000000000000000000000000000000001& E-28
convertToDouble +57973447842E-19
} 0x3e38e63f7cf5313d
test expr-28.925 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -28986723921 E-19 x -18e63f7cf5313c_1000000000000000000000000000000000000001& E-29
convertToDouble -28986723921E-19
} 0xbe28e63f7cf5313d
test expr-28.926 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +76822711313 E-19 x 107f5f8b3bf818_100000000000000000000000000000000001& E-27
convertToDouble +76822711313E-19
} 0x3e407f5f8b3bf819
test expr-28.927 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -97699466874 E-20 x -10c8de34de806e_10000000000000000000000000000000001& E-30
convertToDouble -97699466874E-20
} 0xbe10c8de34de806f
test expr-28.928 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +67748656762 E27 x 197bf5559b31fd_01111111111111111111111111111111111110& E125
convertToDouble +67748656762E27
} 0x47c97bf5559b31fd
test expr-28.929 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -19394840991 E24 x -1de1ea791a6e7d_0111111111111111111111111111111111110& E113
convertToDouble -19394840991E24
} 0xc70de1ea791a6e7d
test expr-28.930 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +38789681982 E24 x 1de1ea791a6e7d_0111111111111111111111111111111111110& E114
convertToDouble +38789681982E24
} 0x471de1ea791a6e7d
test expr-28.931 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -33874328381 E27 x -197bf5559b31fd_01111111111111111111111111111111111110& E124
convertToDouble -33874328381E27
} 0xc7b97bf5559b31fd
test expr-28.932 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +54323763886 E-27 x 1f50c5c63e5441_0111111111111111111111111111111111110& E-55
convertToDouble +54323763886E-27
} 0x3c8f50c5c63e5441
test expr-28.933 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -58987193887 E-20 x -14449185a4c829_011111111111111111111111111111111111110& E-31
convertToDouble -58987193887E-20
} 0xbe04449185a4c829
test expr-28.934 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +27161881943 E-27 x 1f50c5c63e5441_0111111111111111111111111111111111110& E-56
convertToDouble +27161881943E-27
} 0x3c7f50c5c63e5441
test expr-28.935 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -93042648033 E-19 x -13fb12dc023fd3_0111111111111111111111111111111111110& E-27
convertToDouble -93042648033E-19
} 0xbe43fb12dc023fd3
test expr-28.936 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +520831059055 E27 x 187d469cb69dd0_10000000000000000000000000000000000000001& E128
convertToDouble +520831059055E27
} 0x47f87d469cb69dd1
test expr-28.937 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -768124264394 E25 x -171d6a019edae8_1000000000000000000000000000000000000001& E122
convertToDouble -768124264394E25
} 0xc7971d6a019edae9
test expr-28.938 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +384062132197 E25 x 171d6a019edae8_1000000000000000000000000000000000000001& E121
convertToDouble +384062132197E25
} 0x47871d6a019edae9
test expr-28.939 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +765337749889 E-25 x 158ad6f5d0a854_100000000000000000000000000000000000000001& E-44
convertToDouble +765337749889E-25
} 0x3d358ad6f5d0a855
test expr-28.940 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +794368912771 E25 x 17e79872f2f7ef_01111111111111111111111111111111111111110& E122
convertToDouble +794368912771E25
} 0x4797e79872f2f7ef
test expr-28.941 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -994162090146 E23 x -132598f85e658b_011111111111111111111111111111111111110& E116
convertToDouble -994162090146E23
} 0xc7332598f85e658b
test expr-28.942 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +781652779431 E26 x 1d670adf52038f_01111111111111111111111111111111111110& E125
convertToDouble +781652779431E26
} 0x47cd670adf52038f
test expr-28.943 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +910077190046 E-26 x 147e3ce1871d79_01111111111111111111111111111111111111110& E-47
convertToDouble +910077190046E-26
} 0x3d047e3ce1871d79
test expr-28.944 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -455038595023 E-26 x -147e3ce1871d79_01111111111111111111111111111111111111110& E-48
convertToDouble -455038595023E-26
} 0xbcf47e3ce1871d79
test expr-28.945 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +471897551096 E-20 x 14449185a4c829_011111111111111111111111111111111111110& E-28
convertToDouble +471897551096E-20
} 0x3e34449185a4c829
test expr-28.946 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -906698409911 E-21 x -1f27674f7d5745_0111111111111111111111111111111111111110& E-31
convertToDouble -906698409911E-21
} 0xbe0f27674f7d5745
test expr-28.947 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8854128003935 E25 x 10a71b8948faac_100000000000000000000000000000000000000001& E126
convertToDouble +8854128003935E25
} 0x47d0a71b8948faad
test expr-28.948 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8146122716299 E27 x -17f0762ac05654_1000000000000000000000000000000000000000001& E132
convertToDouble -8146122716299E27
} 0xc837f0762ac05655
test expr-28.949 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +7083302403148 E26 x 10a71b8948faac_100000000000000000000000000000000000000001& E129
convertToDouble +7083302403148E26
} 0x4800a71b8948faad
test expr-28.950 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -3541651201574 E26 x -10a71b8948faac_100000000000000000000000000000000000000001& E128
convertToDouble -3541651201574E26
} 0xc7f0a71b8948faad
test expr-28.951 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8394920649291 E-25 x 1d8978e8c1cc78_100000000000000000000000000000000000000000001& E-41
convertToDouble +8394920649291E-25
} 0x3d6d8978e8c1cc79
test expr-28.952 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -7657975756753 E-22 x -1a5006d695fef0_1000000000000000000000000000000000000000000001& E-31
convertToDouble -7657975756753E-22
} 0xbe0a5006d695fef1
test expr-28.953 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +5473834002228 E-20 x 1d632e1f745624_100000000000000000000000000000000000000000001& E-25
convertToDouble +5473834002228E-20
} 0x3e6d632e1f745625
test expr-28.954 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -6842292502785 E-21 x -1d632e1f745624_100000000000000000000000000000000000000000001& E-28
convertToDouble -6842292502785E-21
} 0xbe3d632e1f745625
test expr-28.955 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2109568884597 E25 x -1fbdc386609b13_011111111111111111111111111111111111111110& E123
convertToDouble -2109568884597E25
} 0xc7afbdc386609b13
test expr-28.956 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +8438275538388 E25 x 1fbdc386609b13_011111111111111111111111111111111111111110& E125
convertToDouble +8438275538388E25
} 0x47cfbdc386609b13
test expr-28.957 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -4219137769194 E25 x -1fbdc386609b13_011111111111111111111111111111111111111110& E124
convertToDouble -4219137769194E25
} 0xc7bfbdc386609b13
test expr-28.958 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +3200141789841 E-25 x 1684dcea3829f7_0111111111111111111111111111111111111111110& E-42
convertToDouble +3200141789841E-25
} 0x3d5684dcea3829f7
test expr-28.959 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8655689322607 E-22 x -1dbd9ff5dc8991_011111111111111111111111111111111111111110& E-31
convertToDouble -8655689322607E-22
} 0xbe0dbd9ff5dc8991
test expr-28.960 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6400283579682 E-25 x 1684dcea3829f7_0111111111111111111111111111111111111111110& E-41
convertToDouble +6400283579682E-25
} 0x3d6684dcea3829f7
test expr-28.961 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -8837719634493 E-21 x -12fa9676d2585b_011111111111111111111111111111111111111110& E-27
convertToDouble -8837719634493E-21
} 0xbe42fa9676d2585b
test expr-28.962 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +19428217075297 E24 x 1d3b7a1d154aba_10000000000000000000000000000000000000000000001& E123
convertToDouble +19428217075297E24
} 0x47ad3b7a1d154abb
test expr-28.963 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -38856434150594 E24 x -1d3b7a1d154aba_10000000000000000000000000000000000000000000001& E124
convertToDouble -38856434150594E24
} 0xc7bd3b7a1d154abb
test expr-28.964 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +77712868301188 E24 x 1d3b7a1d154aba_10000000000000000000000000000000000000000000001& E125
convertToDouble +77712868301188E24
} 0x47cd3b7a1d154abb
test expr-28.965 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -77192037242133 E27 x -1c5b1ab32d5dbe_1000000000000000000000000000000000000000000000001& E135
convertToDouble -77192037242133E27
} 0xc86c5b1ab32d5dbf
test expr-28.966 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +76579757567530 E-23 x 1a5006d695fef0_1000000000000000000000000000000000000000000001& E-31
convertToDouble +76579757567530E-23
} 0x3e0a5006d695fef1
test expr-28.967 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +15315951513506 E-22 x 1a5006d695fef0_1000000000000000000000000000000000000000000001& E-30
convertToDouble +15315951513506E-22
} 0x3e1a5006d695fef1
test expr-28.968 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -38289878783765 E-23 x -1a5006d695fef0_1000000000000000000000000000000000000000000001& E-32
convertToDouble -38289878783765E-23
} 0xbdfa5006d695fef1
test expr-28.969 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +49378033925202 E25 x 1737aa2567167b_0111111111111111111111111111111111111111111110& E128
convertToDouble +49378033925202E25
} 0x47f737aa2567167b
test expr-28.970 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -50940527102367 E24 x -132964f2944b05_0111111111111111111111111111111111111111111111110& E125
convertToDouble -50940527102367E24
} 0xc7c32964f2944b05
test expr-28.971 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +98756067850404 E25 x 1737aa2567167b_0111111111111111111111111111111111111111111110& E129
convertToDouble +98756067850404E25
} 0x480737aa2567167b
test expr-28.972 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -99589397544892 E26 x -1d4446075c4933_0111111111111111111111111111111111111111111110& E132
convertToDouble -99589397544892E26
} 0xc83d4446075c4933
test expr-28.973 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -56908598265713 E-25 x -190756ab1ed6b3_011111111111111111111111111111111111111111111110& E-38
convertToDouble -56908598265713E-25
} 0xbd990756ab1ed6b3
test expr-28.974 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +97470695699657 E-22 x 14ee821710e655_01111111111111111111111111111111111111111111110& E-27
convertToDouble +97470695699657E-22
} 0x3e44ee821710e655
test expr-28.975 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -35851901247343 E-25 x -1f8921657e1581_0111111111111111111111111111111111111111111110& E-39
convertToDouble -35851901247343E-25
} 0xbd8f8921657e1581
test expr-28.976 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +154384074484266 E27 x 1c5b1ab32d5dbe_1000000000000000000000000000000000000000000000001& E136
convertToDouble +154384074484266E27
} 0x487c5b1ab32d5dbf
test expr-28.977 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -308768148968532 E27 x -1c5b1ab32d5dbe_1000000000000000000000000000000000000000000000001& E137
convertToDouble -308768148968532E27
} 0xc88c5b1ab32d5dbf
test expr-28.978 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +910990389005985 E23 x 112242592ae54a_100000000000000000000000000000000000000000000001& E126
convertToDouble +910990389005985E23
} 0x47d12242592ae54b
test expr-28.979 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +271742424169201 E-27 x 131f46bcf7b452_10000000000000000000000000000000000000000000000001& E-42
convertToDouble +271742424169201E-27
} 0x3d531f46bcf7b453
test expr-28.980 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -543484848338402 E-27 x -131f46bcf7b452_10000000000000000000000000000000000000000000000001& E-41
convertToDouble -543484848338402E-27
} 0xbd631f46bcf7b453
test expr-28.981 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +162192083357563 E-26 x 1c887b68658760_1000000000000000000000000000000000000000000000001& E-40
convertToDouble +162192083357563E-26
} 0x3d7c887b68658761
test expr-28.982 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -869254552770081 E-23 x -12aac70665485e_1000000000000000000000000000000000000000000000000001& E-27
convertToDouble -869254552770081E-23
} 0xbe42aac70665485f
test expr-28.983 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +664831007626046 E24 x 1f429cb67eb075_011111111111111111111111111111111111111111111111110& E128
convertToDouble +664831007626046E24
} 0x47ff429cb67eb075
test expr-28.984 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -332415503813023 E24 x -1f429cb67eb075_011111111111111111111111111111111111111111111111110& E127
convertToDouble -332415503813023E24
} 0xc7ef429cb67eb075
test expr-28.985 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +943701829041427 E24 x 162fb2e38ee461_01111111111111111111111111111111111111111111111110& E129
convertToDouble +943701829041427E24
} 0x48062fb2e38ee461
test expr-28.986 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -101881054204734 E24 x -132964f2944b05_0111111111111111111111111111111111111111111111110& E126
convertToDouble -101881054204734E24
} 0xc7d32964f2944b05
test expr-28.987 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +828027839666967 E-27 x 1d2236349da3cd_011111111111111111111111111111111111111111111111110& E-41
convertToDouble +828027839666967E-27
} 0x3d6d2236349da3cd
test expr-28.988 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -280276135608777 E-27 x -13b901892fd0bf_0111111111111111111111111111111111111111111111110& E-42
convertToDouble -280276135608777E-27
} 0xbd53b901892fd0bf
test expr-28.989 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +212839188833879 E-21 x 1c91194dc2d40b_0111111111111111111111111111111111111111111111110& E-23
convertToDouble +212839188833879E-21
} 0x3e8c91194dc2d40b
test expr-28.990 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -113817196531426 E-25 x -190756ab1ed6b3_011111111111111111111111111111111111111111111110& E-37
convertToDouble -113817196531426E-25
} 0xbda90756ab1ed6b3
test expr-28.991 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +9711553197796883 E27 x 1bdeec25c0f03e_10000000000000000000000000000000000000000000000000001& E142
convertToDouble +9711553197796883E27
} 0x48dbdeec25c0f03f
test expr-28.992 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2739849386524269 E26 x -19295ade212370_1000000000000000000000000000000000000000000000000001& E137
convertToDouble -2739849386524269E26
} 0xc889295ade212371
test expr-28.993 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +5479698773048538 E26 x 19295ade212370_1000000000000000000000000000000000000000000000000001& E138
convertToDouble +5479698773048538E26
} 0x4899295ade212371
test expr-28.994 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6124568318523113 E-25 x 150b3a2e0aff14_1000000000000000000000000000000000000000000000000000001& E-31
convertToDouble +6124568318523113E-25
} 0x3e050b3a2e0aff15
test expr-28.995 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -1139777988171071 E-24 x -1394cbee428ea4_10000000000000000000000000000000000000000000000000001& E-30
convertToDouble -1139777988171071E-24
} 0xbe1394cbee428ea5
test expr-28.996 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +6322612303128019 E-27 x 1bcea0ec21e250_1000000000000000000000000000000000000000000000000000001& E-38
convertToDouble +6322612303128019E-27
} 0x3d9bcea0ec21e251
test expr-28.997 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2955864564844617 E-25 x -1450030e26c6dc_10000000000000000000000000000000000000000000000000001& E-32
convertToDouble -2955864564844617E-25
} 0xbdf450030e26c6dd
test expr-28.998 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -9994029144998961 E25 x -125b2b7fed4a61_0111111111111111111111111111111111111111111111111110& E136
convertToDouble -9994029144998961E25
} 0xc8725b2b7fed4a61
test expr-28.999 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -2971238324022087 E27 x -110dd7a301db67_0111111111111111111111111111111111111111111111111110& E141
convertToDouble -2971238324022087E27
} 0xc8c10dd7a301db67
test expr-28.1000 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -1656055679333934 E-27 x -1d2236349da3cd_011111111111111111111111111111111111111111111111110& E-40
convertToDouble -1656055679333934E-27
} 0xbd7d2236349da3cd
test expr-28.1001 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -1445488709150234 E-26 x -1fc960c59526c7_0111111111111111111111111111111111111111111111110& E-37
convertToDouble -1445488709150234E-26
} 0xbdafc960c59526c7
test expr-28.1002 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +55824717499885172 E27 x 1406b0cd17fd56_1000000000000000000000000000000000000000000000000000000001& E145
convertToDouble +55824717499885172E27
} 0x490406b0cd17fd57
test expr-28.1003 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -69780896874856465 E26 x -1406b0cd17fd56_1000000000000000000000000000000000000000000000000000000001& E142
convertToDouble -69780896874856465E26
} 0xc8d406b0cd17fd57
test expr-28.1004 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +84161538867545199 E25 x 13529217bdce6c_10000000000000000000000000000000000000000000000000000000001& E139
convertToDouble +84161538867545199E25
} 0x48a3529217bdce6d
test expr-28.1005 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -27912358749942586 E27 x -1406b0cd17fd56_1000000000000000000000000000000000000000000000000000000001& E144
convertToDouble -27912358749942586E27
} 0xc8f406b0cd17fd57
test expr-28.1006 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +24711112462926331 E-25 x 153a07f6040d22_100000000000000000000000000000000000000000000000000000001& E-29
convertToDouble +24711112462926331E-25
} 0x3e253a07f6040d23
test expr-28.1007 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -12645224606256038 E-27 x -1bcea0ec21e250_1000000000000000000000000000000000000000000000000000001& E-37
convertToDouble -12645224606256038E-27
} 0xbdabcea0ec21e251
test expr-28.1008 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -12249136637046226 E-25 x -150b3a2e0aff14_1000000000000000000000000000000000000000000000000000001& E-30
convertToDouble -12249136637046226E-25
} 0xbe150b3a2e0aff15
test expr-28.1009 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +74874448287465757 E27 x 1adc21d1d50b09_01111111111111111111111111111111111111111111111111111110& E145
convertToDouble +74874448287465757E27
} 0x490adc21d1d50b09
test expr-28.1010 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -35642836832753303 E24 x -1a2fac2b421f53_0111111111111111111111111111111111111111111111111111110& E134
convertToDouble -35642836832753303E24
} 0xc85a2fac2b421f53
test expr-28.1011 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -71285673665506606 E24 x -1a2fac2b421f53_0111111111111111111111111111111111111111111111111111110& E135
convertToDouble -71285673665506606E24
} 0xc86a2fac2b421f53
test expr-28.1012 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +43723334984997307 E-26 x 1e0be3f392c549_01111111111111111111111111111111111111111111111111111110& E-32
convertToDouble +43723334984997307E-26
} 0x3dfe0be3f392c549
test expr-28.1013 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN +10182419849537963 E-24 x 15ddd831ebbe53_011111111111111111111111111111111111111111111111111110& E-27
convertToDouble +10182419849537963E-24
} 0x3e45ddd831ebbe53
test expr-28.1014 {input floating-point conversion} {ieeeFloatingPoint} {
# Ad2b dieee UN -93501703572661982 E-26 x -10103f97ea6e13_0111111111111111111111111111111111111111111111111110& E-30
convertToDouble -93501703572661982E-26
} 0xbe10103f97ea6e13
test expr-29.1 {smallest representible number} {ieeeFloatingPoint} {
list [catch {convertToDouble 4.9406564584124654e-324} result] \
$result \
[catch {convertToDouble 2.4703282292062327e-324} result] \
$result \
[catch {convertToDouble 2.47032822920623e-324} result] \
$result
} {0 0x0000000000000001 0 0x0000000000000001 0 0x0000000000000000}
test expr-29.2 {smallest representible number} {ieeeFloatingPoint} {
list [catch {convertToDouble -4.9406564584124654e-324} result] \
$result \
[catch {convertToDouble -2.4703282292062327e-324} result] \
$result \
[catch {convertToDouble -2.47032822920623e-324} result] \
$result
} {0 0x8000000000000001 0 0x8000000000000001 0 0x8000000000000000}
test expr-29.3 {silent underflow on input conversion} {ieeeFloatingPoint} {
set v ?
list [scan 2.47032822920623e-324 %g v] $v
} {1 0.0}
test expr-29.4 {silent underflow on input conversion} {ieeeFloatingPoint} {
set v ?
list [scan -2.47032822920623e-324 %g v] $v
} {1 -0.0}
test expr-30.1 {largest representible number} {ieeeFloatingPoint} {
list [catch {convertToDouble 1.7976931348623155e+308} result] \
$result \
[catch {convertToDouble 1.7976931348623157e+308} result] \
$result \
[catch {convertToDouble 1.7976931348623159e+308} result] \
$result
} {0 0x7feffffffffffffe 0 0x7fefffffffffffff 0 0x7ff0000000000000}
test expr-30.2 {largest representible number} {ieeeFloatingPoint} {
list [catch {convertToDouble -1.7976931348623155e+308} result] \
$result \
[catch {convertToDouble -1.7976931348623157e+308} result] \
$result \
[catch {convertToDouble -1.7976931348623159e+308} result] \
$result
} {0 0xffeffffffffffffe 0 0xffefffffffffffff 0 0xfff0000000000000}
test expr-30.3 {silent overflow on input conversion} {ieeeFloatingPoint} {
set v ?
list [scan 1.7976931348623159e+308 %f v] $v
} {1 Inf}
test expr-30.4 {silent overflow on input conversion} {ieeeFloatingPoint} {
set v ?
list [scan -1.7976931348623159e+308 %f v] $v
} {1 -Inf}
# bool() tests (TIP #182)
set i 0
foreach s {yes true on} {
test expr-31.$i.0 {boolean conversion} {expr bool($s)} 1
test expr-31.$i.1 {boolean conversion} {expr bool(!$s)} 0
test expr-31.$i.2 {boolean conversion} {expr bool("$s")} 1
test expr-31.$i.3 {boolean conversion} {expr bool(!"$s")} 0
set j 1
while {$j < [string length $s]-1} {
test expr-31.$i.4.$j {boolean conversion} {
expr bool([string range $s 0 $j])
} 1
test expr-31.$i.5.$j {boolean conversion} {
expr bool("[string range $s 0 $j]")
} 1
incr j
}
incr i
}
test expr-31.0.4.0 {boolean conversion} {expr bool(y)} 1
test expr-31.0.5.0 {boolean conversion} {expr bool("y")} 1
test expr-31.1.4.0 {boolean conversion} {expr bool(t)} 1
test expr-31.1.5.0 {boolean conversion} {expr bool("t")} 1
test expr-31.2.4.0 {boolean conversion} -body {
expr bool(o)
} -returnCodes error -match glob -result *
test expr-31.2.5.0 {boolean conversion} -body {
expr bool("o")
} -returnCodes error -match glob -result *
foreach s {no false off} {
test expr-31.$i.0 {boolean conversion} {expr bool($s)} 0
test expr-31.$i.1 {boolean conversion} {expr bool(!$s)} 1
test expr-31.$i.2 {boolean conversion} {expr bool("$s")} 0
test expr-31.$i.3 {boolean conversion} {expr bool(!"$s")} 1
set j 1
while {$j < [string length $s]-1} {
test expr-31.$i.4.$j {boolean conversion} {
expr bool([string range $s 0 $j])
} 0
test expr-31.$i.5.$j {boolean conversion} {
expr bool("[string range $s 0 $j]")
} 0
incr j
}
incr i
}
test expr-31.3.4.0 {boolean conversion} {expr bool(n)} 0
test expr-31.3.5.0 {boolean conversion} {expr bool("n")} 0
test expr-31.4.4.0 {boolean conversion} {expr bool(f)} 0
test expr-31.4.5.0 {boolean conversion} {expr bool("f")} 0
test expr-31.6 {boolean conversion} {expr bool(-1 + 1)} 0
test expr-31.7 {boolean conversion} {expr bool(0 + 1)} 1
test expr-31.8 {boolean conversion} {expr bool(0.0)} 0
test expr-31.9 {boolean conversion} {expr bool(0x0)} 0
test expr-31.10 {boolean conversion} {expr bool(wide(0))} 0
test expr-31.11 {boolean conversion} {expr bool(5.0)} 1
test expr-31.12 {boolean conversion} {expr bool(5)} 1
test expr-31.13 {boolean conversion} {expr bool(0x5)} 1
test expr-31.14 {boolean conversion} {expr bool(wide(5))} 1
test expr-31.15 {boolean conversion} -body {
expr bool("fred")
} -returnCodes error -match glob -result *
# cleanup
if {[info exists a]} {
unset a
}
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
|
Changes to tests/fCmd.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # This file tests the tclFCmd.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1996-1997 Sun Microsystems, Inc. # Copyright (c) 1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# This file tests the tclFCmd.c file.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1996-1997 Sun Microsystems, Inc.
# Copyright (c) 1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: fCmd.test,v 1.45.2.1 2005/06/13 01:46:47 msofer Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
|
| ︙ | ︙ |
Changes to tests/fileSystem.test.
| ︙ | ︙ | |||
909 910 911 912 913 914 915 |
set absolute [file join [pwd] $relative]
set res [list [file tail $absolute] "test"]
}
file delete -force dgp
cd $origdir
set res
} {test test}
| | | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 |
set absolute [file join [pwd] $relative]
set res [list [file tail $absolute] "test"]
}
file delete -force dgp
cd $origdir
set res
} {test test}
test filesystem-9.6 {path objects and file tail and object rep} win {
set res {}
set p "C:\\toto"
lappend res [file join $p toto]
file isdirectory $p
lappend res [file join $p toto]
} {C:/toto/toto C:/toto/toto}
test filesystem-9.7 {path objects and glob and file tail and tilde} {
|
| ︙ | ︙ |
Changes to tests/for.test.
1 2 3 4 5 6 7 8 9 10 11 | # Commands covered: for, continue, break # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1996 Sun Microsystems, Inc. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# Commands covered: for, continue, break
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1996 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: for.test,v 1.10.4.1 2005/06/13 01:46:47 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
# Basic "for" operation.
|
| ︙ | ︙ | |||
655 656 657 658 659 660 661 |
list [catch {$z {set} {$i < 5} {incr i} {body}} msg] $msg $errorInfo
} -match glob -result {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
while *ing
"set"
("for" initial command)
invoked from within
"$z {set} {$i < 5} {incr i} {body}"}}
| | | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
list [catch {$z {set} {$i < 5} {incr i} {body}} msg] $msg $errorInfo
} -match glob -result {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
while *ing
"set"
("for" initial command)
invoked from within
"$z {set} {$i < 5} {incr i} {body}"}}
test for-6.7 {Tcl_ForObjCmd: error in test expression} -match glob -body {
set z for
list [catch {$z {set i 0} {i < 5} {incr i} {body}} msg] $msg $errorInfo
} -result {1 {syntax error in expression "i < 5": * preceding $*} {syntax error in expression "i < 5": * preceding $*
while executing
"$z {set i 0} {i < 5} {incr i} {body}"}}
test for-6.8 {Tcl_ForObjCmd: test expression is enclosed in quotes} {
set z for
set i 0
$z {set i 6} "$i > 5" {incr i} {set y $i}
set i
|
| ︙ | ︙ |
Changes to tests/info.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: info # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: info
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: info.test,v 1.29.4.1 2005/06/13 01:46:47 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
# Set up namespaces needed to test operation of "info args", "info body",
|
| ︙ | ︙ | |||
147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
lsort [info commands _t*]
} {_t1_ _t2_}
catch {rename _t1_ {}}
catch {rename _t2_ {}}
test info-4.5 {info commands option} {
list [catch {info commands a b} msg] $msg
} {1 {wrong # args: should be "info commands ?pattern?"}}
test info-5.1 {info complete option} {
list [catch {info complete} msg] $msg
} {1 {wrong # args: should be "info complete command"}}
test info-5.2 {info complete option} {
info complete abc
} 1
| > | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
lsort [info commands _t*]
} {_t1_ _t2_}
catch {rename _t1_ {}}
catch {rename _t2_ {}}
test info-4.5 {info commands option} {
list [catch {info commands a b} msg] $msg
} {1 {wrong # args: should be "info commands ?pattern?"}}
# Also some tests in namespace.test
test info-5.1 {info complete option} {
list [catch {info complete} msg] $msg
} {1 {wrong # args: should be "info complete command"}}
test info-5.2 {info complete option} {
info complete abc
} 1
|
| ︙ | ︙ | |||
609 610 611 612 613 614 615 |
namespace eval x info vars foo
} -cleanup {
namespace delete x
} -result {}
# Check whether the extra testing functions are defined...
if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} {
| | | | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
namespace eval x info vars foo
} -cleanup {
namespace delete x
} -result {}
# Check whether the extra testing functions are defined...
if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} {
set functions {abs acos asin atan atan2 bool ceil cos cosh double exp floor fmod hypot int log log10 pow rand round sin sinh sqrt srand tan tanh wide}
} else {
set functions {T1 T2 T3 abs acos asin atan atan2 bool ceil cos cosh double exp floor fmod hypot int log log10 pow rand round sin sinh sqrt srand tan tanh wide}
}
test info-20.1 {info functions option} {info functions sin} sin
test info-20.2 {info functions option} {lsort [info functions]} $functions
test info-20.3 {info functions option} {
lsort [info functions a*]
} {abs acos asin atan atan2}
test info-20.4 {info functions option} {
|
| ︙ | ︙ |
Changes to tests/init.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # Functionality covered: this file contains a collection of tests for the # auto loading and namespaces. # # Sourcing this file into Tcl runs the tests and generates output for # errors. No output means no errors were found. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Functionality covered: this file contains a collection of tests for the
# auto loading and namespaces.
#
# Sourcing this file into Tcl runs the tests and generates output for
# errors. No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: init.test,v 1.13.4.1 2005/06/13 01:46:48 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
# Clear out any namespaces called test_ns_*
|
| ︙ | ︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
catch {parray ::junk::$arg}
set second $::errorInfo
string equal $first $second
} 1
incr count
}
cleanupTests
} ;# End of [interp eval $testInterp]
# cleanup
interp delete $testInterp
::tcltest::cleanupTests
return
| > > > > > > > > > > > > > | 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 |
catch {parray ::junk::$arg}
set second $::errorInfo
string equal $first $second
} 1
incr count
}
test init-5.0 {return options passed through ::unknown} -setup {
catch {rename xxx {}}
set ::auto_index(::xxx) {proc ::xxx {} {
return -code error -level 2 xxx
}}
} -body {
set code [catch {::xxx} foo bar]
set code2 [catch {::xxx} foo2 bar2]
list $code $foo $bar $code2 $foo2 $bar2
} -cleanup {
unset ::auto_index(::xxx)
} -result {2 xxx {-code 1 -level 1} 2 xxx {-code 1 -level 1}}
cleanupTests
} ;# End of [interp eval $testInterp]
# cleanup
interp delete $testInterp
::tcltest::cleanupTests
return
|
Changes to tests/interp.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # This file tests the multiple interpreter facility of Tcl # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# This file tests the multiple interpreter facility of Tcl
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: interp.test,v 1.44.2.1 2005/06/13 01:46:48 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
namespace import -force ::tcltest::*
}
testConstraint testinterpdelete [llength [info commands testinterpdelete]]
|
| ︙ | ︙ |
Changes to tests/io.test.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # Copyright (c) 1991-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# Copyright (c) 1991-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: io.test,v 1.66.2.1 2005/06/13 01:46:48 msofer Exp $
if {[catch {package require tcltest 2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2 required."
return
}
namespace eval ::tcl::test::io {
|
| ︙ | ︙ | |||
4788 4789 4790 4791 4792 4793 4794 |
lappend l [fconfigure $f -buffersize]
fconfigure $f -buffersize 100000
lappend l [fconfigure $f -buffersize]
fconfigure $f -buffersize 10000000
lappend l [fconfigure $f -buffersize]
close $f
set l
| | | 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 |
lappend l [fconfigure $f -buffersize]
fconfigure $f -buffersize 100000
lappend l [fconfigure $f -buffersize]
fconfigure $f -buffersize 10000000
lappend l [fconfigure $f -buffersize]
close $f
set l
} {4096 10000 1 1 1 100000 100000}
test io-38.3 {Tcl_SetChannelBufferSize, changing buffersize between reads} {
# This test crashes the interp if Bug #427196 is not fixed
set chan [open [info script] r]
fconfigure $chan -buffersize 10
set var [read $chan 2]
fconfigure $chan -buffersize 32
|
| ︙ | ︙ |
Changes to tests/ioCmd.test.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # Copyright (c) 1991-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# Copyright (c) 1991-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: ioCmd.test,v 1.21.4.1 2005/06/13 01:46:49 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
testConstraint fcopy [llength [info commands fcopy]]
|
| ︙ | ︙ | |||
422 423 424 425 426 427 428 |
} "1 unmatched open brace in list
unmatched open brace in list
while processing open access modes \"FOO {BAR BAZ\"
invoked from within
\"open \$path(test3) \"FOO \\{BAR BAZ\"\""
test iocmd-12.7 {POSIX open access modes: errors} {
list [catch {open $path(test3) {FOO BAR BAZ}} msg] $msg
| | > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
} "1 unmatched open brace in list
unmatched open brace in list
while processing open access modes \"FOO {BAR BAZ\"
invoked from within
\"open \$path(test3) \"FOO \\{BAR BAZ\"\""
test iocmd-12.7 {POSIX open access modes: errors} {
list [catch {open $path(test3) {FOO BAR BAZ}} msg] $msg
} {1 {invalid access mode "FOO": must be RDONLY, WRONLY, RDWR, APPEND, BINARY, CREAT, EXCL, NOCTTY, NONBLOCK, or TRUNC}}
test iocmd-12.8 {POSIX open access modes: errors} {
list [catch {open $path(test3) {TRUNC CREAT}} msg] $msg
} {1 {access mode must include either RDONLY, WRONLY, or RDWR}}
close [open $path(test3) w]
test iocmd-12.9 {POSIX open access modes: BINARY} {
list [catch {open $path(test1) BINARY} msg] $msg
} {1 {access mode must include either RDONLY, WRONLY, or RDWR}}
test iocmd-12.10 {POSIX open access modes: BINARY} {
set f [open $path(test1) {WRONLY BINARY TRUNC}]
puts $f a
puts $f b
puts -nonewline $f c ;# contents are now 5 bytes: a\nb\nc
close $f
set f [open $path(test1) r]
fconfigure $f -translation binary
set result [string length [read $f]]
close $f
set result
} 5
test iocmd-12.11 {POSIX open access modes: BINARY} {
set f [open $path(test1) {WRONLY BINARY TRUNC}]
puts $f \u0248 ;# gets truncated to \u0048
close $f
set f [open $path(test1) r]
fconfigure $f -translation binary
set result [read -nonewline $f]
close $f
set result
} \u0048
test iocmd-13.1 {errors in open command} {
list [catch {open} msg] $msg
} {1 {wrong # args: should be "open fileName ?access? ?permissions?"}}
test iocmd-13.2 {errors in open command} {
list [catch {open a b c d} msg] $msg
} {1 {wrong # args: should be "open fileName ?access? ?permissions?"}}
|
| ︙ | ︙ | |||
448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
list [catch {open $path(test1) r+1} msg] $msg
} {1 {illegal access mode "r+1"}}
test iocmd-13.6 {errors in open command} {
set msg [list [catch {open _non_existent_} msg] $msg $errorCode]
regsub [file join {} _non_existent_] $msg "_non_existent_" msg
string tolower $msg
} {1 {couldn't open "_non_existent_": no such file or directory} {posix enoent {no such file or directory}}}
test iocmd-14.1 {file id parsing errors} {
list [catch {eof gorp} msg] $msg $errorCode
} {1 {can not find channel named "gorp"} NONE}
test iocmd-14.2 {file id parsing errors} {
list [catch {eof filex} msg] $msg
} {1 {can not find channel named "filex"}}
| > > > > > > > > > | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
list [catch {open $path(test1) r+1} msg] $msg
} {1 {illegal access mode "r+1"}}
test iocmd-13.6 {errors in open command} {
set msg [list [catch {open _non_existent_} msg] $msg $errorCode]
regsub [file join {} _non_existent_] $msg "_non_existent_" msg
string tolower $msg
} {1 {couldn't open "_non_existent_": no such file or directory} {posix enoent {no such file or directory}}}
test iocmd-13.7 {errors in open command} {
list [catch {open $path(test1) b} msg] $msg
} {1 {illegal access mode "b"}}
test iocmd-13.8 {errors in open command} {
list [catch {open $path(test1) rbb} msg] $msg
} {1 {illegal access mode "rbb"}}
test iocmd-13.9 {errors in open command} {
list [catch {open $path(test1) r++} msg] $msg
} {1 {illegal access mode "r++"}}
test iocmd-14.1 {file id parsing errors} {
list [catch {eof gorp} msg] $msg $errorCode
} {1 {can not find channel named "gorp"} NONE}
test iocmd-14.2 {file id parsing errors} {
list [catch {eof filex} msg] $msg
} {1 {can not find channel named "filex"}}
|
| ︙ | ︙ |
Changes to tests/iogt.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # -*- tcl -*- # Commands covered: transform, and stacking in general # # This file contains a collection of tests for Giot # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 2000 Ajuba Solutions. # Copyright (c) 2000 Andreas Kupries. # All rights reserved. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# -*- tcl -*-
# Commands covered: transform, and stacking in general
#
# This file contains a collection of tests for Giot
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# Copyright (c) 2000 Ajuba Solutions.
# Copyright (c) 2000 Andreas Kupries.
# All rights reserved.
#
# RCS: @(#) $Id: iogt.test,v 1.11.4.1 2005/06/13 01:46:49 msofer Exp $
if {[catch {package require tcltest 2.1}]} {
puts stderr "Skipping tests in [info script]. tcltest 2.1 required."
return
}
namespace eval ::tcl::test::iogt {
|
| ︙ | ︙ | |||
494 495 496 497 498 499 500 |
set fout [open $path(dummyout) w]
set ain [list] ; set aout [list]
audit_ops ain -attach $fin
audit_ops aout -attach $fout
fconfigure $fin -buffersize 10
| | | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
set fout [open $path(dummyout) w]
set ain [list] ; set aout [list]
audit_ops ain -attach $fin
audit_ops aout -attach $fout
fconfigure $fin -buffersize 10
fconfigure $fout -buffersize 10
fcopy $fin $fout
close $fin
close $fout
set res "[join $ain \n]\n--------\n[join $aout \n]"
|
| ︙ | ︙ | |||
544 545 546 547 548 549 550 |
set fout [open $path(dummyout) w]
set ain [list] ; set aout [list]
audit_flow ain -attach $fin
audit_flow aout -attach $fout
fconfigure $fin -buffersize 10
| | | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
set fout [open $path(dummyout) w]
set ain [list] ; set aout [list]
audit_flow ain -attach $fin
audit_flow aout -attach $fout
fconfigure $fin -buffersize 10
fconfigure $fout -buffersize 10
fcopy $fin $fout
close $fin
close $fout
set res "[join $ain \n]\n--------\n[join $aout \n]"
|
| ︙ | ︙ |
Changes to tests/lindex.test.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: lindex.test,v 1.11.4.1 2005/06/13 01:46:49 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
set minus -
|
| ︙ | ︙ | |||
45 46 47 48 49 50 51 |
list [testevalex {lindex {{a b c} {d e f}} $x}] \
[testevalex {lindex {{a b c} {d e f}} $x}]
} {f f}
test lindex-2.4 {malformed index list} testevalex {
set x \{
list [catch { testevalex {lindex {a b c} $x} } result] $result
| | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
list [testevalex {lindex {{a b c} {d e f}} $x}] \
[testevalex {lindex {{a b c} {d e f}} $x}]
} {f f}
test lindex-2.4 {malformed index list} testevalex {
set x \{
list [catch { testevalex {lindex {a b c} $x} } result] $result
} {1 bad\ index\ \"\{\":\ must\ be\ integer?\[+-\]integer?\ or\ end?\[+-\]integer?}
# Indices that are integers or convertible to integers
test lindex-3.1 {integer -1} testevalex {
set x ${minus}1
list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}]
} {{} {}}
|
| ︙ | ︙ | |||
72 73 74 75 76 77 78 |
set x [string range 33 0 0]
list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}]
} {{} {}}
test lindex-3.5 {bad octal} testevalex {
set x 08
list [catch { testevalex {lindex {a b c} $x} } result] $result
| | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
set x [string range 33 0 0]
list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}]
} {{} {}}
test lindex-3.5 {bad octal} testevalex {
set x 08
list [catch { testevalex {lindex {a b c} $x} } result] $result
} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test lindex-3.6 {bad octal} testevalex {
set x -09
list [catch { testevalex {lindex {a b c} $x} } result] $result
} {1 {bad index "-09": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test lindex-3.7 {indexes don't shimmer wide ints} {
set x [expr {(wide(1)<<31) - 2}]
list $x [lindex {1 2 3} $x] [incr x] [incr x]
} {2147483646 {} 2147483647 2147483648}
# Indices relative to end
|
| ︙ | ︙ | |||
114 115 116 117 118 119 120 |
set x end-3
list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}]
} {{} {}}
test lindex-4.6 {bad octal} testevalex {
set x end-08
list [catch { testevalex {lindex {a b c} $x} } result] $result
| | | | | | | | | 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 |
set x end-3
list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}]
} {{} {}}
test lindex-4.6 {bad octal} testevalex {
set x end-08
list [catch { testevalex {lindex {a b c} $x} } result] $result
} {1 {bad index "end-08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test lindex-4.7 {bad octal} testevalex {
set x end--09
list [catch { testevalex {lindex {a b c} $x} } result] $result
} {1 {bad index "end--09": must be integer?[+-]integer? or end?[+-]integer?}}
test lindex-4.8 {bad integer, not octal} testevalex {
set x end-0a2
list [catch { testevalex {lindex {a b c} $x} } result] $result
} {1 {bad index "end-0a2": must be integer?[+-]integer? or end?[+-]integer?}}
test lindex-4.9 {obsolete test} testevalex {
set x end
list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}]
} {c c}
test lindex-4.10 {incomplete end-} testevalex {
set x end-
list [catch { testevalex {lindex {a b c} $x} } result] $result
} {1 {bad index "end-": must be integer?[+-]integer? or end?[+-]integer?}}
test lindex-5.1 {bad second index} testevalex {
list [catch { testevalex {lindex {a b c} 0 0a2} } result] $result
} {1 {bad index "0a2": must be integer?[+-]integer? or end?[+-]integer?}}
test lindex-5.2 {good second index} testevalex {
testevalex {lindex {{a b c} {d e f} {g h i}} 1 2}
} f
test lindex-5.3 {three indices} testevalex {
testevalex {lindex {{{a b} {c d}} {{e f} {g h}}} 1 0 1}
|
| ︙ | ︙ | |||
241 242 243 244 245 246 247 |
} result
set result
} {f f}
test lindex-10.4 {malformed index list} {
set x \{
list [catch { lindex {a b c} $x } result] $result
| | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
} result
set result
} {f f}
test lindex-10.4 {malformed index list} {
set x \{
list [catch { lindex {a b c} $x } result] $result
} {1 bad\ index\ \"\{\":\ must\ be\ integer?\[+-\]integer?\ or\ end?\[+-\]integer?}
# Indices that are integers or convertible to integers
test lindex-11.1 {integer -1} {
set x ${minus}1
catch {
list [lindex {a b c} $x] [lindex {a b c} $x]
|
| ︙ | ︙ | |||
280 281 282 283 284 285 286 |
} result
set result
} {{} {}}
test lindex-11.5 {bad octal} {
set x 08
list [catch { lindex {a b c} $x } result] $result
| | | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
} result
set result
} {{} {}}
test lindex-11.5 {bad octal} {
set x 08
list [catch { lindex {a b c} $x } result] $result
} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test lindex-11.6 {bad octal} {
set x -09
list [catch { lindex {a b c} $x } result] $result
} {1 {bad index "-09": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
# Indices relative to end
test lindex-12.1 {index = end} {
set x end
catch {
list [lindex {a b c} $x] [lindex {a b c} $x]
|
| ︙ | ︙ | |||
332 333 334 335 336 337 338 |
} result
set result
} {{} {}}
test lindex-12.6 {bad octal} {
set x end-08
list [catch { lindex {a b c} $x } result] $result
| | | | | | | | | 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 |
} result
set result
} {{} {}}
test lindex-12.6 {bad octal} {
set x end-08
list [catch { lindex {a b c} $x } result] $result
} {1 {bad index "end-08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test lindex-12.7 {bad octal} {
set x end--09
list [catch { lindex {a b c} $x } result] $result
} {1 {bad index "end--09": must be integer?[+-]integer? or end?[+-]integer?}}
test lindex-12.8 {bad integer, not octal} {
set x end-0a2
list [catch { lindex {a b c} $x } result] $result
} {1 {bad index "end-0a2": must be integer?[+-]integer? or end?[+-]integer?}}
test lindex-12.9 {obsolete test} {
set x end
catch {
list [lindex {a b c} $x] [lindex {a b c} $x]
} result
set result
} {c c}
test lindex-12.10 {incomplete end-} {
set x end-
list [catch { lindex {a b c} $x } result] $result
} {1 {bad index "end-": must be integer?[+-]integer? or end?[+-]integer?}}
test lindex-13.1 {bad second index} {
list [catch { lindex {a b c} 0 0a2 } result] $result
} {1 {bad index "0a2": must be integer?[+-]integer? or end?[+-]integer?}}
test lindex-13.2 {good second index} {
catch {
lindex {{a b c} {d e f} {g h i}} 1 2
} result
set result
} f
|
| ︙ | ︙ |
Changes to tests/linsert.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: linsert # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: linsert
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: linsert.test,v 1.8.30.1 2005/06/13 01:46:49 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
catch {unset lis}
|
| ︙ | ︙ | |||
86 87 88 89 90 91 92 |
list [catch linsert msg] $msg
} {1 {wrong # args: should be "linsert list index element ?element ...?"}}
test linsert-2.2 {linsert errors} {
list [catch {linsert a b} msg] $msg
} {1 {wrong # args: should be "linsert list index element ?element ...?"}}
test linsert-2.3 {linsert errors} {
list [catch {linsert a 12x 2} msg] $msg
| | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
list [catch linsert msg] $msg
} {1 {wrong # args: should be "linsert list index element ?element ...?"}}
test linsert-2.2 {linsert errors} {
list [catch {linsert a b} msg] $msg
} {1 {wrong # args: should be "linsert list index element ?element ...?"}}
test linsert-2.3 {linsert errors} {
list [catch {linsert a 12x 2} msg] $msg
} {1 {bad index "12x": must be integer?[+-]integer? or end?[+-]integer?}}
test linsert-2.4 {linsert errors} {
list [catch {linsert \{ 12 2} msg] $msg
} {1 {unmatched open brace in list}}
test linsert-3.1 {linsert won't modify shared argument objects} {
proc p {} {
linsert "a b c" 1 "x y"
|
| ︙ | ︙ |
Changes to tests/listObj.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Functionality covered: operation of the procedures in tclListObj.c that # implement the Tcl type manager for the list object type. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | < < | < < | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# Functionality covered: operation of the procedures in tclListObj.c that
# implement the Tcl type manager for the list object type.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: listObj.test,v 1.6.4.1 2005/06/13 01:46:49 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
catch {unset x}
test listobj-1.1 {Tcl_GetListObjType} empty {
# Test removed; tested an internal detail
# that's no longer correct, and duplicated test obj-1.1
} {}
test listobj-2.1 {Tcl_SetListObj, use in lappend} {
catch {unset x}
list [lappend x 1 abc def] [lappend x 1 ghi jkl] $x
} {{1 abc def} {1 abc def 1 ghi jkl} {1 abc def 1 ghi jkl}}
test listobj-2.2 {Tcl_SetListObj, use in ObjInterpProc} {
proc return_args {args} {
|
| ︙ | ︙ |
Changes to tests/lrange.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: lrange # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: lrange
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: lrange.test,v 1.7.30.1 2005/06/13 01:46:49 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
test lrange-1.1 {range of list elements} {
|
| ︙ | ︙ | |||
39 40 41 42 43 44 45 |
test lrange-1.7 {range of list elements} {
lrange {a b c d e} -1 2
} {a b c}
test lrange-1.8 {range of list elements} {
lrange {a b c d e} -2 -1
} {}
test lrange-1.9 {range of list elements} {
| | | | | | 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 |
test lrange-1.7 {range of list elements} {
lrange {a b c d e} -1 2
} {a b c}
test lrange-1.8 {range of list elements} {
lrange {a b c d e} -2 -1
} {}
test lrange-1.9 {range of list elements} {
lrange {a b c d e} -2 end
} {a b c d e}
test lrange-1.10 {range of list elements} {
lrange "a b\{c d" 1 2
} "b\\{c d"
test lrange-1.11 {range of list elements} {
lrange "a b c d" end end
} d
test lrange-1.12 {range of list elements} {
lrange "a b c d" end 100000
} d
test lrange-1.13 {range of list elements} {
lrange "a b c d" end 3
} d
test lrange-1.14 {range of list elements} {
lrange "a b c d" end 2
} {}
test lrange-1.15 {range of list elements} {
concat \"[lrange {a b \{\ } 0 2]"
} {"a b \{\ "}
test lrange-1.16 {list element quoting} {
lrange {[append a .b]} 0 end
} {{[append} a .b\]}
test lrange-2.1 {error conditions} {
list [catch {lrange a b} msg] $msg
} {1 {wrong # args: should be "lrange list first last"}}
test lrange-2.2 {error conditions} {
list [catch {lrange a b 6 7} msg] $msg
} {1 {wrong # args: should be "lrange list first last"}}
test lrange-2.3 {error conditions} {
list [catch {lrange a b 6} msg] $msg
} {1 {bad index "b": must be integer?[+-]integer? or end?[+-]integer?}}
test lrange-2.4 {error conditions} {
list [catch {lrange a 0 enigma} msg] $msg
} {1 {bad index "enigma": must be integer?[+-]integer? or end?[+-]integer?}}
test lrange-2.5 {error conditions} {
list [catch {lrange "a \{b c" 3 4} msg] $msg
} {1 {unmatched open brace in list}}
test lrange-2.6 {error conditions} {
list [catch {lrange "a b c \{ d e" 1 4} msg] $msg
} {1 {unmatched open brace in list}}
# cleanup
::tcltest::cleanupTests
return
|
Changes to tests/lreplace.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: lreplace # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: lreplace
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: lreplace.test,v 1.7.30.1 2005/06/13 01:46:49 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
test lreplace-1.1 {lreplace command} {
|
| ︙ | ︙ | |||
106 107 108 109 110 111 112 |
list [catch lreplace msg] $msg
} {1 {wrong # args: should be "lreplace list first last ?element element ...?"}}
test lreplace-2.2 {lreplace errors} {
list [catch {lreplace a b} msg] $msg
} {1 {wrong # args: should be "lreplace list first last ?element element ...?"}}
test lreplace-2.3 {lreplace errors} {
list [catch {lreplace x a 10} msg] $msg
| | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
list [catch lreplace msg] $msg
} {1 {wrong # args: should be "lreplace list first last ?element element ...?"}}
test lreplace-2.2 {lreplace errors} {
list [catch {lreplace a b} msg] $msg
} {1 {wrong # args: should be "lreplace list first last ?element element ...?"}}
test lreplace-2.3 {lreplace errors} {
list [catch {lreplace x a 10} msg] $msg
} {1 {bad index "a": must be integer?[+-]integer? or end?[+-]integer?}}
test lreplace-2.4 {lreplace errors} {
list [catch {lreplace x 10 x} msg] $msg
} {1 {bad index "x": must be integer?[+-]integer? or end?[+-]integer?}}
test lreplace-2.5 {lreplace errors} {
list [catch {lreplace x 10 1x} msg] $msg
} {1 {bad index "1x": must be integer?[+-]integer? or end?[+-]integer?}}
test lreplace-2.6 {lreplace errors} {
list [catch {lreplace x 3 2} msg] $msg
} {1 {list doesn't contain element 3}}
test lreplace-2.7 {lreplace errors} {
list [catch {lreplace x 1 1} msg] $msg
} {1 {list doesn't contain element 1}}
|
| ︙ | ︙ |
Changes to tests/lsearch.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: lsearch # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: lsearch
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: lsearch.test,v 1.13.4.1 2005/06/13 01:46:49 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
set x {abcd bbcd 123 234 345}
|
| ︙ | ︙ | |||
57 58 59 60 61 62 63 |
lsearch -glob {xyz bbcc *bc*} *bc*
} 1
test lsearch-2.9 {search modes} {
lsearch -glob {b.x ^bc xy bcx} ^bc
} 1
test lsearch-2.10 {search modes} {
list [catch {lsearch -glib {b.x bx xy bcx} b.x} msg] $msg
| | > > > > > > > > > > > > > > > > > > | | | 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 |
lsearch -glob {xyz bbcc *bc*} *bc*
} 1
test lsearch-2.9 {search modes} {
lsearch -glob {b.x ^bc xy bcx} ^bc
} 1
test lsearch-2.10 {search modes} {
list [catch {lsearch -glib {b.x bx xy bcx} b.x} msg] $msg
} {1 {bad option "-glib": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}}
test lsearch-2.11 {search modes with -nocase} {
lsearch -exact -nocase {a b c A B C} A
} 0
test lsearch-2.12 {search modes with -nocase} {
lsearch -glob -nocase {a b c A B C} A*
} 0
test lsearch-2.13 {search modes with -nocase} {
lsearch -regexp -nocase {a b c A B C} ^A\$
} 0
test lsearch-2.14 {search modes without -nocase} {
lsearch -exact {a b c A B C} A
} 3
test lsearch-2.15 {search modes without -nocase} {
lsearch -glob {a b c A B C} A*
} 3
test lsearch-2.16 {search modes without -nocase} {
lsearch -regexp {a b c A B C} ^A\$
} 3
test lsearch-3.1 {lsearch errors} {
list [catch lsearch msg] $msg
} {1 {wrong # args: should be "lsearch ?options? list pattern"}}
test lsearch-3.2 {lsearch errors} {
list [catch {lsearch a} msg] $msg
} {1 {wrong # args: should be "lsearch ?options? list pattern"}}
test lsearch-3.3 {lsearch errors} {
list [catch {lsearch a b c} msg] $msg
} {1 {bad option "a": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}}
test lsearch-3.4 {lsearch errors} {
list [catch {lsearch a b c d} msg] $msg
} {1 {bad option "a": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}}
test lsearch-3.5 {lsearch errors} {
list [catch {lsearch "\{" b} msg] $msg
} {1 {unmatched open brace in list}}
test lsearch-3.6 {lsearch errors} {
list [catch {lsearch -index a b} msg] $msg
} {1 {"-index" option must be followed by list index}}
test lsearch-3.7 {lsearch errors} {
|
| ︙ | ︙ | |||
280 281 282 283 284 285 286 |
lsearch -start 2 {a b c d e f} a
} -1
test lsearch-10.3 {offset searching} {
lsearch -start end-4 {a b c a b c} a
} 3
test lsearch-10.4 {offset searching} {
list [catch {lsearch -start foobar {a b c a b c} a} msg] $msg
| | | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
lsearch -start 2 {a b c d e f} a
} -1
test lsearch-10.3 {offset searching} {
lsearch -start end-4 {a b c a b c} a
} 3
test lsearch-10.4 {offset searching} {
list [catch {lsearch -start foobar {a b c a b c} a} msg] $msg
} {1 {bad index "foobar": must be integer?[+-]integer? or end?[+-]integer?}}
test lsearch-10.5 {offset searching} {
list [catch {lsearch -start 1 2} msg] $msg
} {1 {missing starting index}}
test lsearch-10.6 {binary search with offset} {
set res {}
for {set i 0} {$i < 100} {incr i} {
lappend res [lsearch -integer -start 2 -sorted $increasingIntegers $i]
|
| ︙ | ︙ | |||
316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
test lsearch-13.1 {search for all matches} {
lsearch -all {a b a c a d} 1
} {}
test lsearch-13.2 {search for all matches} {
lsearch -all {a b a c a d} a
} {0 2 4}
test lsearch-14.1 {combinations: -all and -inline} {
lsearch -all -inline -glob {a1 b2 a3 c4 a5 d6} a*
} {a1 a3 a5}
test lsearch-14.2 {combinations: -all, -inline and -not} {
lsearch -all -inline -not -glob {a1 b2 a3 c4 a5 d6} a*
} {b2 c4 d6}
| > > > > > > > > > | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
test lsearch-13.1 {search for all matches} {
lsearch -all {a b a c a d} 1
} {}
test lsearch-13.2 {search for all matches} {
lsearch -all {a b a c a d} a
} {0 2 4}
test lsearch-13.3 {search for all matches with -nocase} {
lsearch -all -exact -nocase {a b c A B C} A
} {0 3}
test lsearch-13.4 {search for all matches with -nocase} {
lsearch -all -glob -nocase {a b c A B C} A*
} {0 3}
test lsearch-13.5 {search for all matches with -nocase} {
lsearch -all -regexp -nocase {a b c A B C} ^A\$
} {0 3}
test lsearch-14.1 {combinations: -all and -inline} {
lsearch -all -inline -glob {a1 b2 a3 c4 a5 d6} a*
} {a1 a3 a5}
test lsearch-14.2 {combinations: -all, -inline and -not} {
lsearch -all -inline -not -glob {a1 b2 a3 c4 a5 d6} a*
} {b2 c4 d6}
|
| ︙ | ︙ | |||
411 412 413 414 415 416 417 |
} {{0 0 0} {1 0 0}}
test lsearch-20.1 {lsearch -index option, index larger than sublists} {
list [catch {lsearch -index 2 {{a c} {a b} {a a}} a} msg] $msg
} {1 {element 2 missing from sublist "a c"}}
test lsearch-20.2 {lsearch -index option, malformed index} {
list [catch {lsearch -index foo {{a c} {a b} {a a}} a} msg] $msg
| | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
} {{0 0 0} {1 0 0}}
test lsearch-20.1 {lsearch -index option, index larger than sublists} {
list [catch {lsearch -index 2 {{a c} {a b} {a a}} a} msg] $msg
} {1 {element 2 missing from sublist "a c"}}
test lsearch-20.2 {lsearch -index option, malformed index} {
list [catch {lsearch -index foo {{a c} {a b} {a a}} a} msg] $msg
} {1 {bad index "foo": must be integer?[+-]integer? or end?[+-]integer?}}
test lsearch-20.3 {lsearch -index option, malformed index} {
list [catch {lsearch -index \{ {{a c} {a b} {a a}} a} msg] $msg
} {1 {unmatched open brace in list}}
# cleanup
catch {unset res}
catch {unset increasingIntegers}
|
| ︙ | ︙ |
Changes to tests/lset.test.
| ︙ | ︙ | |||
47 48 49 50 51 52 53 |
} {{3 1 2} {3 1 2}}
test lset-2.2 {lset, not compiled, 3 args, second arg neither index nor list} testevalex {
set x {0 1 2}
list [catch {
testevalex {lset x {{bad}1} 3}
} msg] $msg
| | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
} {{3 1 2} {3 1 2}}
test lset-2.2 {lset, not compiled, 3 args, second arg neither index nor list} testevalex {
set x {0 1 2}
list [catch {
testevalex {lset x {{bad}1} 3}
} msg] $msg
} {1 {bad index "{bad}1": must be integer?[+-]integer? or end?[+-]integer?}}
test lset-3.1 {lset, not compiled, 3 args, data duplicated} testevalex {
set x {0 1 2}
list [testevalex {lset x 0 $x}] $x
} {{{0 1 2} 1 2} {{0 1 2} 1 2}}
test lset-3.2 {lset, not compiled, 3 args, data duplicated} testevalex {
|
| ︙ | ︙ | |||
95 96 97 98 99 100 101 |
} {1 {unmatched open brace in list}}
test lset-4.2 {lset, not compiled, 3 args, bad index} testevalex {
set a {x y z}
list [catch {
testevalex {lset a [list 2a2] w}
} msg] $msg
| | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
} {1 {unmatched open brace in list}}
test lset-4.2 {lset, not compiled, 3 args, bad index} testevalex {
set a {x y z}
list [catch {
testevalex {lset a [list 2a2] w}
} msg] $msg
} {1 {bad index "2a2": must be integer?[+-]integer? or end?[+-]integer?}}
test lset-4.3 {lset, not compiled, 3 args, index out of range} testevalex {
set a {x y z}
list [catch {
testevalex {lset a [list -1] w}
} msg] $msg
} {1 {list index out of range}}
|
| ︙ | ︙ | |||
137 138 139 140 141 142 143 |
} {1 {unmatched open brace in list}}
test lset-4.8 {lset, not compiled, 3 args, bad index} testevalex {
set a {x y z}
list [catch {
testevalex {lset a 2a2 w}
} msg] $msg
| | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
} {1 {unmatched open brace in list}}
test lset-4.8 {lset, not compiled, 3 args, bad index} testevalex {
set a {x y z}
list [catch {
testevalex {lset a 2a2 w}
} msg] $msg
} {1 {bad index "2a2": must be integer?[+-]integer? or end?[+-]integer?}}
test lset-4.9 {lset, not compiled, 3 args, index out of range} testevalex {
set a {x y z}
list [catch {
testevalex {lset a -1 w}
} msg] $msg
} {1 {list index out of range}}
|
| ︙ | ︙ | |||
296 297 298 299 300 301 302 |
set a [list "a \{" b]
list [catch {testevalex {lset a {0 1} c}} msg] $msg
} {1 {unmatched open brace in list}}
test lset-8.3 {lset, not compiled, bad second index} testevalex {
set a {{b c} {d e}}
list [catch {testevalex {lset a 0 2a2 f}} msg] $msg
| | | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
set a [list "a \{" b]
list [catch {testevalex {lset a {0 1} c}} msg] $msg
} {1 {unmatched open brace in list}}
test lset-8.3 {lset, not compiled, bad second index} testevalex {
set a {{b c} {d e}}
list [catch {testevalex {lset a 0 2a2 f}} msg] $msg
} {1 {bad index "2a2": must be integer?[+-]integer? or end?[+-]integer?}}
test lset-8.4 {lset, not compiled, bad second index} testevalex {
set a {{b c} {d e}}
list [catch {testevalex {lset a {0 2a2} f}} msg] $msg
} {1 {bad index "2a2": must be integer?[+-]integer? or end?[+-]integer?}}
test lset-8.5 {lset, not compiled, second index out of range} testevalex {
set a {{b c} {d e} {f g}}
list [catch {testevalex {lset a 2 -1 h}} msg] $msg
} {1 {list index out of range}}
test lset-8.6 {lset, not compiled, second index out of range} testevalex {
|
| ︙ | ︙ |
Changes to tests/main.test.
1 2 | # This file contains a collection of tests for generic/tclMain.c. # | | | 1 2 3 4 5 6 7 8 9 10 |
# This file contains a collection of tests for generic/tclMain.c.
#
# RCS: @(#) $Id: main.test,v 1.15.4.1 2005/06/13 01:46:49 msofer Exp $
if {[catch {package require tcltest 2.0.2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required."
return
}
namespace eval ::tcl::test::main {
|
| ︙ | ︙ | |||
901 902 903 904 905 906 907 908 909 910 911 912 913 914 |
close stdin} >& result
set f [open result]
read $f
} -cleanup {
close $f
file delete result
} -result "1\n% "
# Tests Tcl_Main-7.*: exiting
test Tcl_Main-7.1 {
Tcl_Main: [exit] defined as no-op -> still have exithandlers
} -constraints {
exec Tcltest
| > > > > > > > > > > > > > > > > | 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 |
close stdin} >& result
set f [open result]
read $f
} -cleanup {
close $f
file delete result
} -result "1\n% "
test Tcl_Main-6.7 {
[unknown]: interactive auto-completion.
} -constraints {
exec
} -body {
exec [interpreter] << {
proc foo\{ x {}
set tcl_interactive 1
foo y} >& result
set f [open result]
read $f
} -cleanup {
close $f
file delete result
} -result "1\n% % "
# Tests Tcl_Main-7.*: exiting
test Tcl_Main-7.1 {
Tcl_Main: [exit] defined as no-op -> still have exithandlers
} -constraints {
exec Tcltest
|
| ︙ | ︙ |
Changes to tests/msgcat.test.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Note that after running these tests, entries will be left behind in the # message catalogs for locales foo, foo_BAR, and foo_BAR_baz. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# Note that after running these tests, entries will be left behind in the
# message catalogs for locales foo, foo_BAR, and foo_BAR_baz.
#
# RCS: @(#) $Id: msgcat.test,v 1.17.2.1 2005/06/13 01:46:50 msofer Exp $
package require Tcl 8.2
if {[catch {package require tcltest 2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2 required."
return
}
if {[catch {package require msgcat 1.4.1}]} {
|
| ︙ | ︙ |
Changes to tests/namespace.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Functionality covered: this file contains a collection of tests for the # procedures in tclNamesp.c that implement Tcl's basic support for # namespaces. Other namespace-related tests appear in variable.test. # # Sourcing this file into Tcl runs the tests and generates output for # errors. No output means no errors were found. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-2000 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Functionality covered: this file contains a collection of tests for the
# procedures in tclNamesp.c that implement Tcl's basic support for
# namespaces. Other namespace-related tests appear in variable.test.
#
# Sourcing this file into Tcl runs the tests and generates output for
# errors. No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: namespace.test,v 1.43.4.1 2005/06/13 01:46:50 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
# Clear out any namespaces called test_ns_*
|
| ︙ | ︙ | |||
834 835 836 837 838 839 840 |
test namespace-20.1 {Tcl_NamespaceObjCmd, bad subcommand} {
catch {namespace delete {expand}[namespace children :: test_ns_*]}
list [catch {namespace} msg] $msg
} {1 {wrong # args: should be "namespace subcommand ?arg ...?"}}
test namespace-20.2 {Tcl_NamespaceObjCmd, bad subcommand} {
list [catch {namespace wombat {}} msg] $msg
| | | 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 |
test namespace-20.1 {Tcl_NamespaceObjCmd, bad subcommand} {
catch {namespace delete {expand}[namespace children :: test_ns_*]}
list [catch {namespace} msg] $msg
} {1 {wrong # args: should be "namespace subcommand ?arg ...?"}}
test namespace-20.2 {Tcl_NamespaceObjCmd, bad subcommand} {
list [catch {namespace wombat {}} msg] $msg
} {1 {bad option "wombat": must be children, code, current, delete, ensemble, eval, exists, export, forget, import, inscope, origin, parent, path, qualifiers, tail, or which}}
test namespace-20.3 {Tcl_NamespaceObjCmd, abbreviations are okay} {
namespace ch :: test_ns_*
} {}
test namespace-21.1 {NamespaceChildrenCmd, no args} {
catch {namespace delete {expand}[namespace children :: test_ns_*]}
namespace eval test_ns_1::test_ns_2 {}
|
| ︙ | ︙ | |||
941 942 943 944 945 946 947 |
test namespace-25.1 {NamespaceEvalCmd, bad args} {
catch {namespace delete {expand}[namespace children :: test_ns_*]}
list [catch {namespace eval} msg] $msg
} {1 {wrong # args: should be "namespace eval name arg ?arg...?"}}
test namespace-25.2 {NamespaceEvalCmd, bad args} {
list [catch {namespace test_ns_1} msg] $msg
| | | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 |
test namespace-25.1 {NamespaceEvalCmd, bad args} {
catch {namespace delete {expand}[namespace children :: test_ns_*]}
list [catch {namespace eval} msg] $msg
} {1 {wrong # args: should be "namespace eval name arg ?arg...?"}}
test namespace-25.2 {NamespaceEvalCmd, bad args} {
list [catch {namespace test_ns_1} msg] $msg
} {1 {bad option "test_ns_1": must be children, code, current, delete, ensemble, eval, exists, export, forget, import, inscope, origin, parent, path, qualifiers, tail, or which}}
catch {unset v}
test namespace-25.3 {NamespaceEvalCmd, new namespace} {
set v 123
namespace eval test_ns_1 {
variable v 314159
proc p {} {
variable v
|
| ︙ | ︙ | |||
1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 |
namespace ens cre -command a -map {b {c d}}
namespace ens cre -command c -map {d {e f}}
proc e f {}
a b d
} -returnCodes error -result "wrong # args: should be \"a b\"" -cleanup {
rename a {}
}
# cleanup
catch {rename cmd1 {}}
catch {unset l}
catch {unset msg}
catch {unset trigger}
namespace delete {expand}[namespace children :: test_ns_*]
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 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 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 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 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 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 |
namespace ens cre -command a -map {b {c d}}
namespace ens cre -command c -map {d {e f}}
proc e f {}
a b d
} -returnCodes error -result "wrong # args: should be \"a b\"" -cleanup {
rename a {}
}
test namespace-51.1 {name resolution path control} -body {
namespace eval ::test_ns_1 {
namespace eval test_ns_2 {
proc pathtestA {} {
::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
}
proc pathtestC {} {
::return 2
}
}
proc pathtestB {} {
return 1
}
proc pathtestC {} {
return 1
}
namespace path ::test_ns_1
}
proc ::pathtestB {} {
return global
}
proc ::pathtestD {} {
return global
}
test_ns_1::test_ns_2::pathtestA
} -result "global,2,global," -cleanup {
namespace delete ::test_ns_1
catch {rename ::pathtestB {}}
catch {rename ::pathtestD {}}
}
test namespace-51.2 {name resolution path control} -body {
namespace eval ::test_ns_1 {
namespace eval test_ns_2 {
namespace path ::test_ns_1
proc pathtestA {} {
::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
}
proc pathtestC {} {
::return 2
}
}
proc pathtestB {} {
return 1
}
proc pathtestC {} {
return 1
}
}
proc ::pathtestB {} {
return global
}
proc ::pathtestD {} {
return global
}
::test_ns_1::test_ns_2::pathtestA
} -result "1,2,global,::test_ns_1" -cleanup {
namespace delete ::test_ns_1
catch {rename ::pathtestB {}}
catch {rename ::pathtestD {}}
}
test namespace-51.3 {name resolution path control} -body {
namespace eval ::test_ns_1 {
namespace eval test_ns_2 {
proc pathtestA {} {
::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
}
proc pathtestC {} {
::return 2
}
}
proc pathtestB {} {
return 1
}
proc pathtestC {} {
return 1
}
}
proc ::pathtestB {} {
return global
}
proc ::pathtestD {} {
return global
}
set result [::test_ns_1::test_ns_2::pathtestA]
namespace eval ::test_ns_1::test_ns_2 {
namespace path ::test_ns_1
}
lappend result [::test_ns_1::test_ns_2::pathtestA]
rename ::test_ns_1::pathtestB {}
lappend result [::test_ns_1::test_ns_2::pathtestA]
} -result "global,2,global, 1,2,global,::test_ns_1 global,2,global,::test_ns_1" -cleanup {
namespace delete ::test_ns_1
catch {rename ::pathtestB {}}
catch {rename ::pathtestD {}}
}
test namespace-51.4 {name resolution path control} -body {
namespace eval ::test_ns_1 {
namespace eval test_ns_2 {
proc pathtestA {} {
::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
}
proc pathtestC {} {
::return 2
}
}
proc pathtestB {} {
return 1
}
proc pathtestC {} {
return 1
}
}
proc ::pathtestB {} {
return global
}
proc ::pathtestD {} {
return global
}
set result [::test_ns_1::test_ns_2::pathtestA]
namespace eval ::test_ns_1::test_ns_2 {
namespace path ::test_ns_1
}
lappend result [::test_ns_1::test_ns_2::pathtestA]
namespace eval ::test_ns_1::test_ns_2 {
namespace path {}
}
lappend result [::test_ns_1::test_ns_2::pathtestA]
} -result "global,2,global, 1,2,global,::test_ns_1 global,2,global," -cleanup {
namespace delete ::test_ns_1
catch {rename ::pathtestB {}}
catch {rename ::pathtestD {}}
}
test namespace-51.5 {name resolution path control} -body {
namespace eval ::test_ns_1 {
namespace eval test_ns_2 {
proc pathtestA {} {
::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
}
proc pathtestC {} {
::return 2
}
namespace path ::test_ns_1
}
proc pathtestB {} {
return 1
}
proc pathtestC {} {
return 1
}
proc pathtestD {} {
return 1
}
}
proc ::pathtestB {} {
return global
}
proc ::pathtestD {} {
return global
}
set result [::test_ns_1::test_ns_2::pathtestA]
namespace eval ::test_ns_1::test_ns_2 {
namespace path {:: ::test_ns_1}
}
lappend result [::test_ns_1::test_ns_2::pathtestA]
rename ::test_ns_1::test_ns_2::pathtestC {}
lappend result [::test_ns_1::test_ns_2::pathtestA]
} -result "1,2,1,::test_ns_1 {global,2,global,:: ::test_ns_1} {global,1,global,:: ::test_ns_1}" -cleanup {
namespace delete ::test_ns_1
catch {rename ::pathtestB {}}
catch {rename ::pathtestD {}}
}
test namespace-51.6 {name resolution path control} -body {
namespace eval ::test_ns_1 {
namespace eval test_ns_2 {
proc pathtestA {} {
::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
}
proc pathtestC {} {
::return 2
}
namespace path ::test_ns_1
}
proc pathtestB {} {
return 1
}
proc pathtestC {} {
return 1
}
proc pathtestD {} {
return 1
}
}
proc ::pathtestB {} {
return global
}
proc ::pathtestD {} {
return global
}
set result [::test_ns_1::test_ns_2::pathtestA]
namespace eval ::test_ns_1::test_ns_2 {
namespace path {:: ::test_ns_1}
}
lappend result [::test_ns_1::test_ns_2::pathtestA]
rename ::test_ns_1::test_ns_2::pathtestC {}
lappend result [::test_ns_1::test_ns_2::pathtestA]
proc ::pathtestC {} {
return global
}
lappend result [::test_ns_1::test_ns_2::pathtestA]
} -result "1,2,1,::test_ns_1 {global,2,global,:: ::test_ns_1} {global,1,global,:: ::test_ns_1} {global,global,global,:: ::test_ns_1}" -cleanup {
namespace delete ::test_ns_1
catch {rename ::pathtestB {}}
catch {rename ::pathtestD {}}
}
test namespace-51.7 {name resolution path control} -body {
namespace eval ::test_ns_1 {
}
namespace eval ::test_ns_2 {
namespace path ::test_ns_1
proc getpath {} {namespace path}
}
list [::test_ns_2::getpath] [namespace delete ::test_ns_1] [::test_ns_2::getpath]
} -result {::test_ns_1 {} {}} -cleanup {
catch {namespace delete ::test_ns_1}
namespace delete ::test_ns_2
}
test namespace-51.8 {name resolution path control} -body {
namespace eval ::test_ns_1 {
}
namespace eval ::test_ns_2 {
}
namespace eval ::test_ns_3 {
}
namespace eval ::test_ns_4 {
namespace path {::test_ns_1 ::test_ns_2 ::test_ns_3}
proc getpath {} {namespace path}
}
list [::test_ns_4::getpath] [namespace delete ::test_ns_2] [::test_ns_4::getpath]
} -result {{::test_ns_1 ::test_ns_2 ::test_ns_3} {} {::test_ns_1 ::test_ns_3}} -cleanup {
catch {namespace delete ::test_ns_1}
catch {namespace delete ::test_ns_2}
catch {namespace delete ::test_ns_3}
catch {namespace delete ::test_ns_4}
}
test namespace-51.9 {name resolution path control} -body {
namespace eval ::test_ns_1 {
}
namespace eval ::test_ns_2 {
}
namespace eval ::test_ns_3 {
}
namespace eval ::test_ns_4 {
namespace path {::test_ns_1 ::test_ns_2 ::test_ns_3}
proc getpath {} {namespace path}
}
list [::test_ns_4::getpath] [namespace delete ::test_ns_2] [namespace eval ::test_ns_2 {}] [::test_ns_4::getpath]
} -result {{::test_ns_1 ::test_ns_2 ::test_ns_3} {} {} {::test_ns_1 ::test_ns_3}} -cleanup {
catch {namespace delete ::test_ns_1}
catch {namespace delete ::test_ns_2}
catch {namespace delete ::test_ns_3}
catch {namespace delete ::test_ns_4}
}
test namespace-51.10 {name resolution path control} -body {
namespace eval ::test_ns_1 {
namespace path does::not::exist
}
} -returnCodes error -result {unknown namespace "does::not::exist"} -cleanup {
catch {namespace delete ::test_ns_1}
}
test namespace-51.11 {name resolution path control} -body {
namespace eval ::test_ns_1 {
proc foo {} {return 1}
}
namespace eval ::test_ns_2 {
proc foo {} {return 2}
}
namespace eval ::test_ns_3 {
namespace path ::test_ns_1
}
namespace eval ::test_ns_4 {
namespace path {::test_ns_3 ::test_ns_2}
foo
}
} -result 2 -cleanup {
catch {namespace delete ::test_ns_1}
catch {namespace delete ::test_ns_2}
catch {namespace delete ::test_ns_3}
catch {namespace delete ::test_ns_4}
}
test namespace-51.12 {name resolution path control} -body {
namespace eval ::test_ns_1 {
proc foo {} {return 1}
}
namespace eval ::test_ns_2 {
proc foo {} {return 2}
}
namespace eval ::test_ns_3 {
namespace path ::test_ns_1
}
namespace eval ::test_ns_4 {
namespace path {::test_ns_3 ::test_ns_2}
list [foo] [namespace delete ::test_ns_3] [foo]
}
} -result {2 {} 2} -cleanup {
catch {namespace delete ::test_ns_1}
catch {namespace delete ::test_ns_2}
catch {namespace delete ::test_ns_3}
catch {namespace delete ::test_ns_4}
}
# Fails right now due to unrelated bug...
test namespace-51.13 {name resolution path control} -constraints knownBug -body {
set ::result {}
namespace eval ::test_ns_1 {
proc foo {} {lappend ::result 1}
}
namespace eval ::test_ns_2 {
proc foo {} {lappend ::result 2}
trace add command foo delete {namespace eval ::test_ns_3 foo;#}
}
namespace eval ::test_ns_3 {
proc foo {} {
lappend ::result 3
namespace delete [namespace current]
::test_ns_4::bar
}
}
namespace eval ::test_ns_4 {
namespace path {::test_ns_2 ::test_ns_3 ::test_ns_1}
proc bar {} {
list [foo] [namespace delete ::test_ns_2] [foo]
}
bar
}
# Should the result be "2 {} {2 3 1 1}" instead?
} -result {2 {} {2 3 2 1}} -cleanup {
catch {namespace delete ::test_ns_1}
catch {namespace delete ::test_ns_2}
catch {namespace delete ::test_ns_3}
catch {namespace delete ::test_ns_4}
}
test namespace-51.14 {name resolution path control} -body {
proc foo0 {} {}
namespace eval ::test_ns_1 {
proc foo1 {} {}
}
namespace eval ::test_ns_2 {
proc foo2 {} {}
}
namespace eval ::test_ns_3 {
variable result {}
lappend result [info commands foo*]
namespace path {::test_ns_1 ::test_ns_2}
lappend result [info commands foo*]
proc foo2 {} {}
lappend result [info commands foo*]
rename foo2 {}
lappend result [info commands foo*]
namespace delete ::test_ns_1
lappend result [info commands foo*]
}
} -result {foo0 {foo1 foo2 foo0} {foo2 foo1 foo0} {foo1 foo2 foo0} {foo2 foo0}} -cleanup {
catch {namespace delete ::test_ns_1}
catch {namespace delete ::test_ns_2}
catch {namespace delete ::test_ns_3}
}
test namespace-51.15 {namespace resolution path control} -body {
namespace eval ::test_ns_2 {
proc foo {} {return 2}
}
namespace eval ::test_ns_1 {
namespace eval test_ns_2 {
proc foo {} {return 1_2}
}
namespace eval test_ns_3 {
namespace path ::test_ns_1
test_ns_2::foo
}
}
} -result 1_2 -cleanup {
namespace delete ::test_ns_1
namespace delete ::test_ns_2
}
# cleanup
catch {rename cmd1 {}}
catch {unset l}
catch {unset msg}
catch {unset trigger}
namespace delete {expand}[namespace children :: test_ns_*]
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
|
Changes to tests/obj.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Functionality covered: this file contains a collection of tests for the # procedures in tclObj.c that implement Tcl's basic type support and the # type managers for the types boolean, double, and integer. # # Sourcing this file into Tcl runs the tests and generates output for # errors. No output means no errors were found. # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Functionality covered: this file contains a collection of tests for the
# procedures in tclObj.c that implement Tcl's basic type support and the
# type managers for the types boolean, double, and integer.
#
# Sourcing this file into Tcl runs the tests and generates output for
# errors. No output means no errors were found.
#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: obj.test,v 1.11.4.1 2005/06/13 01:46:50 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
# Procedure to determine the integer range of the machine
|
| ︙ | ︙ | |||
43 44 45 46 47 48 49 |
testConstraint 32bit [expr {$MAX_INT == 0x7fffffff}]
testConstraint wideBiggerThanInt [expr {$MAX_WIDE > wide($MAX_INT)}]
test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} testobj {
set r 1
foreach {t} {
{array search}
| | > > < < | > | 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 |
testConstraint 32bit [expr {$MAX_INT == 0x7fffffff}]
testConstraint wideBiggerThanInt [expr {$MAX_WIDE > wide($MAX_INT)}]
test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} testobj {
set r 1
foreach {t} {
{array search}
bignum
bytearray
bytecode
cmdName
dict
double
end-offset
int
nsName
regexp
string
wideInt
} {
set first [string first $t [testobj types]]
set r [expr {$r && ($first != -1)}]
}
set result $r
} {1}
|
| ︙ | ︙ | |||
171 172 173 174 175 176 177 |
test obj-9.1 {Tcl_NewBooleanObj} testobj {
set result ""
lappend result [testobj freeallvars]
lappend result [testbooleanobj set 1 0]
lappend result [testobj type 1]
lappend result [testobj refcount 1]
| | | | | | | | | | | | 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 |
test obj-9.1 {Tcl_NewBooleanObj} testobj {
set result ""
lappend result [testobj freeallvars]
lappend result [testbooleanobj set 1 0]
lappend result [testobj type 1]
lappend result [testobj refcount 1]
} {{} 0 int 2}
test obj-10.1 {Tcl_SetBooleanObj, existing "empty string" object} testobj {
set result ""
lappend result [testobj freeallvars]
lappend result [testobj newobj 1]
lappend result [testbooleanobj set 1 0] ;# makes existing obj boolean
lappend result [testobj type 1]
lappend result [testobj refcount 1]
} {{} {} 0 int 2}
test obj-10.2 {Tcl_SetBooleanObj, existing non-"empty string" object} testobj {
set result ""
lappend result [testobj freeallvars]
lappend result [testintobj set 1 98765]
lappend result [testbooleanobj set 1 1] ;# makes existing obj boolean
lappend result [testobj type 1]
lappend result [testobj refcount 1]
} {{} 98765 1 int 2}
test obj-11.1 {Tcl_GetBooleanFromObj, existing boolean object} testobj {
set result ""
lappend result [testbooleanobj set 1 1]
lappend result [testbooleanobj not 1] ;# gets existing boolean rep
} {1 0}
test obj-11.2 {Tcl_GetBooleanFromObj, convert to boolean} testobj {
set result ""
lappend result [testintobj set 1 47]
lappend result [testbooleanobj not 1] ;# must convert to bool
lappend result [testobj type 1]
} {47 0 int}
test obj-11.3 {Tcl_GetBooleanFromObj, error converting to boolean} testobj {
set result ""
lappend result [teststringobj set 1 abc]
lappend result [catch {testbooleanobj not 1} msg]
lappend result $msg
} {abc 1 {expected boolean value but got "abc"}}
test obj-11.4 {Tcl_GetBooleanFromObj, error converting from "empty string"} testobj {
set result ""
lappend result [testobj newobj 1]
lappend result [catch {testbooleanobj not 1} msg]
lappend result $msg
} {{} 1 {expected boolean value but got ""}}
test obj-11.5 {Tcl_GetBooleanFromObj, convert hex to boolean} testobj {
set result ""
lappend result [teststringobj set 1 0xac]
lappend result [testbooleanobj not 1]
lappend result [testobj type 1]
} {0xac 0 int}
test obj-11.6 {Tcl_GetBooleanFromObj, convert float to boolean} testobj {
set result ""
lappend result [teststringobj set 1 5.42]
lappend result [testbooleanobj not 1]
lappend result [testobj type 1]
} {5.42 0 int}
test obj-12.1 {DupBooleanInternalRep} testobj {
set result ""
lappend result [testbooleanobj set 1 1]
lappend result [testobj duplicate 1 2] ;# uses DupBooleanInternalRep
lappend result [testbooleanobj get 2]
} {1 1 1}
test obj-13.1 {SetBooleanFromAny, int to boolean special case} testobj {
set result ""
lappend result [testintobj set 1 1234]
lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny
lappend result [testobj type 1]
} {1234 0 int}
test obj-13.2 {SetBooleanFromAny, double to boolean special case} testobj {
set result ""
lappend result [testdoubleobj set 1 3.14159]
lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny
lappend result [testobj type 1]
} {3.14159 0 int}
test obj-13.3 {SetBooleanFromAny, special case strings representing booleans} testobj {
set result ""
foreach s {yes no true false on off} {
teststringobj set 1 $s
lappend result [testbooleanobj not 1]
}
lappend result [testobj type 1]
} {0 1 0 1 0 1 int}
test obj-13.4 {SetBooleanFromAny, recompute string rep then parse it} testobj {
set result ""
lappend result [testintobj set 1 456]
lappend result [testintobj div10 1]
lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny
lappend result [testobj type 1]
} {456 45 0 int}
test obj-13.5 {SetBooleanFromAny, error parsing string} testobj {
set result ""
lappend result [teststringobj set 1 abc]
lappend result [catch {testbooleanobj not 1} msg]
lappend result $msg
} {abc 1 {expected boolean value but got "abc"}}
test obj-13.6 {SetBooleanFromAny, error parsing string} testobj {
|
| ︙ | ︙ | |||
567 568 569 570 571 572 573 |
lappend result [testobj type 2]
lappend result [testobj refcount 1]
lappend result [testobj refcount 2]
lappend result [testbooleanobj set 2 0] ;# must copy on write, now 2 objs
lappend result [testobj type 2]
lappend result [testobj refcount 1]
lappend result [testobj refcount 2]
| | | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
lappend result [testobj type 2]
lappend result [testobj refcount 1]
lappend result [testobj refcount 2]
lappend result [testbooleanobj set 2 0] ;# must copy on write, now 2 objs
lappend result [testobj type 2]
lappend result [testobj refcount 1]
lappend result [testobj refcount 2]
} {{} 1024 1024 int 4 4 0 int 3 2}
test obj-31.1 {regenerate string rep of "end"} testobj {
testobj freeallvars
teststringobj set 1 end
testobj convert 1 end-offset
testobj invalidateStringRep 1
|
| ︙ | ︙ |
Changes to tests/parse.test.
1 2 3 4 5 6 7 8 9 10 | # This file contains a collection of tests for the procedures in the # file tclParse.c. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# This file contains a collection of tests for the procedures in the
# file tclParse.c. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: parse.test,v 1.19.4.1 2005/06/13 01:46:50 msofer Exp $
if {[catch {package require tcltest 2.0.2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required."
return
}
namespace eval ::tcl::test::parse {
|
| ︙ | ︙ | |||
939 940 941 942 943 944 945 946 947 948 949 950 951 |
set a
} 2
test parse-18.30 {Tcl_SubstObj, side effects} {
set a 0
catch {subst {foo[incr a; incr a parse error {}{}]bar}}
set a
} 1
cleanupTests
}
namespace delete ::tcl::test::parse
return
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
set a
} 2
test parse-18.30 {Tcl_SubstObj, side effects} {
set a 0
catch {subst {foo[incr a; incr a parse error {}{}]bar}}
set a
} 1
test parse-19.1 {Bug 1115904: recursion limit in Tcl_EvalEx} -constraints {
testevalex
} -setup {
interp create i
load {} Tcltest i
i eval {proc {} args {}}
interp recursionlimit i 3
} -body {
i eval {testevalex {[]}}
} -cleanup {
interp delete i
}
test parse-19.2 {Bug 1115904: recursion limit in Tcl_EvalEx} -constraints {
testevalex
} -setup {
interp create i
load {} Tcltest i
i eval {proc {} args {}}
interp recursionlimit i 3
} -body {
i eval {testevalex {[[]]}}
} -cleanup {
interp delete i
} -returnCodes error -match glob -result {too many nested*}
test parse-19.3 {Bug 1115904: recursion limit in Tcl_EvalEx} -setup {
interp create i
i eval {proc {} args {}}
interp recursionlimit i 3
} -body {
i eval {subst {[]}}
} -cleanup {
interp delete i
}
test parse-19.4 {Bug 1115904: recursion limit in Tcl_EvalEx} -setup {
interp create i
i eval {proc {} args {}}
interp recursionlimit i 3
} -body {
i eval {subst {[[]]}}
} -cleanup {
interp delete i
} -returnCodes error -match glob -result {too many nested*}
cleanupTests
}
namespace delete ::tcl::test::parse
return
|
Changes to tests/parseExpr.test.
1 2 3 4 5 6 7 8 9 10 | # This file contains a collection of tests for the procedures in the # file tclParseExpr.c. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 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 |
# This file contains a collection of tests for the procedures in the
# file tclParseExpr.c. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: parseExpr.test,v 1.13.4.1 2005/06/13 01:46:50 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
# Note that the Tcl expression parser (tclParseExpr.c) does not check
# the semantic validity of the expressions it parses. It does not check,
# for example, that a math function actually exists, or that the operands
# of "<<" are integers.
testConstraint testexprparser [llength [info commands testexprparser]]
# Some tests only work if wide integers (>32bit) are not found to be
# integers at all.
testConstraint wideIntegerUnparsed [expr {-1 == 0xffffffff}]
# Big test for correct ordering of data in [expr]
proc testIEEE {} {
variable ieeeValues
binary scan [binary format dd -1.0 1.0] c* c
switch -exact -- $c {
{0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
# little endian
binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \
ieeeValues(-Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \
ieeeValues(-Normal)
binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
ieeeValues(-Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
ieeeValues(+Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \
ieeeValues(+Normal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \
ieeeValues(+Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 1
return 1
}
{-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Infinity)
binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Normal)
binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Subnormal)
binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Subnormal)
binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Normal)
binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Infinity)
binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 0
return 1
}
default {
return 0
}
}
}
::tcltest::testConstraint ieeeFloatingPoint [testIEEE]
######################################################################
test parseExpr-1.1 {Tcl_ParseExpr procedure, computing string length} testexprparser {
testexprparser [bytestring "1+2\0 +3"] -1
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
test parseExpr-1.2 {Tcl_ParseExpr procedure, computing string length} testexprparser {
testexprparser "1 + 2" -1
} {- {} 0 subexpr {1 + 2} 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} \
-constraints testexprparser -body {
list [catch {testexprparser {foo+} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "foo+": *preceding $*}}
test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} testexprparser {
list [catch {testexprparser {1+2 345} -1} msg] $msg
} {1 {syntax error in expression "1+2 345": extra tokens at end of expression}}
test parseExpr-2.1 {ParseCondExpr procedure, valid test subexpr} testexprparser {
testexprparser {2>3? 1 : 0} -1
} {- {} 0 subexpr {2>3? 1 : 0} 11 operator ? 0 subexpr 2>3 5 operator > 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {0 || foo} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "0 || foo": * preceding $*}}
test parseExpr-2.3 {ParseCondExpr procedure, next lexeme isn't "?"} testexprparser {
testexprparser {1+2} -1
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
test parseExpr-2.4 {ParseCondExpr procedure, next lexeme is "?"} testexprparser {
testexprparser {1+2 ? 3 : 4} -1
} {- {} 0 subexpr {1+2 ? 3 : 4} 11 operator ? 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-2.5 {ParseCondExpr procedure, bad lexeme after "?"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1+2 ? 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} testexprparser {
testexprparser {1? 3 : 4} -1
} {- {} 0 subexpr {1? 3 : 4} 7 operator ? 0 subexpr 1 1 text 1 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-2.7 {ParseCondExpr procedure, error in "then" subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1? fred : martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1? fred : martha": *preceding $*}}
test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} testexprparser {
list [catch {testexprparser {1? 2 martha 3} -1} msg] $msg
} {1 {syntax error in expression "1? 2 martha 3": missing colon from ternary conditional}}
test parseExpr-2.9 {ParseCondExpr procedure, valid "else" subexpression} testexprparser {
testexprparser {27||3? 3 : 4&&9} -1
} {- {} 0 subexpr {27||3? 3 : 4&&9} 15 operator ? 0 subexpr 27||3 5 operator || 0 subexpr 27 1 text 27 0 subexpr 3 1 text 3 0 subexpr 3 1 text 3 0 subexpr 4&&9 5 operator && 0 subexpr 4 1 text 4 0 subexpr 9 1 text 9 0 {}}
test parseExpr-2.10 {ParseCondExpr procedure, error in "else" subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1? 2 : martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1? 2 : martha": * preceding $*}}
test parseExpr-3.1 {ParseLorExpr procedure, valid logical and subexpr} testexprparser {
testexprparser {1&&2 || 3} -1
} {- {} 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-3.2 {ParseLorExpr procedure, error in logical and subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1&&foo || 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1&&foo || 3": * preceding $*}}
test parseExpr-3.3 {ParseLorExpr procedure, next lexeme isn't "||"} testexprparser {
testexprparser {1&&2? 1 : 0} -1
} {- {} 0 subexpr {1&&2? 1 : 0} 11 operator ? 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-3.4 {ParseLorExpr procedure, next lexeme is "||"} testexprparser {
testexprparser {1&&2 || 3} -1
} {- {} 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-3.5 {ParseLorExpr procedure, bad lexeme after "||"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1&&2 || 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1&&2 || 3 || 4} -1
} {- {} 0 subexpr {1&&2 || 3 || 4} 13 operator || 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-3.7 {ParseLorExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1&&2 || 3 || martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1&&2 || 3 || martha": * preceding $*}}
test parseExpr-4.1 {ParseLandExpr procedure, valid LHS "|" subexpr} testexprparser {
testexprparser {1|2 && 3} -1
} {- {} 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-4.2 {ParseLandExpr procedure, error in LHS "|" subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1&&foo && 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1&&foo && 3": * preceding $*}}
test parseExpr-4.3 {ParseLandExpr procedure, next lexeme isn't "&&"} testexprparser {
testexprparser {1|2? 1 : 0} -1
} {- {} 0 subexpr {1|2? 1 : 0} 11 operator ? 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-4.4 {ParseLandExpr procedure, next lexeme is "&&"} testexprparser {
testexprparser {1|2 && 3} -1
} {- {} 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-4.5 {ParseLandExpr procedure, bad lexeme after "&&"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1|2 && 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1|2 && 3 && 4} -1
} {- {} 0 subexpr {1|2 && 3 && 4} 13 operator && 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-4.7 {ParseLandExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1|2 && 3 && martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1|2 && 3 && martha": * preceding $*}}
test parseExpr-5.1 {ParseBitOrExpr procedure, valid LHS "^" subexpr} testexprparser {
testexprparser {1^2 | 3} -1
} {- {} 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-5.2 {ParseBitOrExpr procedure, error in LHS "^" subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1|foo | 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1|foo | 3": * preceding $*}}
test parseExpr-5.3 {ParseBitOrExpr procedure, next lexeme isn't "|"} testexprparser {
testexprparser {1^2? 1 : 0} -1
} {- {} 0 subexpr {1^2? 1 : 0} 11 operator ? 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-5.4 {ParseBitOrExpr procedure, next lexeme is "|"} testexprparser {
testexprparser {1^2 | 3} -1
} {- {} 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-5.5 {ParseBitOrExpr procedure, bad lexeme after "|"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1^2 | 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1^2 | 3 | 4} -1
} {- {} 0 subexpr {1^2 | 3 | 4} 13 operator | 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-5.7 {ParseBitOrExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1^2 | 3 | martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1^2 | 3 | martha": * preceding $*}}
test parseExpr-6.1 {ParseBitXorExpr procedure, valid LHS "&" subexpr} testexprparser {
testexprparser {1&2 ^ 3} -1
} {- {} 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-6.2 {ParseBitXorExpr procedure, error in LHS "&" subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1^foo ^ 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1^foo ^ 3": * preceding $*}}
test parseExpr-6.3 {ParseBitXorExpr procedure, next lexeme isn't "^"} testexprparser {
testexprparser {1&2? 1 : 0} -1
} {- {} 0 subexpr {1&2? 1 : 0} 11 operator ? 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-6.4 {ParseBitXorExpr procedure, next lexeme is "^"} testexprparser {
testexprparser {1&2 ^ 3} -1
} {- {} 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-6.5 {ParseBitXorExpr procedure, bad lexeme after "^"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1&2 ^ 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1&2 ^ 3 ^ 4} -1
} {- {} 0 subexpr {1&2 ^ 3 ^ 4} 13 operator ^ 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-6.7 {ParseBitXorExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1&2 ^ 3 ^ martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1&2 ^ 3 ^ martha": * preceding $*}}
test parseExpr-7.1 {ParseBitAndExpr procedure, valid LHS equality subexpr} testexprparser {
testexprparser {1==2 & 3} -1
} {- {} 0 subexpr {1==2 & 3} 9 operator & 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-7.2 {ParseBitAndExpr procedure, error in LHS equality subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1!=foo & 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1!=foo & 3": * preceding $*}}
test parseExpr-7.3 {ParseBitAndExpr procedure, next lexeme isn't "&"} testexprparser {
testexprparser {1==2? 1 : 0} -1
} {- {} 0 subexpr {1==2? 1 : 0} 11 operator ? 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-7.4 {ParseBitAndExpr procedure, next lexeme is "&"} testexprparser {
testexprparser {1>2 & 3} -1
} {- {} 0 subexpr {1>2 & 3} 9 operator & 0 subexpr 1>2 5 operator > 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-7.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1==2 & 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1<2 & 3 & 4} -1
} {- {} 0 subexpr {1<2 & 3 & 4} 13 operator & 0 subexpr {1<2 & 3} 9 operator & 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-7.7 {ParseBitAndExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1==2 & 3>2 & martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1==2 & 3>2 & martha": * preceding $*}}
test parseExpr-8.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} testexprparser {
testexprparser {1<2 == 3} -1
} {- {} 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-8.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1>=foo == 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1>=foo == 3": * preceding $*}}
test parseExpr-8.3 {ParseEqualityExpr procedure, next lexeme isn't "==" or "!="} testexprparser {
testexprparser {1<2? 1 : 0} -1
} {- {} 0 subexpr {1<2? 1 : 0} 11 operator ? 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-8.4 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} testexprparser {
testexprparser {1<2 == 3} -1
} {- {} 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-8.5 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} testexprparser {
testexprparser {1<2 != 3} -1
} {- {} 0 subexpr {1<2 != 3} 9 operator != 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-8.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1<2 == 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-8.7 {ParseEqualityExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1<2 == 3 == 4} -1
} {- {} 0 subexpr {1<2 == 3 == 4} 13 operator == 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-8.8 {ParseEqualityExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1<2 == 3 != martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1<2 == 3 != martha": * preceding $*}}
test parseExpr-9.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} testexprparser {
testexprparser {1<<2 < 3} -1
} {- {} 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-9.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1>=foo < 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1>=foo < 3": * preceding $*}}
test parseExpr-9.3 {ParseRelationalExpr procedure, next lexeme isn't relational op} testexprparser {
testexprparser {1<<2? 1 : 0} -1
} {- {} 0 subexpr {1<<2? 1 : 0} 11 operator ? 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-9.4 {ParseRelationalExpr procedure, next lexeme is relational op} testexprparser {
testexprparser {1<<2 < 3} -1
} {- {} 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-9.5 {ParseRelationalExpr procedure, next lexeme is relational op} testexprparser {
|
| ︙ | ︙ | |||
234 235 236 237 238 239 240 |
} {- {} 0 subexpr {1<<2 >= 3} 9 operator >= 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-9.8 {ParseRelationalExpr procedure, bad lexeme after relational op} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1<<2 < 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1<<2 < 3 < 4} -1
} {- {} 0 subexpr {1<<2 < 3 < 4} 13 operator < 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
| | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | > | > | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
} {- {} 0 subexpr {1<<2 >= 3} 9 operator >= 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-9.8 {ParseRelationalExpr procedure, bad lexeme after relational op} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1<<2 < 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1<<2 < 3 < 4} -1
} {- {} 0 subexpr {1<<2 < 3 < 4} 13 operator < 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-9.10 {ParseRelationalExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1<<2 < 3 > martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1<<2 < 3 > martha": * preceding $*}}
test parseExpr-10.1 {ParseShiftExpr procedure, valid LHS add subexpr} testexprparser {
testexprparser {1+2 << 3} -1
} {- {} 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-10.2 {ParseShiftExpr procedure, error in LHS add subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1-foo << 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1-foo << 3": * preceding $*}}
test parseExpr-10.3 {ParseShiftExpr procedure, next lexeme isn't "<<" or ">>"} testexprparser {
testexprparser {1+2? 1 : 0} -1
} {- {} 0 subexpr {1+2? 1 : 0} 11 operator ? 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-10.4 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} testexprparser {
testexprparser {1+2 << 3} -1
} {- {} 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-10.5 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} testexprparser {
testexprparser {1+2 >> 3} -1
} {- {} 0 subexpr {1+2 >> 3} 9 operator >> 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-10.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1+2 << 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-10.7 {ParseShiftExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1+2 << 3 << 4} -1
} {- {} 0 subexpr {1+2 << 3 << 4} 13 operator << 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-10.8 {ParseShiftExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1+2 << 3 >> martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1+2 << 3 >> martha": * preceding $*}}
test parseExpr-11.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexprparser {
testexprparser {1*2 + 3} -1
} {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-11.2 {ParseAddExpr procedure, error in LHS multiply subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1/foo + 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1/foo + 3": * preceding $*}}
test parseExpr-11.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} testexprparser {
testexprparser {1*2? 1 : 0} -1
} {- {} 0 subexpr {1*2? 1 : 0} 11 operator ? 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-11.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser {
testexprparser {1*2 + 3} -1
} {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-11.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser {
testexprparser {1*2 - 3} -1
} {- {} 0 subexpr {1*2 - 3} 9 operator - 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-11.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-11.7 {ParseAddExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1*2 + 3 + 4} -1
} {- {} 0 subexpr {1*2 + 3 + 4} 13 operator + 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-11.8 {ParseAddExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1*2 + 3 - martha": * preceding $*}}
test parseExpr-12.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexprparser {
testexprparser {1*2 + 3} -1
} {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-12.2 {ParseAddExpr procedure, error in LHS multiply subexpr} \
-constraints testexprparser -body {
list [catch {testexprparser {1/foo + 3} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1/foo + 3": * preceding $*}}
test parseExpr-12.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} testexprparser {
testexprparser {1*2? 1 : 0} -1
} {- {} 0 subexpr {1*2? 1 : 0} 11 operator ? 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-12.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser {
testexprparser {1*2 + 3} -1
} {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-12.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser {
testexprparser {1*2 - 3} -1
} {- {} 0 subexpr {1*2 - 3} 9 operator - 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-12.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-12.7 {ParseAddExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1*2 + 3 + 4} -1
} {- {} 0 subexpr {1*2 + 3 + 4} 13 operator + 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-12.8 {ParseAddExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "1*2 + 3 - martha": * preceding $*}}
test parseExpr-13.1 {ParseMultiplyExpr procedure, valid LHS unary subexpr} testexprparser {
testexprparser {+2 * 3} -1
} {- {} 0 subexpr {+2 * 3} 7 operator * 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
test parseExpr-13.2 {ParseMultiplyExpr procedure, error in LHS unary subexpr} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {-12345678901234567890 * 3} -1} msg] $msg
} {1 {integer value too large to represent}}
|
| ︙ | ︙ | |||
337 338 339 340 341 342 343 |
} {- {} 0 subexpr {+-456 % 3} 9 operator % 0 subexpr +-456 5 operator + 0 subexpr -456 3 operator - 0 subexpr 456 1 text 456 0 subexpr 3 1 text 3 0 {}}
test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {--++5 / 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {-2 / 3 % 4} -1
} {- {} 0 subexpr {-2 / 3 % 4} 11 operator % 0 subexpr {-2 / 3} 7 operator / 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
| | > | > | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
} {- {} 0 subexpr {+-456 % 3} 9 operator % 0 subexpr +-456 5 operator + 0 subexpr -456 3 operator - 0 subexpr 456 1 text 456 0 subexpr 3 1 text 3 0 {}}
test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {--++5 / 12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {-2 / 3 % 4} -1
} {- {} 0 subexpr {-2 / 3 % 4} 11 operator % 0 subexpr {-2 / 3} 7 operator / 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
test parseExpr-13.9 {ParseMultiplyExpr procedure, error in RHS subexpression} \
-constraints testexprparser -body {
list [catch {testexprparser {++2 / 3 * martha} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "++2 / 3 * martha": * preceding $*}}
test parseExpr-14.1 {ParseUnaryExpr procedure, first token is unary operator} testexprparser {
testexprparser {+2} -1
} {- {} 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 {}}
test parseExpr-14.2 {ParseUnaryExpr procedure, first token is unary operator} testexprparser {
testexprparser {-2} -1
} {- {} 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 {}}
|
| ︙ | ︙ | |||
448 449 450 451 452 453 454 |
} {- {} 0 subexpr \{\ \ \\\n\ +123\ \} 4 word \{\ \ \\\n\ +123\ \} 3 text { } 0 backslash \\\n\ 0 text {+123 } 0 {}}
test parseExpr-15.22 {ParsePrimaryExpr procedure, primary is function call} testexprparser {
testexprparser {foo(123)} -1
} {- {} 0 subexpr foo(123) 3 operator foo 0 subexpr 123 1 text 123 0 {}}
test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {foo 12345678901234567890 123)} -1} msg] $msg
} {1 {integer value too large to represent}}
| | > | > | | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
} {- {} 0 subexpr \{\ \ \\\n\ +123\ \} 4 word \{\ \ \\\n\ +123\ \} 3 text { } 0 backslash \\\n\ 0 text {+123 } 0 {}}
test parseExpr-15.22 {ParsePrimaryExpr procedure, primary is function call} testexprparser {
testexprparser {foo(123)} -1
} {- {} 0 subexpr foo(123) 3 operator foo 0 subexpr 123 1 text 123 0 {}}
test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {foo 12345678901234567890 123)} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} \
-constraints testexprparser -body {
list [catch {testexprparser {foo 27.4 123)} -1} msg] $msg
} -match glob \
-result {1 {syntax error in expression "foo 27.4 123)": * preceding $*}}
test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {foo(12345678901234567890)} -1} msg] $msg
} {1 {integer value too large to represent}}
test parseExpr-15.26 {ParsePrimaryExpr procedure, function call, one arg} testexprparser {
testexprparser {foo(27*4)} -1
} {- {} 0 subexpr foo(27*4) 7 operator foo 0 subexpr 27*4 5 operator * 0 subexpr 27 1 text 27 0 subexpr 4 1 text 4 0 {}}
test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} testexprparser {
|
| ︙ | ︙ | |||
521 522 523 524 525 526 527 |
} {- {} 0 subexpr .123 1 text .123 0 {}}
test parseExpr-16.9 {GetLexeme procedure, double lexeme} {testexprparser nonPortable unix} {
testexprparser {nan} -1
} {- {} 0 subexpr nan 1 text nan 0 {}}
test parseExpr-16.10 {GetLexeme procedure, double lexeme} {testexprparser nonPortable unix} {
testexprparser {NaN} -1
} {- {} 0 subexpr NaN 1 text NaN 0 {}}
| | > > > | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
} {- {} 0 subexpr .123 1 text .123 0 {}}
test parseExpr-16.9 {GetLexeme procedure, double lexeme} {testexprparser nonPortable unix} {
testexprparser {nan} -1
} {- {} 0 subexpr nan 1 text nan 0 {}}
test parseExpr-16.10 {GetLexeme procedure, double lexeme} {testexprparser nonPortable unix} {
testexprparser {NaN} -1
} {- {} 0 subexpr NaN 1 text NaN 0 {}}
test parseExpr-16.11a {GetLexeme procedure, bad double lexeme too big} {testexprparser && !ieeeFloatingPoint} {
list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg
} {1 {floating-point value too large to represent}}
test parseExpr-16.11b {GetLexeme procedure, bad double lexeme too big} {testexprparser && ieeeFloatingPoint} {
list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg
} {0 {- {} 0 subexpr 123.e+99999999999999 1 text 123.e+99999999999999 0 {}}}
test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} testexprparser {
list [catch {testexprparser {123.4x56} -1} msg] $msg
} {1 {syntax error in expression "123.4x56": extra tokens at end of expression}}
test parseExpr-16.13 {GetLexeme procedure, lexeme is "["} testexprparser {
testexprparser {[foo]} -1
} {- {} 0 subexpr {[foo]} 1 command {[foo]} 0 {}}
test parseExpr-16.14 {GetLexeme procedure, lexeme is open brace} testexprparser {
|
| ︙ | ︙ |
Changes to tests/regexp.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: regexp, regsub # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1998 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: regexp, regsub
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1998 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: regexp.test,v 1.25.4.1 2005/06/13 01:46:50 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
catch {unset foo}
|
| ︙ | ︙ | |||
216 217 218 219 220 221 222 |
test regexp-6.8 {regexp errors} {
catch {unset f1}
set f1 44
list [catch {regexp abc abc f1(f2)} msg] $msg
} {1 {couldn't set variable "f1(f2)"}}
test regexp-6.9 {regexp errors, -start bad int check} {
list [catch {regexp -start bogus {^$} {}} msg] $msg
| | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
test regexp-6.8 {regexp errors} {
catch {unset f1}
set f1 44
list [catch {regexp abc abc f1(f2)} msg] $msg
} {1 {couldn't set variable "f1(f2)"}}
test regexp-6.9 {regexp errors, -start bad int check} {
list [catch {regexp -start bogus {^$} {}} msg] $msg
} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
test regexp-7.1 {basic regsub operation} {
list [regsub aa+ xaxaaaxaa 111&222 foo] $foo
} {1 xax111aaa222xaa}
test regexp-7.2 {basic regsub operation} {
list [regsub aa+ aaaxaa &111 foo] $foo
} {1 aaa111xaa}
|
| ︙ | ︙ | |||
373 374 375 376 377 378 379 |
test regexp-11.7 {regsub errors} {
catch {unset f1}
set f1 44
list [catch {regsub -nocase aaa aaa xxx f1(f2)} msg] $msg
} {1 {couldn't set variable "f1(f2)"}}
test regexp-11.8 {regsub errors, -start bad int check} {
list [catch {regsub -start bogus pattern string rep var} msg] $msg
| | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
test regexp-11.7 {regsub errors} {
catch {unset f1}
set f1 44
list [catch {regsub -nocase aaa aaa xxx f1(f2)} msg] $msg
} {1 {couldn't set variable "f1(f2)"}}
test regexp-11.8 {regsub errors, -start bad int check} {
list [catch {regsub -start bogus pattern string rep var} msg] $msg
} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
test regexp-11.9 {regsub without final variable name returns value} {
regsub b abaca X
} {aXaca}
test regexp-11.10 {regsub without final variable name returns value} {
regsub -all a abaca X
} {XbXcX}
test regexp-11.11 {regsub without final variable name returns value} {
|
| ︙ | ︙ | |||
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 |
test regexp-15.5 {regexp -start, over end of string} {
catch {unset x}
list [regexp -start [string length 1abc2de3] {\d} 1abc2de3 x] [info exists x]
} {0 0}
test regexp-15.6 {regexp -start, loss of ^$ behavior} {
list [regexp -start 2 {^$} {}]
} {0}
test regexp-16.1 {regsub -start} {
catch {unset x}
list [regsub -all -start 2 {\d} a1b2c3d4e5 {/&} x] $x
} {4 a1b/2c/3d/4e/5}
test regexp-16.2 {regsub -start} {
catch {unset x}
list [regsub -all -start -25 {z} hello {/&} x] $x
} {0 hello}
test regexp-16.3 {regsub -start} {
catch {unset x}
list [regsub -all -start 3 {z} hello {/&} x] $x
} {0 hello}
test regexp-16.4 {regsub -start, \A behavior} {
set out {}
lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x
lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x
} {5 /a/b/c/d/e 3 ab/c/d/e}
test regexp-17.1 {regexp -inline} {
regexp -inline b ababa
} {b}
test regexp-17.2 {regexp -inline} {
regexp -inline (b) ababa
} {b b}
| > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 513 514 515 516 517 518 519 520 |
test regexp-15.5 {regexp -start, over end of string} {
catch {unset x}
list [regexp -start [string length 1abc2de3] {\d} 1abc2de3 x] [info exists x]
} {0 0}
test regexp-15.6 {regexp -start, loss of ^$ behavior} {
list [regexp -start 2 {^$} {}]
} {0}
test regexp-15.7 {regexp -start, double option} {
regexp -start 2 -start 0 a abc
} 1
test regexp-15.8 {regexp -start, double option} {
regexp -start 0 -start 2 a abc
} 0
test regexp-15.9 {regexp -start, end relative index} {
catch {unset x}
list [regexp -start end {\d} 1abc2de3 x] [info exists x]
} {0 0}
test regexp-15.10 {regexp -start, end relative index} {
catch {unset x}
list [regexp -start end-1 {\d} 1abc2de3 x] [info exists x] $x
} {1 1 3}
test regexp-16.1 {regsub -start} {
catch {unset x}
list [regsub -all -start 2 {\d} a1b2c3d4e5 {/&} x] $x
} {4 a1b/2c/3d/4e/5}
test regexp-16.2 {regsub -start} {
catch {unset x}
list [regsub -all -start -25 {z} hello {/&} x] $x
} {0 hello}
test regexp-16.3 {regsub -start} {
catch {unset x}
list [regsub -all -start 3 {z} hello {/&} x] $x
} {0 hello}
test regexp-16.4 {regsub -start, \A behavior} {
set out {}
lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x
lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x
} {5 /a/b/c/d/e 3 ab/c/d/e}
test regexp-16.5 {regsub -start, double option} {
list [regsub -start 2 -start 0 a abc c x] $x
} {1 cbc}
test regexp-16.6 {regsub -start, double option} {
list [regsub -start 0 -start 2 a abc c x] $x
} {0 abc}
test regexp-16.7 {regexp -start, end relative index} {
list [regsub -start end a aaa b x] $x
} {0 aaa}
test regexp-16.8 {regexp -start, end relative index} {
list [regsub -start end-1 a aaa b x] $x
} {1 aab}
test regexp-17.1 {regexp -inline} {
regexp -inline b ababa
} {b}
test regexp-17.2 {regexp -inline} {
regexp -inline (b) ababa
} {b b}
|
| ︙ | ︙ |
Changes to tests/regexpComp.test.
| ︙ | ︙ | |||
297 298 299 300 301 302 303 |
list [catch {regexp abc abc f1(f2)} msg] $msg
}
} {1 {couldn't set variable "f1(f2)"}}
test regexpComp-6.9 {regexp errors, -start bad int check} {
evalInProc {
list [catch {regexp -start bogus {^$} {}} msg] $msg
}
| | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
list [catch {regexp abc abc f1(f2)} msg] $msg
}
} {1 {couldn't set variable "f1(f2)"}}
test regexpComp-6.9 {regexp errors, -start bad int check} {
evalInProc {
list [catch {regexp -start bogus {^$} {}} msg] $msg
}
} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
test regexpComp-7.1 {basic regsub operation} {
evalInProc {
list [regsub aa+ xaxaaaxaa 111&222 foo] $foo
}
} {1 xax111aaa222xaa}
test regexpComp-7.2 {basic regsub operation} {
|
| ︙ | ︙ | |||
538 539 540 541 542 543 544 |
list [catch {regsub -nocase aaa aaa xxx f1(f2)} msg] $msg
}
} {1 {couldn't set variable "f1(f2)"}}
test regexpComp-11.8 {regsub errors, -start bad int check} {
evalInProc {
list [catch {regsub -start bogus pattern string rep var} msg] $msg
}
| | | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
list [catch {regsub -nocase aaa aaa xxx f1(f2)} msg] $msg
}
} {1 {couldn't set variable "f1(f2)"}}
test regexpComp-11.8 {regsub errors, -start bad int check} {
evalInProc {
list [catch {regsub -start bogus pattern string rep var} msg] $msg
}
} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
# This test crashes on the Mac unless you increase the Stack Space to about 1
# Meg. This is probably bigger than most users want...
# 8.2.3 regexp reduced stack space requirements, but this should be
# tested again
test regexpComp-12.1 {Tcl_RegExpExec: large number of subexpressions} {macCrash} {
evalInProc {
|
| ︙ | ︙ |
Changes to tests/result.test.
| ︙ | ︙ | |||
104 105 106 107 108 109 110 111 112 113 114 |
catch {testseterrorcode \{}
llength $errorCode
} 1
test result-5.4 {Tcl_SetErrorCode - two args, list quoting} testseterrorcode {
catch {testseterrorcode {a b} c}
set errorCode
} {{a b} c}
# cleanup
::tcltest::cleanupTests
return
| > > > > > > > > > > > > > | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
catch {testseterrorcode \{}
llength $errorCode
} 1
test result-5.4 {Tcl_SetErrorCode - two args, list quoting} testseterrorcode {
catch {testseterrorcode {a b} c}
set errorCode
} {{a b} c}
::tcltest::testConstraint testreturn \
[expr {[info commands testreturn] != {}}]
test result-6.0 {Bug 1209759} -constraints testreturn -body {
# Might panic if bug is not fixed.
proc foo {} {testreturn}
foo
} -returnCodes ok -result {}
test result-6.1 {Bug 1209759} -constraints testreturn -body {
# Might panic if bug is not fixed.
proc foo {} {catch {return -level 2}; testreturn}
foo
} -returnCodes ok -result {}
# cleanup
::tcltest::cleanupTests
return
|
Changes to tests/safe.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # safe.test -- # # This file contains a collection of tests for safe Tcl, packages loading, # and using safe interpreters. Sourcing this file into tcl runs the tests # and generates output for errors. No output means no errors were found. # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# safe.test --
#
# This file contains a collection of tests for safe Tcl, packages loading,
# and using safe interpreters. Sourcing this file into tcl runs the tests
# and generates output for errors. No output means no errors were found.
#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: safe.test,v 1.18.2.1 2005/06/13 01:46:51 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
foreach i [interp slaves] {
|
| ︙ | ︙ |
Changes to tests/scan.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: scan # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: scan
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: scan.test,v 1.15.4.1 2005/06/13 01:46:51 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
::tcltest::testConstraint 64bitInts [expr {0x80000000 > 0}]
|
| ︙ | ︙ | |||
447 448 449 450 451 452 453 |
set a {}; set b {}; set c {}
list [scan "1. 47.6 2.e2 3.e-" "%f %*f %f %f" a b c] $a $b $c
} {3 1.0 200.0 3.0}
test scan-6.5 {floating-point scanning} {
set a {}; set b {}; set c {}; set d {}
list [scan "4.6 99999.7 876.43e-1 118" "%f %f %f %e" a b c d] $a $b $c $d
} {4 4.6 99999.7 87.643 118.0}
| | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
set a {}; set b {}; set c {}
list [scan "1. 47.6 2.e2 3.e-" "%f %*f %f %f" a b c] $a $b $c
} {3 1.0 200.0 3.0}
test scan-6.5 {floating-point scanning} {
set a {}; set b {}; set c {}; set d {}
list [scan "4.6 99999.7 876.43e-1 118" "%f %f %f %e" a b c d] $a $b $c $d
} {4 4.6 99999.7 87.643 118.0}
test scan-6.6 {floating-point scanning} {
set a {}; set b {}; set c {}; set d {}
list [scan "1.2345 697.0e-3 124 .00005" "%f %e %f %e" a b c d] $a $b $c $d
} {4 1.2345 0.697 124.0 5e-5}
test scan-6.7 {floating-point scanning} {
set a {}; set b {}; set c {}; set d {}
list [scan "4.6abc" "%f %f %f %f" a b c d] $a $b $c $d
} {1 4.6 {} {} {}}
test scan-6.8 {floating-point scanning} {
set a {}; set b {}; set c {}; set d {}
list [scan "4.6 5.2" "%f %f %f %f" a b c d] $a $b $c $d
|
| ︙ | ︙ |
Changes to tests/string.test.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: string.test,v 1.43.4.1 2005/06/13 01:46:51 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
# Some tests require the testobj command
testConstraint testobj [expr {[info commands testobj] != {}}]
testConstraint testindexobj [expr {[info commands testindexobj] != {}}]
test string-1.1 {error conditions} {
list [catch {string gorp a b} msg] $msg
} {1 {bad option "gorp": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
test string-1.2 {error conditions} {
list [catch {string} msg] $msg
} {1 {wrong # args: should be "string option arg ?arg ...?"}}
|
| ︙ | ︙ | |||
171 172 173 174 175 176 177 |
} 1
test string-4.1 {string first, too few args} {
list [catch {string first a} msg] $msg
} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
test string-4.2 {string first, bad args} {
list [catch {string first a b c} msg] $msg
| | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
} 1
test string-4.1 {string first, too few args} {
list [catch {string first a} msg] $msg
} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
test string-4.2 {string first, bad args} {
list [catch {string first a b c} msg] $msg
} {1 {bad index "c": must be integer?[+-]integer? or end?[+-]integer?}}
test string-4.3 {string first, too many args} {
list [catch {string first a b 5 d} msg] $msg
} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
test string-4.4 {string first} {
string first bq abcdefgbcefgbqrs
} 12
test string-4.5 {string first} {
|
| ︙ | ︙ | |||
236 237 238 239 240 241 242 |
string index abcde 5
} {}
test string-5.6 {string index} {
list [catch {string index abcde -10} msg] $msg
} {0 {}}
test string-5.7 {string index} {
list [catch {string index a xyz} msg] $msg
| | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
string index abcde 5
} {}
test string-5.6 {string index} {
list [catch {string index abcde -10} msg] $msg
} {0 {}}
test string-5.7 {string index} {
list [catch {string index a xyz} msg] $msg
} {1 {bad index "xyz": must be integer?[+-]integer? or end?[+-]integer?}}
test string-5.8 {string index} {
string index abc end
} c
test string-5.9 {string index} {
string index abc end-1
} b
test string-5.10 {string index, unicode} {
|
| ︙ | ︙ | |||
271 272 273 274 275 276 277 |
test string-5.16 {string index, bytearray object with string obj shimmering} {
set str "0123456789\x00 abcdedfghi"
binary scan $str H* dump
string compare [string index $str 10] \x00
} 0
test string-5.17 {string index, bad integer} {
list [catch {string index "abc" 08} msg] $msg
| | | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
test string-5.16 {string index, bytearray object with string obj shimmering} {
set str "0123456789\x00 abcdedfghi"
binary scan $str H* dump
string compare [string index $str 10] \x00
} 0
test string-5.17 {string index, bad integer} {
list [catch {string index "abc" 08} msg] $msg
} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test string-5.18 {string index, bad integer} {
list [catch {string index "abc" end-00289} msg] $msg
} {1 {bad index "end-00289": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test string-5.19 {string index, bytearray object out of bounds} {
string index [binary format I* {0x50515253 0x52}] -1
} {}
test string-5.20 {string index, bytearray object out of bounds} {
string index [binary format I* {0x50515253 0x52}] 20
} {}
|
| ︙ | ︙ | |||
405 406 407 408 409 410 411 |
test string-6.36 {string is double, false} {
list [string is double -fail var "\n"] $var
} {0 0}
test string-6.37 {string is double, false on int overflow} {
# Make it the largest int recognizable, with one more digit for overflow
list [string is double -fail var [largest_int]0] $var
} {0 -1}
| | < < < | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
test string-6.36 {string is double, false} {
list [string is double -fail var "\n"] $var
} {0 0}
test string-6.37 {string is double, false on int overflow} {
# Make it the largest int recognizable, with one more digit for overflow
list [string is double -fail var [largest_int]0] $var
} {0 -1}
# string-6.38 removed, underflow on input is no longer an error.
test string-6.39 {string is double, false} {nonPortable} {
# This test is non-portable because IRIX thinks
# that .e1 is a valid double - this is really a bug
# on IRIX as .e1 should NOT be a valid double
list [string is double -fail var .e1] $var
} {0 0}
|
| ︙ | ︙ | |||
662 663 664 665 666 667 668 |
catch {rename largest_int {}}
test string-7.1 {string last, too few args} {
list [catch {string last a} msg] $msg
} {1 {wrong # args: should be "string last subString string ?startIndex?"}}
test string-7.2 {string last, bad args} {
list [catch {string last a b c} msg] $msg
| | | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 |
catch {rename largest_int {}}
test string-7.1 {string last, too few args} {
list [catch {string last a} msg] $msg
} {1 {wrong # args: should be "string last subString string ?startIndex?"}}
test string-7.2 {string last, bad args} {
list [catch {string last a b c} msg] $msg
} {1 {bad index "c": must be integer?[+-]integer? or end?[+-]integer?}}
test string-7.3 {string last, too many args} {
list [catch {string last a b c d} msg] $msg
} {1 {wrong # args: should be "string last subString string ?startIndex?"}}
test string-7.4 {string last} {
string la xxx xxxx123xx345x678
} 1
test string-7.5 {string last} {
|
| ︙ | ︙ | |||
804 805 806 807 808 809 810 |
test string-10.19 {string map, empty arguments} {
string map -nocase {{} abc f bar {} def} foo
} baroo
test string-10.20 {string map, dictionaries can alter map ordering} {
set map {aa X a Y}
list [string map [dict create aa X a Y] aaa] [string map $map aaa] [dict size $map] [string map $map aaa]
} {YYY XY 2 XY}
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 |
test string-10.19 {string map, empty arguments} {
string map -nocase {{} abc f bar {} def} foo
} baroo
test string-10.20 {string map, dictionaries can alter map ordering} {
set map {aa X a Y}
list [string map [dict create aa X a Y] aaa] [string map $map aaa] [dict size $map] [string map $map aaa]
} {YYY XY 2 XY}
test string-10.21 {string map, ABR checks} {
string map {longstring foob} long
} long
test string-10.22 {string map, ABR checks} {
string map {long foob} long
} foob
test string-10.23 {string map, ABR checks} {
string map {lon foob} long
} foobg
test string-10.24 {string map, ABR checks} {
string map {lon foob} longlo
} foobglo
test string-10.25 {string map, ABR checks} {
string map {lon foob} longlon
} foobgfoob
test string-10.26 {string map, ABR checks} {
string map {longstring foob longstring bar} long
} long
test string-10.27 {string map, ABR checks} {
string map {long foob longstring bar} long
} foob
test string-10.28 {string map, ABR checks} {
string map {lon foob longstring bar} long
} foobg
test string-10.29 {string map, ABR checks} {
string map {lon foob longstring bar} longlo
} foobglo
test string-10.30 {string map, ABR checks} {
string map {lon foob longstring bar} longlon
} foobgfoob
test string-10.31 {string map, nasty sharing crash from [Bug 1018562]} {
set a {a b}
string map $a $a
} {b b}
test string-11.1 {string match, too few args} {
list [catch {string match a} msg] $msg
} {1 {wrong # args: should be "string match ?-nocase? pattern string"}}
|
| ︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 |
test string-12.4 {string range} {
string range abcdefghijklmnop 2 14
} {cdefghijklmno}
test string-12.5 {string range, last > length} {
string range abcdefghijklmnop 7 1000
} {hijklmnop}
test string-12.6 {string range} {
| | | | | | 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 |
test string-12.4 {string range} {
string range abcdefghijklmnop 2 14
} {cdefghijklmno}
test string-12.5 {string range, last > length} {
string range abcdefghijklmnop 7 1000
} {hijklmnop}
test string-12.6 {string range} {
string range abcdefghijklmnop 10 end
} {klmnop}
test string-12.7 {string range, last < first} {
string range abcdefghijklmnop 10 9
} {}
test string-12.8 {string range, first < 0} {
string range abcdefghijklmnop -3 2
} {abc}
test string-12.9 {string range} {
string range abcdefghijklmnop -3 -2
} {}
test string-12.10 {string range} {
string range abcdefghijklmnop 1000 1010
} {}
test string-12.11 {string range} {
string range abcdefghijklmnop -100 end
} {abcdefghijklmnop}
test string-12.12 {string range} {
list [catch {string range abc abc 1} msg] $msg
} {1 {bad index "abc": must be integer?[+-]integer? or end?[+-]integer?}}
test string-12.13 {string range} {
list [catch {string range abc 1 eof} msg] $msg
} {1 {bad index "eof": must be integer?[+-]integer? or end?[+-]integer?}}
test string-12.14 {string range} {
string range abcdefghijklmnop end-1 end
} {op}
test string-12.15 {string range} {
string range abcdefghijklmnop end 1000
} {p}
test string-12.16 {string range} {
string range abcdefghijklmnop end end-1
} {}
test string-12.17 {string range, unicode} {
string range ab\u7266cdefghijklmnop 5 5
} e
|
| ︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 |
test string-14.5 {string replace} {
string replace abcdefghijklmnop 2 14
} {abp}
test string-14.6 {string replace} {
string replace abcdefghijklmnop 7 1000
} {abcdefg}
test string-14.7 {string replace} {
| | | | | | | 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 1201 1202 1203 1204 1205 1206 1207 |
test string-14.5 {string replace} {
string replace abcdefghijklmnop 2 14
} {abp}
test string-14.6 {string replace} {
string replace abcdefghijklmnop 7 1000
} {abcdefg}
test string-14.7 {string replace} {
string replace abcdefghijklmnop 10 end
} {abcdefghij}
test string-14.8 {string replace} {
string replace abcdefghijklmnop 10 9
} {abcdefghijklmnop}
test string-14.9 {string replace} {
string replace abcdefghijklmnop -3 2
} {defghijklmnop}
test string-14.10 {string replace} {
string replace abcdefghijklmnop -3 -2
} {abcdefghijklmnop}
test string-14.11 {string replace} {
string replace abcdefghijklmnop 1000 1010
} {abcdefghijklmnop}
test string-14.12 {string replace} {
string replace abcdefghijklmnop -100 end
} {}
test string-14.13 {string replace} {
list [catch {string replace abc abc 1} msg] $msg
} {1 {bad index "abc": must be integer?[+-]integer? or end?[+-]integer?}}
test string-14.14 {string replace} {
list [catch {string replace abc 1 eof} msg] $msg
} {1 {bad index "eof": must be integer?[+-]integer? or end?[+-]integer?}}
test string-14.15 {string replace} {
string replace abcdefghijklmnop end-10 end-2 NEW
} {abcdeNEWop}
test string-14.16 {string replace} {
string replace abcdefghijklmnop 0 end foo
} {foo}
test string-14.17 {string replace} {
string replace abcdefghijklmnop end end-1
} {abcdefghijklmnop}
test string-15.1 {string tolower too few args} {
list [catch {string tolower} msg] $msg
} {1 {wrong # args: should be "string tolower string ?first? ?last?"}}
test string-15.2 {string tolower bad args} {
list [catch {string tolower a b} msg] $msg
} {1 {bad index "b": must be integer?[+-]integer? or end?[+-]integer?}}
test string-15.3 {string tolower too many args} {
list [catch {string tolower ABC 1 end oops} msg] $msg
} {1 {wrong # args: should be "string tolower string ?first? ?last?"}}
test string-15.4 {string tolower} {
string tolower ABCDeF
} {abcdef}
test string-15.5 {string tolower} {
|
| ︙ | ︙ | |||
1196 1197 1198 1199 1200 1201 1202 |
} "abcabc\xe7\xe7"
test string-16.1 {string toupper} {
list [catch {string toupper} msg] $msg
} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
test string-16.2 {string toupper} {
list [catch {string toupper a b} msg] $msg
| | | 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 |
} "abcabc\xe7\xe7"
test string-16.1 {string toupper} {
list [catch {string toupper} msg] $msg
} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
test string-16.2 {string toupper} {
list [catch {string toupper a b} msg] $msg
} {1 {bad index "b": must be integer?[+-]integer? or end?[+-]integer?}}
test string-16.3 {string toupper} {
list [catch {string toupper a 1 end oops} msg] $msg
} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
test string-16.4 {string toupper} {
string toupper abCDEf
} {ABCDEF}
test string-16.5 {string toupper} {
|
| ︙ | ︙ | |||
1227 1228 1229 1230 1231 1232 1233 |
} "ABCABC\xc7\xc7"
test string-17.1 {string totitle} {
list [catch {string totitle} msg] $msg
} {1 {wrong # args: should be "string totitle string ?first? ?last?"}}
test string-17.2 {string totitle} {
list [catch {string totitle a b} msg] $msg
| | | 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 |
} "ABCABC\xc7\xc7"
test string-17.1 {string totitle} {
list [catch {string totitle} msg] $msg
} {1 {wrong # args: should be "string totitle string ?first? ?last?"}}
test string-17.2 {string totitle} {
list [catch {string totitle a b} msg] $msg
} {1 {bad index "b": must be integer?[+-]integer? or end?[+-]integer?}}
test string-17.3 {string totitle} {
string totitle abCDEf
} {Abcdef}
test string-17.4 {string totitle} {
string totitle "abc xYz"
} {Abc xyz}
test string-17.5 {string totitle} {
|
| ︙ | ︙ | |||
1309 1310 1311 1312 1313 1314 1315 |
list [catch {string wordend a} msg] $msg
} {1 {wrong # args: should be "string wordend string index"}}
test string-21.2 {string wordend} {
list [catch {string wordend a b c} msg] $msg
} {1 {wrong # args: should be "string wordend string index"}}
test string-21.3 {string wordend} {
list [catch {string wordend a gorp} msg] $msg
| | | 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 |
list [catch {string wordend a} msg] $msg
} {1 {wrong # args: should be "string wordend string index"}}
test string-21.2 {string wordend} {
list [catch {string wordend a b c} msg] $msg
} {1 {wrong # args: should be "string wordend string index"}}
test string-21.3 {string wordend} {
list [catch {string wordend a gorp} msg] $msg
} {1 {bad index "gorp": must be integer?[+-]integer? or end?[+-]integer?}}
test string-21.4 {string wordend} {
string wordend abc. -1
} 3
test string-21.5 {string wordend} {
string wordend abc. 100
} 4
test string-21.6 {string wordend} {
|
| ︙ | ︙ | |||
1355 1356 1357 1358 1359 1360 1361 |
list [catch {string wordstart a} msg] $msg
} {1 {wrong # args: should be "string wordstart string index"}}
test string-22.3 {string wordstart} {
list [catch {string wordstart a b c} msg] $msg
} {1 {wrong # args: should be "string wordstart string index"}}
test string-22.4 {string wordstart} {
list [catch {string wordstart a gorp} msg] $msg
| | | 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 |
list [catch {string wordstart a} msg] $msg
} {1 {wrong # args: should be "string wordstart string index"}}
test string-22.3 {string wordstart} {
list [catch {string wordstart a b c} msg] $msg
} {1 {wrong # args: should be "string wordstart string index"}}
test string-22.4 {string wordstart} {
list [catch {string wordstart a gorp} msg] $msg
} {1 {bad index "gorp": must be integer?[+-]integer? or end?[+-]integer?}}
test string-22.5 {string wordstart} {
string wordstart "one two three_words" 400
} 8
test string-22.6 {string wordstart} {
string wordstart "one two three_words" 2
} 0
test string-22.7 {string wordstart} {
|
| ︙ | ︙ | |||
1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 |
} 4
test string-22.12 {string wordstart, unicode} {
string wordstart "ab\uc700\uc700 cdef ghi" 12
} 10
test string-22.13 {string wordstart, unicode} {
string wordstart "\uc700\uc700 abc" 8
} 3
# cleanup
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
| > > > > > > | 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 |
} 4
test string-22.12 {string wordstart, unicode} {
string wordstart "ab\uc700\uc700 cdef ghi" 12
} 10
test string-22.13 {string wordstart, unicode} {
string wordstart "\uc700\uc700 abc" 8
} 3
test string-23.0 {string is boolean, Bug 1187123} testindexobj {
set x 5
catch {testindexobj $x foo bar soom}
string is boolean $x
} 0
# cleanup
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
|
Changes to tests/stringComp.test.
| ︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Copyright (c) 2001 by ActiveState Corporation. # Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#
# Copyright (c) 2001 by ActiveState Corporation.
# Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: stringComp.test,v 1.8.4.1 2005/06/13 01:46:51 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
# Some tests require the testobj command
|
| ︙ | ︙ | |||
222 223 224 225 226 227 228 |
test stringComp-4.1 {string first, too few args} {
proc foo {} {string first a}
list [catch {foo} msg] $msg
} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
test stringComp-4.2 {string first, bad args} {
proc foo {} {string first a b c}
list [catch {foo} msg] $msg
| | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
test stringComp-4.1 {string first, too few args} {
proc foo {} {string first a}
list [catch {foo} msg] $msg
} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
test stringComp-4.2 {string first, bad args} {
proc foo {} {string first a b c}
list [catch {foo} msg] $msg
} {1 {bad index "c": must be integer?[+-]integer? or end?[+-]integer?}}
test stringComp-4.3 {string first, too many args} {
proc foo {} {string first a b 5 d}
list [catch {foo} msg] $msg
} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
test stringComp-4.4 {string first} {
proc foo {} {string first bq abcdefgbcefgbqrs}
foo
|
| ︙ | ︙ | |||
299 300 301 302 303 304 305 |
test stringComp-5.6 {string index} {
proc foo {} {string index abcde -10}
list [catch {foo} msg] $msg
} {0 {}}
test stringComp-5.7 {string index} {
proc foo {} {string index a xyz}
list [catch {foo} msg] $msg
| | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
test stringComp-5.6 {string index} {
proc foo {} {string index abcde -10}
list [catch {foo} msg] $msg
} {0 {}}
test stringComp-5.7 {string index} {
proc foo {} {string index a xyz}
list [catch {foo} msg] $msg
} {1 {bad index "xyz": must be integer?[+-]integer? or end?[+-]integer?}}
test stringComp-5.8 {string index} {
proc foo {} {string index abc end}
foo
} c
test stringComp-5.9 {string index} {
proc foo {} {string index abc end-1}
foo
|
| ︙ | ︙ | |||
348 349 350 351 352 353 354 |
string compare [string index $str 10] \x00
}
foo
} 0
test stringComp-5.17 {string index, bad integer} {
proc foo {} {string index "abc" 08}
list [catch {foo} msg] $msg
| | | | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
string compare [string index $str 10] \x00
}
foo
} 0
test stringComp-5.17 {string index, bad integer} {
proc foo {} {string index "abc" 08}
list [catch {foo} msg] $msg
} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test stringComp-5.18 {string index, bad integer} {
proc foo {} {string index "abc" end-00289}
list [catch {foo} msg] $msg
} {1 {bad index "end-00289": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test stringComp-5.19 {string index, bytearray object out of bounds} {
proc foo {} {string index [binary format I* {0x50515253 0x52}] -1}
foo
} {}
test stringComp-5.20 {string index, bytearray object out of bounds} {
proc foo {} {string index [binary format I* {0x50515253 0x52}] 20}
foo
|
| ︙ | ︙ |
Changes to tests/switch.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Commands covered: switch # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Commands covered: switch
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: switch.test,v 1.10.4.1 2005/06/13 01:46:51 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
test switch-1.1 {simple patterns} {
|
| ︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
} 2
test switch-1.6 {simple patterns} {
switch default a {format 1} default {format 2} c {format 3} default {format 4}
} 2
test switch-1.7 {simple patterns} {
switch x a {format 1} default {format 2} c {format 3} default {format 4}
} 4
test switch-2.1 {single-argument form for pattern/command pairs} {
switch b {
a {format 1}
b {format 2}
default {format 6}
}
| > > > > > > > > > > > > | 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 |
} 2
test switch-1.6 {simple patterns} {
switch default a {format 1} default {format 2} c {format 3} default {format 4}
} 2
test switch-1.7 {simple patterns} {
switch x a {format 1} default {format 2} c {format 3} default {format 4}
} 4
test switch-1.8 {simple patterns with -nocase} {
switch -nocase b a {format 1} b {format 2} c {format 3} default {format 4}
} 2
test switch-1.9 {simple patterns with -nocase} {
switch -nocase B a {format 1} b {format 2} c {format 3} default {format 4}
} 2
test switch-1.10 {simple patterns with -nocase} {
switch -nocase b a {format 1} B {format 2} c {format 3} default {format 4}
} 2
test switch-1.11 {simple patterns with -nocase} {
switch -nocase x a {format 1} default {format 2} c {format 3} default {format 4}
} 4
test switch-2.1 {single-argument form for pattern/command pairs} {
switch b {
a {format 1}
b {format 2}
default {format 6}
}
|
| ︙ | ︙ | |||
85 86 87 88 89 90 91 |
-* {concat glob}
-glob {concat exact}
default {concat none}
}
} exact
test switch-3.6 {-exact vs. -glob vs. -regexp} {
list [catch {switch -foo a b c} msg] $msg
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
-* {concat glob}
-glob {concat exact}
default {concat none}
}
} exact
test switch-3.6 {-exact vs. -glob vs. -regexp} {
list [catch {switch -foo a b c} msg] $msg
} {1 {bad option "-foo": must be -exact, -glob, -indexvar, -matchvar, -nocase, -regexp, or --}}
test switch-3.7 {-exact vs. -glob vs. -regexp with -nocase} {
switch -exact -nocase aaaab {
^a*b$ {concat regexp}
*b {concat glob}
aaaab {concat exact}
default {concat none}
}
} exact
test switch-3.8 {-exact vs. -glob vs. -regexp with -nocase} {
switch -regexp -nocase aaaab {
^a*b$ {concat regexp}
*b {concat glob}
aaaab {concat exact}
default {concat none}
}
} regexp
test switch-3.9 {-exact vs. -glob vs. -regexp with -nocase} {
switch -glob -nocase aaaab {
^a*b$ {concat regexp}
*b {concat glob}
aaaab {concat exact}
default {concat none}
}
} glob
test switch-3.10 {-exact vs. -glob vs. -regexp with -nocase} {
switch -nocase aaaab {^a*b$} {concat regexp} *b {concat glob} \
aaaab {concat exact} default {concat none}
} exact
test switch-3.11 {-exact vs. -glob vs. -regexp with -nocase} {
switch -nocase -- -glob {
^g.*b$ {concat regexp}
-* {concat glob}
-glob {concat exact}
default {concat none}
}
} exact
test switch-4.1 {error in executed command} {
list [catch {switch a a {error "Just a test"} default {format 1}} msg] \
$msg $errorInfo
} {1 {Just a test} {Just a test
while executing
"error "Just a test""
|
| ︙ | ︙ | |||
252 253 254 255 256 257 258 259 260 261 |
set x 0; set y 0
foreach c [split $s {}] {
switch -glob -- $c {
a {incr x}
b {incr y}
}
}
return $x,$y
}
proc iswtest-glob s {
| > > > > | > > > > > > > | > > > > | > > > > > > > | > > > > | > > > > > > > > | < < < | > > > > > > > | > > > > > > > > | | | | | | | | | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
set x 0; set y 0
foreach c [split $s {}] {
switch -glob -- $c {
a {incr x}
b {incr y}
}
}
set x [expr {$x*100}]; set y [expr {$y*100}]
foreach c [split $s {}] {
switch -glob -- $c a {incr x} b {incr y}
}
return $x,$y
}
proc iswtest-glob s {
set x 0; set y 0; set switch switch
foreach c [split $s {}] {
$switch -glob -- $c {
a {incr x}
b {incr y}
}
}
set x [expr {$x*100}]; set y [expr {$y*100}]
foreach c [split $s {}] {
$switch -glob -- $c a {incr x} b {incr y}
}
return $x,$y
}
proc cswtest-exact s {
set x 0; set y 0
foreach c [split $s {}] {
switch -exact -- $c {
a {incr x}
b {incr y}
}
}
set x [expr {$x*100}]; set y [expr {$y*100}]
foreach c [split $s {}] {
switch -exact -- $c a {incr x} b {incr y}
}
return $x,$y
}
proc iswtest-exact s {
set x 0; set y 0; set switch switch
foreach c [split $s {}] {
$switch -exact -- $c {
a {incr x}
b {incr y}
}
}
set x [expr {$x*100}]; set y [expr {$y*100}]
foreach c [split $s {}] {
$switch -exact -- $c a {incr x} b {incr y}
}
return $x,$y
}
proc cswtest2-glob s {
set x 0; set y 0; set z 0
foreach c [split $s {}] {
switch -glob -- $c {
a {incr x}
b {incr y}
default {incr z}
}
}
set x [expr {$x*100}]; set y [expr {$y*100}]; set z [expr {$z*100}]
foreach c [split $s {}] {
switch -glob -- $c a {incr x} b {incr y} default {incr z}
}
return $x,$y,$z
}
proc iswtest2-glob s {
set x 0; set y 0; set z 0; set switch switch
foreach c [split $s {}] {
$switch -glob -- $c {
a {incr x}
b {incr y}
default {incr z}
}
}
set x [expr {$x*100}]; set y [expr {$y*100}]; set z [expr {$z*100}]
foreach c [split $s {}] {
$switch -glob -- $c a {incr x} b {incr y} default {incr z}
}
return $x,$y,$z
}
proc cswtest2-exact s {
set x 0; set y 0; set z 0
foreach c [split $s {}] {
switch -exact -- $c {
a {incr x}
b {incr y}
default {incr z}
}
}
set x [expr {$x*100}]; set y [expr {$y*100}]; set z [expr {$z*100}]
foreach c [split $s {}] {
switch -exact -- $c a {incr x} b {incr y} default {incr z}
}
return $x,$y,$z
}
proc iswtest2-exact s {
set x 0; set y 0; set z 0; set switch switch
foreach c [split $s {}] {
$switch -exact -- $c {
a {incr x}
b {incr y}
default {incr z}
}
}
set x [expr {$x*100}]; set y [expr {$y*100}]; set z [expr {$z*100}]
foreach c [split $s {}] {
$switch -exact -- $c a {incr x} b {incr y} default {incr z}
}
return $x,$y,$z
}
test switch-10.7 {comparison of compiled and interpreted behaviour of switch, exact matching} {
cswtest-exact abcb
} [iswtest-exact abcb]
test switch-10.8 {comparison of compiled and interpreted behaviour of switch, glob matching} {
cswtest-glob abcb
} [iswtest-glob abcb]
test switch-10.9 {comparison of compiled and interpreted behaviour of switch, exact matching with default} {
cswtest2-exact abcb
} [iswtest2-exact abcb]
test switch-10.10 {comparison of compiled and interpreted behaviour of switch, glob matching with default} {
cswtest2-glob abcb
} [iswtest2-glob abcb]
proc cswtest-default-exact {x} {
switch -- $x {
a* {return b}
aa {return c}
default {return d}
}
}
|
| ︙ | ︙ |
Changes to tests/tcltest.test.
1 2 3 4 5 6 7 8 | # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2000 by Ajuba Solutions # All rights reserved. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2000 by Ajuba Solutions # All rights reserved. # # RCS: @(#) $Id: tcltest.test,v 1.51.2.1 2005/06/13 01:46:51 msofer Exp $ # Note that there are several places where the value of # tcltest::currentFailure is stored/reset in the -setup/-cleanup # of a test that has a body that runs [test] that will fail. # This is a workaround of using the same tcltest code that we are # testing to run the test itself. Ditto on things like [verbose]. # |
| ︙ | ︙ |
Changes to tests/unixInit.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # The file tests the functions in the tclUnixInit.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 by Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# The file tests the functions in the tclUnixInit.c file.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1997 by Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: unixInit.test,v 1.45.2.1 2005/06/13 01:46:51 msofer Exp $
package require tcltest 2.2
namespace import -force ::tcltest::*
unset -nocomplain path
catch {set oldlang $env(LANG)}
set env(LANG) C
test unixInit-1.1 {TclpInitPlatform: ignore SIGPIPE} {unix stdio} {
set x {}
|
| ︙ | ︙ | |||
88 89 90 91 92 93 94 |
} then {
subst "OK"
} else {
subst "Expected: `[list 127.0.0.1 localhost $port]', Got `$result'"
}
} {OK}
| < < < < < < < < | < | < | < < < < | < < < > | < | < > | < < | 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 |
} then {
subst "OK"
} else {
subst "Expected: `[list 127.0.0.1 localhost $port]', Got `$result'"
}
} {OK}
# The unixInit-2.* tests were written to test the internal routine,
# TclpInitLibraryPath. That routine no longer does the things it used
# to do so those tests are obsolete. Skip them.
skip [concat [skip] unixInit-2.*]
test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} {
set origDir [testgetdefenc]
testsetdefenc slappy
set path [testgetdefenc]
testsetdefenc $origDir
set path
} {slappy}
test unixInit-2.1 {TclpInitLibraryPath: value of installLib, developLib} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
unset env(TCL_LIBRARY)
}
} -body {
set path [getlibpath]
|
| ︙ | ︙ | |||
144 145 146 147 148 149 150 |
set x
} -cleanup {
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result {0 0}
| > | < < > | < < > | < < | < > | < < | 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 |
set x
} -cleanup {
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result {0 0}
test unixInit-2.2 {TclpInitLibraryPath: TCL_LIBRARY} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
} -body {
# ((str != NULL) && (str[0] != '\0'))
set env(TCL_LIBRARY) sparkly
set path [getlibpath]
unset env(TCL_LIBRARY)
lindex $path 0
} -cleanup {
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result "sparkly"
test unixInit-2.3 {TclpInitLibraryPath: TCL_LIBRARY wrong version} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
} -body {
# ((pathc > 0) && (strcasecmp(installLib + 4, pathv[pathc - 1]) != 0))
set env(TCL_LIBRARY) /a/b/tcl1.7
set path [getlibpath]
unset env(TCL_LIBRARY)
lrange $path 0 1
} -cleanup {
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result [list /a/b/tcl1.7 /a/b/tcl[info tclversion]]
test unixInit-2.4 {TclpInitLibraryPath: TCL_LIBRARY: INTL} -setup {
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
} -body {
# Child process translates env variable from native encoding.
set env(TCL_LIBRARY) "\xa7"
set x [lindex [getlibpath] 0]
unset env(TCL_LIBRARY)
unset env(LANG)
set x
} -cleanup {
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result "\xa7"
test unixInit-2.5 {TclpInitLibraryPath: compiled-in library path} {
# cannot test
} {}
test unixInit-2.6 {TclpInitLibraryPath: executable relative} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
set env(TCL_LIBRARY) [info library]
makeDirectory tmp
makeDirectory [file join tmp sparkly]
|
| ︙ | ︙ | |||
244 245 246 247 248 249 250 |
unset env(TCL_LIBRARY)
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result [list [temporaryDirectory]/tmp/sparkly/lib/tcl[info tclversion] [temporaryDirectory]/tmp/lib/tcl[info tclversion]]
| | < > < < < | < < | 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 |
unset env(TCL_LIBRARY)
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result [list [temporaryDirectory]/tmp/sparkly/lib/tcl[info tclversion] [temporaryDirectory]/tmp/lib/tcl[info tclversion]]
test unixInit-2.7 {TclpInitLibraryPath: compiled-in library path} {
# would need test command to get defaultLibDir and compare it to
# [lindex $auto_path end]
} {}
#
# The following two tests write to the directory /tmp/sparkly instead
# of to [temporaryDirectory]. This is because the failures tested by
# these tests need paths near the "root" of the file system to present
# themselves.
#
test unixInit-2.8 {TclpInitLibraryPath: all absolute pathtype} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
set env(TCL_LIBRARY) [info library]
# Checking for Bug 219416
# When a program that embeds the Tcl library, like tcltest, is
|
| ︙ | ︙ | |||
321 322 323 324 325 326 327 |
if {$deletelib} {file delete -force /tmp/lib}
unset env(TCL_LIBRARY)
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result 1
| | | < < | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
if {$deletelib} {file delete -force /tmp/lib}
unset env(TCL_LIBRARY)
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result 1
test unixInit-2.9 {TclpInitLibraryPath: paths relative to executable} -setup {
# Checking for Bug 438014
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
set env(TCL_LIBRARY) [info library]
file delete -force /tmp/sparkly
|
| ︙ | ︙ | |||
351 352 353 354 355 356 357 |
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result [list /tmp/lib/tcl[info tclversion] /lib/tcl[info tclversion] \
/tmp/library /library /tcl[info patchlevel]/library]
| | < < | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
if {[info exists oldlibrary]} {
set env(TCL_LIBRARY) $oldlibrary
unset oldlibrary
}
} -result [list /tmp/lib/tcl[info tclversion] /lib/tcl[info tclversion] \
/tmp/library /library /tcl[info patchlevel]/library]
test unixInit-2.10 {TclpInitLibraryPath: executable relative} -setup {
unset -nocomplain oldlibrary
if {[info exists env(TCL_LIBRARY)]} {
set oldlibrary $env(TCL_LIBRARY)
}
set env(TCL_LIBRARY) [info library]
set tmpDir [makeDirectory tmp]
set sparklyDir [makeDirectory sparkly $tmpDir]
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 |
test unixInit-6.1 {Tcl_SourceRCFile} {emptyTest unix} {
} {}
test unixInit-7.1 {closed standard channel: Bug 772288} -constraints {
unix stdio
} -body {
set tclsh [interpreter]
| | | | | | | 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 |
test unixInit-6.1 {Tcl_SourceRCFile} {emptyTest unix} {
} {}
test unixInit-7.1 {closed standard channel: Bug 772288} -constraints {
unix stdio
} -body {
set tclsh [interpreter]
set crash [makeFile {puts [open /dev/null]} crash.tcl]
set crashtest [makeFile "
close stdin
[list exec $tclsh $crash]
" crashtest.tcl]
exec $tclsh $crashtest
} -cleanup {
removeFile crash.tcl
removeFile crashtest.tcl
} -returnCodes 0
# cleanup
catch {unset env(LANG)}
catch {set env(LANG) $oldlang}
unset -nocomplain path
::tcltest::cleanupTests
return
|
Changes to tests/unixNotfy.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # This file contains tests for tclUnixNotfy.c. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 by Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# This file contains tests for tclUnixNotfy.c.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1997 by Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: unixNotfy.test,v 1.17.4.1 2005/06/13 01:46:51 msofer Exp $
# The tests should not be run if you have a notifier which is unable to
# detect infinite vwaits, as the tests below will hang. The presence of
# the "testthread" command indicates that this is the case.
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
# When run in a Tk shell, these tests hang.
testConstraint noTk [expr {![info exists tk_version]}]
testConstraint testthread [expr {[info commands testthread] != {}}]
# Darwin always uses a threaded notifier
testConstraint unthreaded [expr {
(![info exist tcl_platform(threaded)] || !$tcl_platform(threaded))
&& $tcl_platform(os) ne "Darwin"
}]
# The next two tests will hang if threads are enabled because the notifier
# will not necessarily wait for ever in this case, so it does not generate
# an error.
test unixNotfy-1.1 {Tcl_DeleteFileHandler} -constraints {noTk unix unthreaded} -body {
catch {vwait x}
|
| ︙ | ︙ |
Changes to tests/util.test.
1 2 3 4 5 6 7 8 9 | # This file is a Tcl script to test the code in the file tclUtil.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright (c) 1995-1998 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 |
# This file is a Tcl script to test the code in the file tclUtil.c.
# This file is organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1995-1998 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: util.test,v 1.14.4.1 2005/06/13 01:46:51 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
# Big test for correct ordering of data in [expr]
proc testIEEE {} {
variable ieeeValues
binary scan [binary format dd -1.0 1.0] c* c
switch -exact -- $c {
{0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
# little endian
binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \
ieeeValues(-Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \
ieeeValues(-Normal)
binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
ieeeValues(-Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
ieeeValues(+Subnormal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \
ieeeValues(+Normal)
binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \
ieeeValues(+Infinity)
binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 1
return 1
}
{-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Infinity)
binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Normal)
binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-Subnormal)
binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(-0)
binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+0)
binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Subnormal)
binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Normal)
binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \
ieeeValues(+Infinity)
binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \
ieeeValues(NaN)
set ieeeValues(littleEndian) 0
return 1
}
default {
return 0
}
}
}
::tcltest::testConstraint ieeeFloatingPoint [testIEEE]
proc convertDouble { x } {
variable ieeeValues
if { $ieeeValues(littleEndian) } {
binary scan [binary format w $x] d result
} else {
binary scan [binary format W $x] d result
}
return $result
}
test util-1.1 {TclFindElement procedure - binary element in middle of list} {
lindex {0 foo\x00help 1} 1
} "foo\x00help"
test util-1.2 {TclFindElement procedure - binary element at end of list} {
lindex {0 foo\x00help} 1
} "foo\x00help"
|
| ︙ | ︙ | |||
269 270 271 272 273 274 275 |
test util-5.50 {Tcl_StringMatch} {
Wrapper_Tcl_StringMatch *. ""
} 0
test util-5.51 {Tcl_StringMatch} {
Wrapper_Tcl_StringMatch "" ""
} 1
| | > > > > > | | > > > > > | | > > > > > | | > | > | | > > | | > > > > | | > > > > | | > > > > | | > > > > | < < | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
test util-5.50 {Tcl_StringMatch} {
Wrapper_Tcl_StringMatch *. ""
} 0
test util-5.51 {Tcl_StringMatch} {
Wrapper_Tcl_StringMatch "" ""
} 1
test util-6.1 {Tcl_PrintDouble - using tcl_precision} -setup {
set old_precision $::tcl_precision
set ::tcl_precision 12
} -body {
concat x[expr 1.4]
} -cleanup {
set ::tcl_precision $old_precision
} -result {x1.4}
test util-6.2 {Tcl_PrintDouble - using tcl_precision} -setup {
set old_precision $::tcl_precision
set ::tcl_precision 12
} -body {
concat x[expr 1.39999999999]
} -cleanup {
set ::tcl_precision $old_precision
} -result {x1.39999999999}
test util-6.3 {Tcl_PrintDouble - using tcl_precision} -setup {
set old_precision $::tcl_precision
set ::tcl_precision 12
} -body {
concat x[expr 1.399999999999]
} -cleanup {
set ::tcl_precision $old_precision
} -result {x1.4}
test util-6.4 {Tcl_PrintDouble - using tcl_precision} -setup {
set old_precision $::tcl_precision
set ::tcl_precision 5
} -body {
concat x[expr 1.123412341234]
} -cleanup {
set tcl_precision $old_precision
} -result {x1.1234}
test util-6.5 {Tcl_PrintDouble - make sure there's a decimal point} {
concat x[expr 2.0]
} {x2.0}
test util-6.6 {Tcl_PrintDouble - make sure there's a decimal point} {
concat x[expr 3.0e98]
} {x3e+98}
test util-7.1 {TclPrecTraceProc - unset callbacks} -setup {
set old_precision $::tcl_precision
} -body {
set tcl_precision 7
set x $tcl_precision
unset tcl_precision
list $x $tcl_precision
} -cleanup {
set ::tcl_precision $old_precision
} -result {7 7}
test util-7.2 {TclPrecTraceProc - read traces, sharing among interpreters} -setup {
set old_precision $::tcl_precision
} -body {
set tcl_precision 12
interp create child
set x [child eval set tcl_precision]
child eval {set tcl_precision 6}
interp delete child
list $x $tcl_precision
} -cleanup {
set ::tcl_precision $old_precision
} -result {12 6}
test util-7.3 {TclPrecTraceProc - write traces, safe interpreters} -setup {
set old_precision $::tcl_precision
} -body {
set tcl_precision 12
interp create -safe child
set x [child eval {
list [catch {set tcl_precision 8} msg] $msg
}]
interp delete child
list $x $tcl_precision
} -cleanup {
set ::tcl_precision $old_precision
} -result {{1 {can't set "tcl_precision": can't modify precision from a safe interpreter}} 12}
test util-7.4 {TclPrecTraceProc - write traces, bogus values} -setup {
set old_precision $::tcl_precision
} -body {
set tcl_precision 12
list [catch {set tcl_precision abc} msg] $msg $tcl_precision
} -cleanup {
set ::tcl_precision $old_precision
} -result {1 {can't set "tcl_precision": improper value for precision} 12}
# This test always succeeded in the C locale anyway...
test util-8.1 {TclNeedSpace - correct UTF8 handling} {
# Bug 411825
# Note that this test relies on the fact that
# [interp target] calls on Tcl_AppendElement()
# which calls on TclNeedSpace(). If [interp target]
|
| ︙ | ︙ | |||
383 384 385 386 387 388 389 390 391 392 393 |
testdstring free
testdstring append {\\ } -1
testdstring append \{ -1
testdstring element foo
testdstring append \} -1
list [llength [testdstring get]] [string length [testdstring get]]
} {2 9}
# cleanup
::tcltest::cleanupTests
return
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 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 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 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 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 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 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 |
testdstring free
testdstring append {\\ } -1
testdstring append \{ -1
testdstring element foo
testdstring append \} -1
list [llength [testdstring get]] [string length [testdstring get]]
} {2 9}
test util-9.0.0 {TclGetIntForIndex} {
string index abcd 0
} a
test util-9.0.1 {TclGetIntForIndex} {
string index abcd 0x0
} a
test util-9.0.2 {TclGetIntForIndex} {
string index abcd -0x0
} a
test util-9.0.3 {TclGetIntForIndex} {
string index abcd { 0 }
} a
test util-9.0.4 {TclGetIntForIndex} {
string index abcd { 0x0 }
} a
test util-9.0.5 {TclGetIntForIndex} {
string index abcd { -0x0 }
} a
test util-9.0.6 {TclGetIntForIndex} {
string index abcd 01
} b
test util-9.0.7 {TclGetIntForIndex} {
string index abcd { 01 }
} b
test util-9.1.0 {TclGetIntForIndex} {
string index abcd 3
} d
test util-9.1.1 {TclGetIntForIndex} {
string index abcd { 3 }
} d
test util-9.1.2 {TclGetIntForIndex} {
string index abcdefghijk 0xa
} k
test util-9.1.3 {TclGetIntForIndex} {
string index abcdefghijk { 0xa }
} k
test util-9.2.0 {TclGetIntForIndex} {
string index abcd end
} d
test util-9.2.1 {TclGetIntForIndex} -body {
string index abcd { end}
} -returnCodes error -match glob -result *
test util-9.2.2 {TclGetIntForIndex} -body {
string index abcd {end }
} -returnCodes error -match glob -result *
test util-9.3 {TclGetIntForIndex} {
# Deprecated
string index abcd en
} d
test util-9.4 {TclGetIntForIndex} {
# Deprecated
string index abcd e
} d
test util-9.5.0 {TclGetIntForIndex} {
string index abcd end-1
} c
test util-9.5.1 {TclGetIntForIndex} {
string index abcd {end-1 }
} c
test util-9.5.2 {TclGetIntForIndex} -body {
string index abcd { end-1}
} -returnCodes error -match glob -result *
test util-9.6 {TclGetIntForIndex} {
string index abcd end+-1
} c
test util-9.7 {TclGetIntForIndex} {
string index abcd end+1
} {}
test util-9.8 {TclGetIntForIndex} {
string index abcd end--1
} {}
test util-9.9.0 {TclGetIntForIndex} {
string index abcd 0+0
} a
test util-9.9.1 {TclGetIntForIndex} {
string index abcd { 0+0 }
} a
test util-9.10 {TclGetIntForIndex} {
string index abcd 0-0
} a
test util-9.11 {TclGetIntForIndex} {
string index abcd 1+0
} b
test util-9.12 {TclGetIntForIndex} {
string index abcd 1-0
} b
test util-9.13 {TclGetIntForIndex} {
string index abcd 1+1
} c
test util-9.14 {TclGetIntForIndex} {
string index abcd 1-1
} a
test util-9.15 {TclGetIntForIndex} {
string index abcd -1+2
} b
test util-9.16 {TclGetIntForIndex} {
string index abcd -1--2
} b
test util-9.17 {TclGetIntForIndex} {
string index abcd { -1+2 }
} b
test util-9.18 {TclGetIntForIndex} {
string index abcd { -1--2 }
} b
test util-9.19 {TclGetIntForIndex} -body {
string index a {}
} -returnCodes error -match glob -result *
test util-9.20 {TclGetIntForIndex} -body {
string index a { }
} -returnCodes error -match glob -result *
test util-9.21 {TclGetIntForIndex} -body {
string index a " \r\t\n"
} -returnCodes error -match glob -result *
test util-9.22 {TclGetIntForIndex} -body {
string index a +
} -returnCodes error -match glob -result *
test util-9.23 {TclGetIntForIndex} -body {
string index a -
} -returnCodes error -match glob -result *
test util-9.24 {TclGetIntForIndex} -body {
string index a x
} -returnCodes error -match glob -result *
test util-9.25 {TclGetIntForIndex} -body {
string index a +x
} -returnCodes error -match glob -result *
test util-9.26 {TclGetIntForIndex} -body {
string index a -x
} -returnCodes error -match glob -result *
test util-9.27 {TclGetIntForIndex} -body {
string index a 0y
} -returnCodes error -match glob -result *
test util-9.28 {TclGetIntForIndex} -body {
string index a 1*
} -returnCodes error -match glob -result *
test util-9.29 {TclGetIntForIndex} -body {
string index a 0+
} -returnCodes error -match glob -result *
test util-9.30 {TclGetIntForIndex} -body {
string index a {0+ }
} -returnCodes error -match glob -result *
test util-9.31 {TclGetIntForIndex} -body {
string index a 0x
} -returnCodes error -match glob -result *
test util-9.32 {TclGetIntForIndex} -body {
string index a 0x1FFFFFFFF+0
} -returnCodes error -match glob -result *
test util-9.33 {TclGetIntForIndex} -body {
string index a 100000000000+0
} -returnCodes error -match glob -result *
test util-9.34 {TclGetIntForIndex} -body {
string index a 1.0
} -returnCodes error -match glob -result *
test util-9.35 {TclGetIntForIndex} -body {
string index a 1e23
} -returnCodes error -match glob -result *
test util-9.36 {TclGetIntForIndex} -body {
string index a 1.5e2
} -returnCodes error -match glob -result *
test util-9.37 {TclGetIntForIndex} -body {
string index a 0+x
} -returnCodes error -match glob -result *
test util-9.38 {TclGetIntForIndex} -body {
string index a 0+0x
} -returnCodes error -match glob -result *
test util-9.39 {TclGetIntForIndex} -body {
string index a 0+0xg
} -returnCodes error -match glob -result *
test util-9.40 {TclGetIntForIndex} -body {
string index a 0+0xg
} -returnCodes error -match glob -result *
test util-9.41 {TclGetIntForIndex} -body {
string index a 0+1.0
} -returnCodes error -match glob -result *
test util-9.42 {TclGetIntForIndex} -body {
string index a 0+1e2
} -returnCodes error -match glob -result *
test util-9.43 {TclGetIntForIndex} -body {
string index a 0+1.5e1
} -returnCodes error -match glob -result *
test util-9.44 {TclGetIntForIndex} -body {
string index a 0+1000000000000
} -returnCodes error -match glob -result *
test util-10.1 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x0000000000000000
} {0.0}
test util-10.2 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x8000000000000000
} {-0.0}
test util-10.3 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x7ef754e31cd072da
} {4e+303}
test util-10.4 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xd08afcef51f0fb5f
} {-1e+80}
test util-10.5 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x7ed754e31cd072da
} {1e+303}
test util-10.6 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xfee754e31cd072da
} {-2e+303}
test util-10.7 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x0afe07b27dd78b14
} {1e-255}
test util-10.8 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x93ae29e9c56687fe
} {-7e-214}
test util-10.9 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x376be03d0bf225c7
} {1e-41}
test util-10.10 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xa0ca2fe76a3f9475
} {-1e-150}
test util-10.11 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x7fa9a2028368022e
} {9e+306}
test util-10.12 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xdfc317e5ef3ab327
} {-2e+153}
test util-10.13 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x5fd317e5ef3ab327
} {4e+153}
test util-10.14 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xdfe317e5ef3ab327
} {-8e+153}
test util-10.15 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x00feb8e84fa0b278
} {7e-304}
test util-10.16 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x8133339131c46f8b
} {-7e-303}
test util-10.17 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x35dc0f92a6276c9d
} {3e-49}
test util-10.18 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xa445ce1f143d7ad2
} {-6e-134}
test util-10.19 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x2d2c0794d9d40e96
} {4.3e-91}
test util-10.20 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xad3c0794d9d40e96
} {-8.6e-91}
test util-10.21 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x30ecd5bee57763e6
} {5.1e-73}
test util-10.22 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x68ad1c26db7d0dae
} {1.7e+196}
test util-10.23 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbfa3f7ced916872b
} {-0.039}
test util-10.24 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x64b7d93193f78fc6
} {1.51e+177}
test util-10.25 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x98ea82a1631eeb30
} {-1.19e-188}
test util-10.26 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xd216c309024bab4b
} {-2.83e+87}
test util-10.27 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x0dfdbbac6f83a821
} {2.7869147e-241}
test util-10.28 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xdadc569e968e0944
} {-4.91080654e+129}
test util-10.29 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x5acc569e968e0944
} {2.45540327e+129}
test util-10.30 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xab5fc575867314ee
} {-9.078555839e-100}
test util-10.31 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xdabc569e968e0944
} {-1.227701635e+129}
test util-10.32 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x2b6fc575867314ee
} {1.8157111678e-99}
test util-10.33 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xb3b8bf7e7fa6f02a
} {-1.5400733123779e-59}
test util-10.34 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xcd83de005bd620df
} {-2.6153245263757307e+65}
test util-10.35 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x6cdf92bacb3cb40c
} {2.7210404151224248e+216}
test util-10.36 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xecef92bacb3cb40c
} {-5.4420808302448496e+216}
test util-10.37 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x49342dbf25096cf5
} {4.5e+44}
test util-10.38 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xd06afcef51f0fb5f
} {-2.5e+79}
test util-10.39 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x49002498ea6df0c4
} {4.5e+43}
test util-10.40 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xfeb754e31cd072da
} {-2.5e+302}
test util-10.41 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x1d22deac01e2b4f7
} {2.5e-168}
test util-10.42 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xaccb1df536c13eee
} {-6.5e-93}
test util-10.43 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3650711fed5b19a4
} {4.5e-47}
test util-10.44 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xb6848d67e8b1e00d
} {-4.5e-46}
test util-10.45 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x4bac8c574c0c6be7
} {3.5e+56}
test util-10.46 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xccd756183c147514
} {-1.5e+62}
test util-10.47 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x4ca2ab469676c410
} {1.5e+61}
test util-10.48 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xcf5539684e774b48
} {-1.5e+74}
test util-10.49 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x2e12e5f5dfa4fe9d
} {9.5e-87}
test util-10.50 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x8b9bdc2417bf7787
} {-9.5e-253}
test util-10.51 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x00eeb8e84fa0b278
} {3.5e-304}
test util-10.52 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xadde3cbc9907fdc8
} {-9.5e-88}
test util-10.53 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x2bb0ad836f269a17
} {3.05e-98}
test util-10.54 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x950b39ae1909c31b
} {-2.65e-207}
test util-10.55 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x1bfb2ab18615fcc6
} {6.865e-174}
test util-10.56 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x98f3e1f90a573064
} {-1.785e-188}
test util-10.57 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x5206c309024bab4b
} {1.415e+87}
test util-10.58 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xcc059bd3ad46e346
} {-1.6955e+58}
test util-10.59 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x47bdf4170f0fdecc
} {3.9815e+37}
test util-10.60 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x59e7e1e0f1c7a4ac
} {1.263005e+125}
test util-10.61 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xda1dda592e398dd7
} {-1.263005e+126}
test util-10.62 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xdc4e597c0b94b7ae
} {-4.4118455e+136}
test util-10.63 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x5aac569e968e0944
} {6.138508175e+128}
test util-10.64 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xdabc569e968e0944
} {-1.227701635e+129}
test util-10.65 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x6ce7ae0c186d8709
} {4.081560622683637e+216}
test util-10.66 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x44b52d02c7e14af7
} {1.0000000000000001e+23}
test util-10.67 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc589d971e4fe8402
} {-1e+27}
test util-10.68 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x4599d971e4fe8402
} {2e+27}
test util-10.69 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc5a9d971e4fe8402
} {-4e+27}
test util-10.70 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3e45798ee2308c3a
} {1e-8}
test util-10.71 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbe55798ee2308c3a
} {-2e-8}
test util-10.72 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3e65798ee2308c3a
} {4e-8}
test util-10.73 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbabef2d0f5da7dd9
} {-1e-25}
test util-10.74 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x44da784379d99db4
} {5e+23}
test util-10.75 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc4fa784379d99db4
} {-2e+24}
test util-10.76 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x4503da329b633647
} {3e+24}
test util-10.77 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc54cf389cd46047d
} {-7e+25}
test util-10.78 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3fc999999999999a
} {0.2}
test util-10.79 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbfd3333333333333
} {-0.3}
test util-10.80 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3cf6849b86a12b9b
} {5e-15}
test util-10.81 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbd16849b86a12b9b
} {-2e-14}
test util-10.82 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3b87ccfc73126788
} {6.3e-22}
test util-10.83 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbbbdc03b8fd7016a
} {-6.3e-21}
test util-10.84 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3fa3f7ced916872b
} {0.039}
test util-10.85 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x460b297cad9f70b6
} {2.69e+29}
test util-10.86 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc61b297cad9f70b6
} {-5.38e+29}
test util-10.87 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3adcdc06b20ef183
} {3.73e-25}
test util-10.88 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x45fb297cad9f70b6
} {1.345e+29}
test util-10.89 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc60b297cad9f70b6
} {-2.69e+29}
test util-10.90 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbc050a246ecd44f3
} {-1.4257e-19}
test util-10.91 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbec19b96f36ec68b
} {-2.09901e-6}
test util-10.92 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3dcc06d366394441
} {5.0980203373e-11}
test util-10.93 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc79f58ac4db68c90
} {-1.04166211811e+37}
test util-10.94 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x4569d971e4fe8402
} {2.5e+26}
test util-10.95 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc50dc74be914d16b
} {-4.5e+24}
test util-10.96 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x4534adf4b7320335
} {2.5e+25}
test util-10.97 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc54ae22487c1042b
} {-6.5e+25}
test util-10.98 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3c987fe49aab41e0
} {8.5e-17}
test util-10.99 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbc2f5c05e4b23fd7
} {-8.5e-19}
test util-10.100 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3d5faa7ab552a552
} {4.5e-13}
test util-10.101 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbdbb7cdfd9d7bdbb
} {-2.5e-11}
test util-10.102 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x44f3da329b633647
} {1.5e+24}
test util-10.103 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc53cf389cd46047d
} {-3.5e+25}
test util-10.104 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x454f04ef12cb04cf
} {7.5e+25}
test util-10.105 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc55f04ef12cb04cf
} {-1.5e+26}
test util-10.106 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3fc3333333333333
} {0.15}
test util-10.107 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbdb07e1fe91b0b70
} {-1.5e-11}
test util-10.108 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3de49da7e361ce4c
} {1.5e-10}
test util-10.109 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbe19c511dc3a41df
} {-1.5e-9}
test util-10.110 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc5caa83d74267822
} {-1.65e+28}
test util-10.111 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x4588f1d5969453de
} {9.65e+26}
test util-10.112 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3b91d9bd564dcda6
} {9.45e-22}
test util-10.113 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbcfa58973ecbede6
} {-5.85e-15}
test util-10.114 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x45eb297cad9f70b6
} {6.725e+28}
test util-10.115 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc5fb297cad9f70b6
} {-1.345e+29}
test util-10.116 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3accdc06b20ef183
} {1.865e-25}
test util-10.117 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xbd036071dcae4565
} {-8.605e-15}
test util-10.118 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x462cb968d297dde8
} {1.137885e+30}
test util-10.119 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0xc661f3e1839eeab1
} {-1.137885e+31}
test util-10.120 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x474e9cec176c96f8
} {3.179033335e+35}
test util-10.121 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x3dbc06d366394441
} {2.54901016865e-11}
test util-10.122 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x478f58ac4db68c90
} {5.20831059055e+36}
test util-11.1 {Tcl_PrintDouble - scaling} {
expr 1.1e-5
} {1.1e-5}
test util-11.2 {Tcl_PrintDouble - scaling} {
expr 1.1e-4
} {0.00011}
test util-11.3 {Tcl_PrintDouble - scaling} {
expr 1.1e-3
} {0.0011}
test util-11.4 {Tcl_PrintDouble - scaling} {
expr 1.1e-2
} {0.011}
test util-11.5 {Tcl_PrintDouble - scaling} {
expr 1.1e-1
} {0.11}
test util-11.6 {Tcl_PrintDouble - scaling} {
expr 1.1e0
} {1.1}
test util-11.7 {Tcl_PrintDouble - scaling} {
expr 1.1e1
} {11.0}
test util-11.8 {Tcl_PrintDouble - scaling} {
expr 1.1e2
} {110.0}
test util-11.9 {Tcl_PrintDouble - scaling} {
expr 1.1e3
} {1100.0}
test util-11.10 {Tcl_PrintDouble - scaling} {
expr 1.1e4
} {11000.0}
test util-11.11 {Tcl_PrintDouble - scaling} {
expr 1.1e5
} {110000.0}
test util-11.12 {Tcl_PrintDouble - scaling} {
expr 1.1e6
} {1100000.0}
test util-11.13 {Tcl_PrintDouble - scaling} {
expr 1.1e7
} {11000000.0}
test util-11.14 {Tcl_PrintDouble - scaling} {
expr 1.1e8
} {110000000.0}
test util-11.15 {Tcl_PrintDouble - scaling} {
expr 1.1e9
} {1100000000.0}
test util-11.16 {Tcl_PrintDouble - scaling} {
expr 1.1e10
} {11000000000.0}
test util-11.17 {Tcl_PrintDouble - scaling} {
expr 1.1e11
} {110000000000.0}
test util-11.18 {Tcl_PrintDouble - scaling} {
expr 1.1e12
} {1100000000000.0}
test util-11.19 {Tcl_PrintDouble - scaling} {
expr 1.1e13
} {11000000000000.0}
test util-11.20 {Tcl_PrintDouble - scaling} {
expr 1.1e14
} {110000000000000.0}
test util-11.21 {Tcl_PrintDouble - scaling} {
expr 1.1e15
} {1100000000000000.0}
test util-11.22 {Tcl_PrintDouble - scaling} {
expr 1.1e16
} {11000000000000000.0}
test util-11.23 {Tcl_PrintDouble - scaling} {
expr 1.1e17
} {1.1e+17}
# cleanup
::tcltest::cleanupTests
return
|
Changes to tests/winDde.test.
1 2 3 4 5 6 7 8 9 10 11 | # This file tests the tclWinDde.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# This file tests the tclWinDde.c file.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: winDde.test,v 1.27.2.1 2005/06/13 01:46:51 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
#tcltest::configure -verbose {pass start}
namespace import -force ::tcltest::*
}
|
| ︙ | ︙ |
Changes to tests/winFCmd.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # This file tests the tclWinFCmd.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1996-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# This file tests the tclWinFCmd.c file.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1996-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: winFCmd.test,v 1.35.4.1 2005/06/13 01:46:52 msofer Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
|
| ︙ | ︙ | |||
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 |
}
} -cleanup {
cd $pwd
} -result "permission denied"
cd $pwd
unset d dd pwd
# This block of code used to occur after the "return" call, so I'm
# commenting it out and assuming that this code is still under construction.
#foreach source {tef ted tnf tnd "" nul com1} {
# foreach chmodsrc {000 755} {
# foreach dest "tfn tfe tdn tdempty tdfull td1/td2 $p $p/td1 {} nul" {
# foreach chmoddst {000 755} {
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
}
} -cleanup {
cd $pwd
} -result "permission denied"
cd $pwd
unset d dd pwd
test winFCmd-18.1 {Windows reserved path names} -constraints win -body {
file pathtype com1
} -result "absolute"
test winFCmd-18.1.2 {Windows reserved path names} -constraints win -body {
file pathtype com4
} -result "absolute"
test winFCmd-18.1.3 {Windows reserved path names} -constraints win -body {
file pathtype com5
} -result "relative"
test winFCmd-18.1.4 {Windows reserved path names} -constraints win -body {
file pathtype lpt3
} -result "absolute"
test winFCmd-18.1.5 {Windows reserved path names} -constraints win -body {
file pathtype lpt4
} -result "relative"
test winFCmd-18.1.6 {Windows reserved path names} -constraints win -body {
file pathtype nul
} -result "absolute"
test winFCmd-18.1.7 {Windows reserved path names} -constraints win -body {
file pathtype null
} -result "relative"
test winFCmd-18.2 {Windows reserved path names} -constraints win -body {
file pathtype com1:
} -result "absolute"
test winFCmd-18.3 {Windows reserved path names} -constraints win -body {
file pathtype COM1
} -result "absolute"
test winFCmd-18.4 {Windows reserved path names} -constraints win -body {
file pathtype CoM1:
} -result "absolute"
test winFCmd-18.5 {Windows reserved path names} -constraints win -body {
file normalize com1:
} -result COM1
test winFCmd-18.6 {Windows reserved path names} -constraints win -body {
file normalize COM1:
} -result COM1
test winFCmd-18.7 {Windows reserved path names} -constraints win -body {
file normalize cOm1
} -result COM1
test winFCmd-18.8 {Windows reserved path names} -constraints win -body {
file normalize cOm1:
} -result COM1
# This block of code used to occur after the "return" call, so I'm
# commenting it out and assuming that this code is still under construction.
#foreach source {tef ted tnf tnd "" nul com1} {
# foreach chmodsrc {000 755} {
# foreach dest "tfn tfe tdn tdempty tdfull td1/td2 $p $p/td1 {} nul" {
# foreach chmoddst {000 755} {
|
| ︙ | ︙ |
Added tools/fix_tommath_h.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 |
# fixtommath.tcl --
#
# Changes to 'tommath.h' to make it conform with Tcl's linking
# conventions.
#
# Copyright (c) 2005 by Kevin B. Kenny. All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: fix_tommath_h.tcl,v 1.2.4.2 2005/06/13 01:46:52 msofer Exp $
#
#----------------------------------------------------------------------
set f [open [lindex $argv 0] r]
set data [read $f]
close $f
foreach line [split $data \n] {
switch -regexp -- $line {
{#define BN_H_} {
puts $line
puts {}
puts "\#ifdef TCL_TOMMATH"
puts "\#include <tclTomMath.h>"
puts "\#endif"
puts "\#ifndef TOMMATH_STORAGE_CLASS"
puts "\#define TOMMATH_STORAGE_CLASS extern"
puts "\#endif"
}
{typedef.*mp_digit;} {
puts "\#ifndef MP_DIGIT_DECLARED"
puts $line
puts "\#define MP_DIGIT_DECLARED"
puts "\#endif"
}
{typedef struct} {
puts "\#ifndef MP_INT_DECLARED"
puts "\#define MP_INT_DECLARED"
puts "typedef struct mp_int mp_int;"
puts "\#endif"
puts "struct mp_int \{"
}
\}\ mp_int\; {
puts "\};"
}
"^(char|int|void)" {
puts "TOMMATH_STORAGE_CLASS $line"
}
default {
puts $line
}
}
}
|
Changes to tools/man2html2.tcl.
1 2 3 4 5 6 7 | # man2html2.tcl -- # # This file defines procedures that are used during the second pass of the # man page to html conversion process. It is sourced by man2html.tcl. # # Copyright (c) 1996 by Sun Microsystems, Inc. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # man2html2.tcl -- # # This file defines procedures that are used during the second pass of the # man page to html conversion process. It is sourced by man2html.tcl. # # Copyright (c) 1996 by Sun Microsystems, Inc. # # $Id: man2html2.tcl,v 1.7.4.1 2005/06/13 01:46:52 msofer Exp $ # package require Tcl 8.4 # Global variables used by these scripts: # # NAME_file - array indexed by NAME and containing file names used |
| ︙ | ︙ | |||
715 716 717 718 719 720 721 |
return
}
# Special case for alternative mechanism for declaring bullets
if {[lindex $argList 0] eq "\\(bu"} {
nest para UL LI
return
}
| | < | | | | < < | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
return
}
# Special case for alternative mechanism for declaring bullets
if {[lindex $argList 0] eq "\\(bu"} {
nest para UL LI
return
}
if {[regexp {^\[\d+\]$} [lindex $argList 0]]} {
nest para OL LI
return
}
nest para DL DT
formattedText [lindex $argList 0]
puts $file "\n<DD>"
return
}
# TPmacro --
#
# This procedure is invoked to handle ".TP" macros, which may take any
# of the following forms:
|
| ︙ | ︙ |
Changes to tools/tcl.wse.in.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | Japanese Font Size=10 Start Gradient=0 0 255 End Gradient=0 0 0 Windows Flags=00000000000000010010110000001000 Log Pathname=%MAINDIR%\INSTALL.LOG Message Font=MS Sans Serif Font Size=8 | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | Japanese Font Size=10 Start Gradient=0 0 255 End Gradient=0 0 0 Windows Flags=00000000000000010010110000001000 Log Pathname=%MAINDIR%\INSTALL.LOG Message Font=MS Sans Serif Font Size=8 Disk Label=tcl8.5a4 Disk Filename=setup Patch Flags=0000000000000001 Patch Threshold=85 Patch Memory=4000 Variable Name1=_SYS_ Variable Default1=C:\WINDOWS\SYSTEM Variable Flags1=00001000 |
| ︙ | ︙ |
Changes to tools/tclZIC.tcl.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 | # # This program parses the timezone data in a means analogous to the # 'zic' command, and produces Tcl time zone information files suitable # for loading into the 'clock' namespace. # #---------------------------------------------------------------------- # | | | > > | | | | < < < < < < < < < < < < < < < < < < < < < < < < < | | 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 |
#
# This program parses the timezone data in a means analogous to the
# 'zic' command, and produces Tcl time zone information files suitable
# for loading into the 'clock' namespace.
#
#----------------------------------------------------------------------
#
# Copyright (c) 2004 by Kevin B. Kenny. All rights reserved.
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: tclZIC.tcl,v 1.3.4.1 2005/06/13 01:46:52 msofer Exp $
#
#----------------------------------------------------------------------
package require Tcl 8.5
# Define the names of the Olson files that we need to load.
# We avoid the solar time files and the leap seconds.
set olsonFiles {
africa antarctica asia australasia
backward etcetera europe northamerica
pacificnew southamerica systemv
}
# Temporary scaffolding - load up the new 'clock' package.
source [file join [file dirname [info script]] .. library clock.tcl]
# Define the year at which the DST information will stop.
set maxyear 2100
# Determine how big a wide integer is.
set MAXWIDE [expr {wide(1)}]
while 1 {
set next [expr {$MAXWIDE + $MAXWIDE + 1}]
if {$next < 0} {
break
}
set MAXWIDE $next
}
set MINWIDE [expr {-$MAXWIDE-1}]
#----------------------------------------------------------------------
#
# loadFiles --
#
# Loads the time zone files for each continent into memory
#
# Parameters:
# dir - Directory where the time zone source files are found
#
# Results:
# None.
#
# Side effects:
# Calls 'loadZIC' for each continent's data file in turn.
# Reports progress on stdout.
#
#----------------------------------------------------------------------
proc loadFiles {dir} {
variable olsonFiles
foreach file $olsonFiles {
puts "loading: [file join $dir $file]"
loadZIC [file join $dir $file]
}
return
}
|
| ︙ | ︙ | |||
132 133 134 135 136 137 138 |
# any undefined rules are present.
#
#----------------------------------------------------------------------
proc checkForwardRuleRefs {} {
variable forwardRuleRefs
variable rules
| > | | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# any undefined rules are present.
#
#----------------------------------------------------------------------
proc checkForwardRuleRefs {} {
variable forwardRuleRefs
variable rules
foreach {rule where} [array get forwardRuleRefs] {
if {![info exists rules($rule)]} {
foreach {fileName lno} $where {
puts stderr "$fileName:$lno:can't locate rule \"$rule\""
incr errorCount
}
}
}
}
|
| ︙ | ︙ | |||
163 164 165 166 167 168 169 | # The global array, 'links', contains a distillation of the # 'Link' directives in the file. The keys are 'links to' and # the values are 'links from'. The 'parseRule' and 'parseZone' # procedures are called to handle 'Rule' and 'Zone' directives. # #---------------------------------------------------------------------- | | < | | | > | < < < | < | | | > > < | 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 |
# The global array, 'links', contains a distillation of the
# 'Link' directives in the file. The keys are 'links to' and
# the values are 'links from'. The 'parseRule' and 'parseZone'
# procedures are called to handle 'Rule' and 'Zone' directives.
#
#----------------------------------------------------------------------
proc loadZIC {fileName} {
variable errorCount
variable links
# Suck the text into memory.
set f [open $fileName r]
set data [read $f]
close $f
# Break the input into lines, and count line numbers.
set lno 0
foreach line [split $data \n] {
incr lno
# Break a line of input into words.
regsub {\s*(\#.*)?$} $line {} line
if {$line eq ""} {
continue
}
set words {}
if {[regexp {^\s} $line]} {
# Detect continuations of a zone and flag the list appropriately
lappend words ""
}
lappend words {expand}[regexp -all -inline {\S+} $line]
# Switch on the directive
switch -exact -- [lindex $words 0] {
Rule {
parseRule $fileName $lno $words
}
Link {
set links([lindex $words 2]) [lindex $words 1]
}
Zone {
set lastZone [lindex $words 1]
set until [parseZone $fileName $lno \
$lastZone [lrange $words 2 end] "minimum"]
}
{} {
set i 0
foreach word $words {
if {[lindex $words $i] ne ""} {
break
}
incr i
}
set words [lrange $words $i end]
set until [parseZone $fileName $lno $lastZone $words $until]
}
default {
incr errorCount
puts stderr "$fileName:$lno:unknown line type \"[lindex $words 0]\""
}
}
}
return
}
#----------------------------------------------------------------------
#
# parseRule --
#
# Parses a Rule directive in an Olson file.
|
| ︙ | ︙ | |||
250 251 252 253 254 255 256 | # # Side effects: # The rule is analyzed and added to the 'rules' array. # Errors are reported and counted. # #---------------------------------------------------------------------- | | < | | < | | | < | | | | | | | | | | | | | | | | | | | | | | | | < | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
#
# Side effects:
# The rule is analyzed and added to the 'rules' array.
# Errors are reported and counted.
#
#----------------------------------------------------------------------
proc parseRule {fileName lno words} {
variable rules
variable errorCount
# Break out the columns
lassign $words Rule name from to type in on at save letter
# Handle the 'only' keyword
if {$to eq "only"} {
set to $from
}
# Process the start year
if {![string is integer $from]} {
if {![string equal -length [string length $from] $from "minimum"]} {
puts stderr "$fileName:$lno:FROM field \"$from\" not an integer."
incr errorCount
return
} else {
set from "minimum"
}
}
# Process the end year
if {![string is integer $to]} {
if {![string equal -length [string length $to] $to "maximum"]} {
puts stderr "$fileName:$lno:TO field \"$to\" not an integer."
incr errorCount
return
} else {
set to "maximum"
}
}
# Process the type of year in which the rule applies
if {$type ne "-"} {
puts stderr "$fileName:$lno:year types are not yet supported."
incr errorCount
return
}
# Process the month in which the rule starts
if {[catch {lookupMonth $in} in]} {
puts stderr "$fileName:$lno:$in"
incr errorCount
return
}
# Process the day of the month on which the rule starts
if {[catch {parseON $on} on]} {
puts stderr "$fileName:$lno:$on"
incr errorCount
return
}
# Process the time of day on which the rule starts
if {[catch {parseTOD $at} at]} {
puts stderr "$fileName:$lno:$at"
incr errorCount
return
}
# Process the DST adder
if {[catch {parseOffsetTime $save} save]} {
puts stderr "$fileName:$lno:$save"
incr errorCount
return
}
# Process the letter to use for summer time
if {$letter eq "-"} {
set letter ""
}
# Accumulate all the data.
lappend rules($name) $from $to $type $in $on $at $save $letter
return
}
#----------------------------------------------------------------------
#
# parseON --
#
# Parse a specification for a day of the month
#
# Parameters:
# on - the ON field from a line in an Olson file.
#
# Results:
# Returns a partial Tcl command. When the year and number of the
# month are appended, the command will return the Julian Day Number
# of the desired date.
#
# Side effects:
# None.
#
# The specification can be:
# - a simple number, which designates a constant date.
# - The name of a weekday, followed by >= or <=, followed by a number.
# This designates the nearest occurrence of the given weekday on
# or before (on or after) the given day of the month.
# - The word 'last' followed by a weekday name with no intervening
# space. This designates the last occurrence of the given weekday
# in the month.
#
#----------------------------------------------------------------------
proc parseON {on} {
if {![regexp -expanded {
^(?:
# first possibility - simple number - field 1
([[:digit:]]+)
|
# second possibility - weekday >= (or <=) number
# field 2 - weekday
([[:alpha:]]+)
# field 3 - direction
([<>]=)
# field 4 - number
([[:digit:]]+)
|
# third possibility - lastWeekday - field 5
last([[:alpha:]]+)
)$
} $on -> dom1 wday2 dir2 num2 wday3]} then {
error "can't parse ON field \"$on\""
}
if {$dom1 ne ""} {
return [list onDayOfMonth $dom1]
} elseif {$wday2 ne ""} {
set wday2 [lookupDayOfWeek $wday2]
return [list onWeekdayInMonth $wday2 $dir2 $num2]
} elseif {$wday3 ne ""} {
set wday3 [lookupDayOfWeek $wday3]
return [list onLastWeekdayInMonth $wday3]
} else {
error "in parseOn \"$on\": can't happen"
}
}
#----------------------------------------------------------------------
#
# onDayOfMonth --
#
# Find a given day of a given month
#
# Parameters:
# day - Day of the month
# year - Gregorian year
# month - Number of the month (1-12)
#
# Results:
# Returns the Julian Day Number of the desired day.
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc onDayOfMonth {day year month} {
set date [::tcl::clock::GetJulianDayFromEraYearMonthDay \
[dict create era CE year $year month $month dayOfMonth $day]]
return [dict get $date julianDay]
}
#----------------------------------------------------------------------
#
# onWeekdayInMonth --
#
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 | # # onWeekdayInMonth is used to compute Daylight Saving Time rules # like 'Sun>=1' (for the nearest Sunday on or after the first of the month) # or "Mon<=4' (for the Monday on or before the fourth of the month). # #---------------------------------------------------------------------- | | | | < < | | | 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 |
#
# onWeekdayInMonth is used to compute Daylight Saving Time rules
# like 'Sun>=1' (for the nearest Sunday on or after the first of the month)
# or "Mon<=4' (for the Monday on or before the fourth of the month).
#
#----------------------------------------------------------------------
proc onWeekdayInMonth {dayOfWeek relation dayOfMonth year month} {
set date [::tcl::clock::GetJulianDayFromEraYearMonthDay [dict create \
era CE year $year month $month dayOfMonth $dayOfMonth]]
switch -exact -- $relation {
<= {
return [::tcl::clock::WeekdayOnOrBefore $dayOfWeek \
[dict get $date julianDay]]
}
>= {
return [::tcl::clock::WeekdayOnOrBefore $dayOfWeek \
[expr {[dict get $date julianDay] + 6}]]
}
}
}
#----------------------------------------------------------------------
#
# onLastWeekdayInMonth --
|
| ︙ | ︙ | |||
495 496 497 498 499 500 501 | # the given weekday in the given month # # Side effects: # None. # #---------------------------------------------------------------------- | | | | < < | | | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
# the given weekday in the given month
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc onLastWeekdayInMonth {dayOfWeek year month} {
incr month
# Find day 0 of the following month, which is the last day of
# the current month. Yes, it works to ask for day 0 of month 13!
set date [::tcl::clock::GetJulianDayFromEraYearMonthDay [dict create \
era CE year $year month $month dayOfMonth 0]]
return [::tcl::clock::WeekdayOnOrBefore $dayOfWeek \
[dict get $date julianDay]]
}
#----------------------------------------------------------------------
#
# parseTOD --
#
# Parses the specification of a time of day in an Olson file.
#
# Parameters:
|
| ︙ | ︙ | |||
528 529 530 531 532 533 534 | # midnight and the letter that followed the time. # # Side effects: # Reports and counts an error if the time cannot be parsed. # #---------------------------------------------------------------------- | | | < | < | | < | | | < | | | | | | | | | < < | < | | < | | | | | | | < | | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 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 611 612 |
# midnight and the letter that followed the time.
#
# Side effects:
# Reports and counts an error if the time cannot be parsed.
#
#----------------------------------------------------------------------
proc parseTOD {tod} {
if {![regexp -expanded {
^
([[:digit:]]{1,2}) # field 1 - hour
(?:
:([[:digit:]]{2}) # field 2 - minute
(?:
:([[:digit:]]{2}) # field 3 - second
)?
)?
(?:
([wsugz]) # field 4 - type indicator
)?
} $tod -> hour minute second ind]} then {
puts stderr "$fileName:$lno:can't parse time field \"$tod\""
incr errorCount
}
scan $hour %d hour
if {$minute ne ""} {
scan $minute %d minute
} else {
set minute 0
}
if {$second ne ""} {
scan $second %d second
} else {
set second 0
}
if {$ind eq ""} {
set ind w
}
return [list [expr {($hour * 60 + $minute) * 60 + $second}] $ind]
}
#----------------------------------------------------------------------
#
# parseOffsetTime --
#
# Parses the specification of an offset time in an Olson file.
#
# Parameters:
# offset - Offset time as [+-]hh:mm:ss
#
# Results:
# Returns the offset time as a count of seconds.
#
# Side effects:
# Reports and counts an error if the time cannot be parsed.
#
#----------------------------------------------------------------------
proc parseOffsetTime {offset} {
if {![regexp -expanded {
^
([-+])? # field 1 - signum
([[:digit:]]{1,2}) # field 2 - hour
(?:
:([[:digit:]]{2}) # field 3 - minute
(?:
:([[:digit:]]{2}) # field 4 - second
)?
)?
} $offset -> signum hour minute second]} then {
puts stderr "$fileName:$lno:can't parse offset time \"$offset\""
incr errorCount
}
append signum 1
scan $hour %d hour
if {$minute ne ""} {
scan $minute %d minute
} else {
set minute 0
}
if {$second ne ""} {
scan $second %d second
} else {
set second 0
}
return [expr {(($hour * 60 + $minute) * 60 + $second) * $signum}]
}
#----------------------------------------------------------------------
#
# lookupMonth -
# Looks up a month by name
#
# Parameters:
# month - Name of a month.
#
# Results:
# Returns the number of the month.
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc lookupMonth {month} {
set indx [lsearch -regexp {
{} January February March April May June
July August September October November December
} ${month}.*]
if {$indx < 1} {
error "unknown month name \"$month\""
}
return $indx
}
#----------------------------------------------------------------------
#
|
| ︙ | ︙ | |||
663 664 665 666 667 668 669 | # Returns the weekday number (Monday=1, Sunday=7) # # Side effects: # None. # #---------------------------------------------------------------------- | | | | | | | > | | | | | < | | | | | | < | | | > | | | | | | | | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 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 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 |
# Returns the weekday number (Monday=1, Sunday=7)
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc lookupDayOfWeek {wday} {
set indx [lsearch -regexp {
{} Monday Tuesday Wednesday Thursday Friday Saturday Sunday
} ${wday}.*]
if {$indx < 1} {
error "unknown weekday name \"$wday\""
}
return $indx
}
#----------------------------------------------------------------------
#
# parseZone --
#
# Parses a Zone directive in an Olson file
#
# Parameters:
# fileName -- Name of the file being parsed.
# lno -- Line number within the file.
# zone -- Name of the time zone
# words -- Remaining words on the line.
# start -- 'Until' time from the previous line if this is a
# continuation line, or 'minimum' if this is the first line.
#
# Results:
# Returns the 'until' field of the current line
#
# Side effects:
# Stores a row in the 'zones' array describing the current zone.
# The row consists of a start time (year month day tod), a Standard
# Time offset from Greenwich, a Daylight Saving Time offset from
# Standard Time, and a format for printing the time zone.
#
# The start time is the result of an earlier call to 'parseUntil'
# or else the keyword 'minimum'. The GMT offset is the
# result of a call to 'parseOffsetTime'. The Daylight Saving
# Time offset is represented as a partial Tcl command. To the
# command will be appended a start time (seconds from epoch)
# the current offset of Standard Time from Greenwich, the current
# offset of Daylight Saving Time from Greenwich, the default
# offset from this line, the name pattern from this line,
# the 'until' field from this line, and a variable name where points
# are to be stored. This command is implemented by the 'applyNoRule',
# 'applyDSTOffset' and 'applyRules' procedures.
#
#----------------------------------------------------------------------
proc parseZone {fileName lno zone words start} {
variable zones
variable rules
variable errorCount
variable forwardRuleRefs
lassign $words gmtoff save format
if {[catch {parseOffsetTime $gmtoff} gmtoff]} {
puts stderr "$fileName:$lno:$gmtoff"
incr errorCount
return
}
if {[info exists rules($save)]} {
set save [list applyRules $save]
} elseif {$save eq "-"} {
set save [list applyNoRule]
} elseif {[catch {parseOffsetTime $save} save2]} {
lappend forwardRuleRefs($save) $fileName $lno
set save [list applyRules $save]
} else {
set save [list applyDSTOffset $save2]
}
lappend zones($zone) $start $gmtoff $save $format
if {[llength $words] >= 4} {
return [parseUntil [lrange $words 3 end]]
} else {
return {}
}
}
#----------------------------------------------------------------------
#
# parseUntil --
#
# Parses the 'UNTIL' part of a 'Zone' directive.
#
# Parameters:
# words - The 'UNTIL' part of the directie.
#
# Results:
# Returns a list comprising the year, the month, the day, and
# the time of day. Time of day is represented as the result of
# 'parseTOD'.
#
#----------------------------------------------------------------------
proc parseUntil {words} {
variable firstYear
if {[llength $words] >= 1} {
set year [lindex $words 0]
if {![string is integer $year]} {
error "can't parse UNTIL field \"$words\""
}
if {![info exists firstYear] || $year < $firstYear} {
set firstYear $year
}
} else {
set year "maximum"
}
if {[llength $words] >= 2} {
set month [lookupMonth [lindex $words 1]]
} else {
set month 1
}
if {[llength $words] >= 3} {
set day [parseON [lindex $words 2]]
} else {
set day {onDayOfMonth 1}
}
if {[llength $words] >= 4} {
set tod [parseTOD [lindex $words 3]]
} else {
set tod {0 w}
}
return [list $year $month $day $tod]
}
|
| ︙ | ︙ | |||
820 821 822 823 824 825 826 | # Side effects: # Appends a row to the 'points' variable comprising the start time, # the offset from GMT, a zero (indicating that DST is not in effect), # and the name of the time zone. # #---------------------------------------------------------------------- | | | | < | | | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# Side effects:
# Appends a row to the 'points' variable comprising the start time,
# the offset from GMT, a zero (indicating that DST is not in effect),
# and the name of the time zone.
#
#----------------------------------------------------------------------
proc applyNoRule {year startSecs stdGMTOffset DSTOffset nextGMTOffset
namePattern until pointsVar} {
upvar 1 $pointsVar points
lappend points $startSecs $nextGMTOffset 0 \
[convertNamePattern $namePattern -]
return [list $nextGMTOffset 0]
}
#----------------------------------------------------------------------
#
# applyDSTOffset --
#
# Generates time zone data for a zone with permanent Daylight
# Saving Time.
#
# Parameters:
# nextDSTOffset - Offset of Daylight from Standard while the
# rule is in effect.
# year - Year in which the rule applies
# startSecs - Time at which the rule starts.
# stdGMTOffset - Offset from Greenwich prior to the start of the
# rule
# DSTOffset - Offset of Daylight from Standard prior to the
# start of the rule.
# nextGMTOffset - Offset from Greenwich when the rule is in effect.
|
| ︙ | ︙ | |||
862 863 864 865 866 867 868 | # Side effects: # Appends a row to the 'points' variable comprising the start time, # the offset from GMT, a one (indicating that DST is in effect), # and the name of the time zone. # #---------------------------------------------------------------------- | | | | | | | | | 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 |
# Side effects:
# Appends a row to the 'points' variable comprising the start time,
# the offset from GMT, a one (indicating that DST is in effect),
# and the name of the time zone.
#
#----------------------------------------------------------------------
proc applyDSTOffset {nextDSTOffset year startSecs
stdGMTOffset DSTOffset nextGMTOffset
namePattern until pointsVar} {
upvar 1 $pointsVar points
lappend points \
$startSecs \
[expr {$nextGMTOffset + $nextDSTOffset}] \
1 \
[convertNamePattern $namePattern S]
return [list $nextGMTOffset $nextDSTOffset]
}
#----------------------------------------------------------------------
#
# applyRules --
#
|
| ︙ | ︙ | |||
907 908 909 910 911 912 913 | # Appends one or more rows to the 'points' variable, each of which # comprises a transition time, the offset from GMT that is # in effect after the transition, a flag for whether DST is in # effect, and the name of the time zone. # #---------------------------------------------------------------------- | | | < < | | | | | | | | | | | < | < | < < | > < | < | < | < < < | | | | | < > | | | | | | | | | | | | < | | | | < | | | | | | | < < | < | 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 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 |
# Appends one or more rows to the 'points' variable, each of which
# comprises a transition time, the offset from GMT that is
# in effect after the transition, a flag for whether DST is in
# effect, and the name of the time zone.
#
#----------------------------------------------------------------------
proc applyRules {ruleSet year startSecs stdGMTOffset DSTOffset nextGMTOffset
namePattern until pointsVar} {
variable done
variable rules
variable maxyear
upvar 1 $pointsVar points
# Extract the rules that apply to the current year, and the number
# of rules (now or in future) that will end at a specific year.
# Ignore rules entirely in the past.
lassign [divideRules $ruleSet $year] currentRules nSunsetRules
# If the first transition is later than $startSecs, and $stdGMTOffset is
# different from $nextGMTOffset, we will need an initial record like:
# lappend points $startSecs $stdGMTOffset 0 \
# [convertNamePattern $namePattern -]
set didTransitionIn false
# Determine the letter to use in Standard Time
set prevLetter ""
foreach {
fromYear toYear yearType monthIn daySpecOn timeAt save letter
} $rules($ruleSet) {
if {$save == 0} {
set prevLetter $letter
break
}
}
# Walk through each year in turn. This loop will break when
# (a) the 'until' time is passed
# or (b) the 'until' time is empty and all remaining rules extend to
# the end of time
set stdGMTOffset $nextGMTOffset
# convert "until" to seconds from epoch in current time zone
if {$until ne ""} {
lassign $until untilYear untilMonth untilDaySpec untilTimeOfDay
lappend untilDaySpec $untilYear $untilMonth
set untilJCD [eval $untilDaySpec]
set untilBaseSecs [expr {
wide(86400) * wide($untilJCD) - 210866803200 }]
set untilSecs [convertTimeOfDay $untilBaseSecs $stdGMTOffset \
$DSTOffset {expand}$untilTimeOfDay]
}
set origStartSecs $startSecs
while {($until ne "" && $startSecs < $untilSecs)
|| ($until eq "" && ($nSunsetRules > 0 || $year < $maxyear))} {
set remainingRules $currentRules
while {[llength $remainingRules] > 0} {
# Find the rule with the earliest start time from among the
# active rules that haven't yet been processed.
lassign [findEarliestRule $remainingRules $year \
$stdGMTOffset $DSTOffset] earliestSecs earliestIndex
set endi [expr {$earliestIndex + 7}]
set rule [lrange $remainingRules $earliestIndex $endi]
lassign $rule fromYear toYear \
yearType monthIn daySpecOn timeAt save letter
# Test if the rule is in effect.
if {
$earliestSecs > $startSecs &&
($until eq "" || $earliestSecs < $untilSecs)
} then {
# Test if the initial transition has been done.
# If not, do it now.
if {!$didTransitionIn && $earliestSecs > $origStartSecs} {
set nm [convertNamePattern $namePattern $prevLetter]
lappend points \
$origStartSecs \
[expr {$stdGMTOffset + $DSTOffset}] \
0 \
$nm
set didTransitionIn true
}
# Add a row to 'points' for the rule
set nm [convertNamePattern $namePattern $letter]
lappend points \
$earliestSecs \
[expr {$stdGMTOffset + $save}] \
[expr {$save != 0}] \
$nm
}
# Remove the rule just applied from the queue
set remainingRules [lreplace \
$remainingRules[set remainingRules {}] \
$earliestIndex $endi]
# Update current DST offset and time zone letter
set DSTOffset $save
set prevLetter $letter
# Reconvert the 'until' time in the current zone.
if {$until ne ""} {
set untilSecs [convertTimeOfDay $untilBaseSecs \
$stdGMTOffset $DSTOffset {expand}$untilTimeOfDay]
}
}
# Advance to the next year
incr year
set date [::tcl::clock::GetJulianDayFromEraYearMonthDay \
[dict create era CE year $year month 1 dayOfMonth 1]]
set startSecs [expr {
[dict get $date julianDay] * wide(86400) - 210866803200
- $stdGMTOffset - $DSTOffset
}]
# Get rules in effect in the new year.
lassign [divideRules $ruleSet $year] currentRules nSunsetRules
}
return [list $stdGMTOffset $DSTOffset]
}
#----------------------------------------------------------------------
#
|
| ︙ | ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | # not change in future years. # # Side effects: # None. # #---------------------------------------------------------------------- | | < | | | | | | | | < | < < | | | < | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 |
# not change in future years.
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc divideRules {ruleSet year} {
variable rules
set currentRules {}
set nSunsetRules 0
foreach {
fromYear toYear yearType monthIn daySpecOn timeAt save letter
} $rules($ruleSet) {
if {$toYear ne "maximum" && $year > $toYear} {
# ignore - rule is in the past
} else {
if {$fromYear eq "minimum" || $fromYear <= $year} {
lappend currentRules $fromYear $toYear $yearType $monthIn \
$daySpecOn $timeAt $save $letter
}
if {$toYear ne "maximum"} {
incr nSunsetRules
}
}
}
return [list $currentRules $nSunsetRules]
}
#----------------------------------------------------------------------
#
# findEarliestRule --
#
# Find the rule in a rule set that has the earliest start time.
#
# Parameters:
# remainingRules -- Rules to search
# year - Year being processed.
# stdGMTOffset - Current offset of standard time from GMT
# DSTOffset - Current offset of daylight time from standard,
# if daylight time is in effect.
#
# Results:
# Returns the index in remainingRules of the next rule to
# go into effect.
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc findEarliestRule {remainingRules year stdGMTOffset DSTOffset} {
set earliest $::MAXWIDE
set i 0
foreach {
fromYear toYear yearType monthIn daySpecOn timeAt save letter
} $remainingRules {
lappend daySpecOn $year $monthIn
set dayIn [eval $daySpecOn]
set secs [expr {wide(86400) * wide($dayIn) - 210866803200}]
set secs [convertTimeOfDay $secs \
$stdGMTOffset $DSTOffset {expand}$timeAt]
if {$secs < $earliest} {
set earliest $secs
set earliestIdx $i
}
incr i 8
}
return [list $earliest $earliestIdx]
}
#----------------------------------------------------------------------
#
# convertNamePattern --
#
# Converts a name pattern to the name of the time zone.
|
| ︙ | ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | # Returns the name of the time zone. # # Side effects: # None. # #---------------------------------------------------------------------- | | | | | 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 |
# Returns the name of the time zone.
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc convertNamePattern {pattern flag} {
if {[regexp {(.*)/(.*)} $pattern -> standard daylight]} {
if {$flag ne ""} {
set pattern $daylight
} else {
set pattern $standard
}
}
return [string map [list %s $flag] $pattern]
}
|
| ︙ | ︙ | |||
1200 1201 1202 1203 1204 1205 1206 | # seconds -- Time at which the GMT day starts, in seconds # from the Posix epoch # stdGMTOffset - Offset of Standard Time from Greenwich # DSTOffset - Offset of Daylight Time from standard. # timeOfDay - Time of day to convert, in seconds from midnight # flag - Flag indicating whether the time is Greenwich, Standard # or wall-clock. (g, s, or w) | | | | | | | | < | | | | | < | < | | | | | | 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 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 |
# seconds -- Time at which the GMT day starts, in seconds
# from the Posix epoch
# stdGMTOffset - Offset of Standard Time from Greenwich
# DSTOffset - Offset of Daylight Time from standard.
# timeOfDay - Time of day to convert, in seconds from midnight
# flag - Flag indicating whether the time is Greenwich, Standard
# or wall-clock. (g, s, or w)
#
# Results:
# Returns the time of day in seconds from the Posix epoch.
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc convertTimeOfDay {seconds stdGMTOffset DSTOffset timeOfDay flag} {
incr seconds $timeOfDay
switch -exact $flag {
g - u - z {
}
w {
incr seconds [expr {-$stdGMTOffset}]
incr seconds [expr {-$DSTOffset}]
}
z {
incr seconds [expr {-$stdGMTOffset}]
}
}
return $seconds
}
#----------------------------------------------------------------------
#
# processTimeZone --
#
# Generate the information about all time transitions in a
# time zone.
#
# Parameters:
# zoneName - Name of the time zone
# zoneData - List containing the rows describing the time zone,
# obtained from 'parseZone.
#
# Results:
# Returns a list of rows. Each row consists of a time in
# seconds from the Posix epoch, an offset from GMT to local
# that begins at that time, a flag indicating whether DST
# is in effect after that time, and the printable name of the
# timezone that goes into effect at that time.
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc processTimeZone {zoneName zoneData} {
set points {}
set i 0
foreach {startTime nextGMTOffset dstRule namePattern} $zoneData {
incr i 4
set until [lindex $zoneData $i]
if {![info exists stdGMTOffset]} {
set stdGMTOffset $nextGMTOffset
}
if {![info exists DSTOffset]} {
set DSTOffset 0
}
if {$startTime eq "minimum"} {
set secs $::MINWIDE
set year 0
} else {
lassign $startTime year month dayRule timeOfDay
lappend dayRule $year $month
set startDay [eval $dayRule]
set secs [expr {wide(86400) * wide($startDay) -210866803200}]
set secs [convertTimeOfDay $secs \
$stdGMTOffset $DSTOffset {expand}$timeOfDay]
}
lappend dstRule \
$year $secs $stdGMTOffset $DSTOffset $nextGMTOffset \
$namePattern $until points
lassign [eval $dstRule] stdGMTOffset DSTOffset
}
return $points
}
#----------------------------------------------------------------------
#
# writeZones --
|
| ︙ | ︙ | |||
1301 1302 1303 1304 1305 1306 1307 | # # Side effects: # Writes the time zone information files; traces what's happening # on the standard output. # #---------------------------------------------------------------------- | | < | | | | | | < | 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 |
#
# Side effects:
# Writes the time zone information files; traces what's happening
# on the standard output.
#
#----------------------------------------------------------------------
proc writeZones {outDir} {
variable zones
# Walk the zones
foreach zoneName [lsort -dictionary [array names zones]] {
puts "calculating: $zoneName"
set fileName [eval [list file join $outDir] [file split $zoneName]]
# Create directories as needed
set dirName [file dirname $fileName]
if {![file exists $dirName]} {
puts "creating directory: $dirName"
file mkdir $dirName
}
# Generate data for a zone
set data ""
foreach {
time offset dst name
} [processTimeZone $zoneName $zones($zoneName)] {
append data "\n " [list [list $time $offset $dst $name]]
}
append data \n
# Write the data to the information file
set f [open $fileName w]
puts $f "\# created by $::argv0 - do not edit"
puts $f ""
puts $f [list set TZData(:$zoneName) $data]
close $f
}
return
}
#----------------------------------------------------------------------
#
|
| ︙ | ︙ | |||
1358 1359 1360 1361 1362 1363 1364 | # # Results: # None. # # Side effects: # Creates a file for each link. | | < | | 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 |
#
# Results:
# None.
#
# Side effects:
# Creates a file for each link.
proc writeLinks {outDir} {
variable links
# Walk the links
foreach zoneName [lsort -dictionary [array names links]] {
puts "creating link: $zoneName"
set fileName [eval [list file join $outDir] [file split $zoneName]]
# Create directories as needed
set dirName [file dirname $fileName]
if {![file exists $dirName]} {
puts "creating directory: $dirName"
file mkdir $dirName
}
# Create code for the synonym
set linkTo $links($zoneName)
|
| ︙ | ︙ | |||
1403 1404 1405 1406 1407 1408 1409 | # # MAIN PROGRAM # #---------------------------------------------------------------------- # Determine directories | | | | | | 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 |
#
# MAIN PROGRAM
#
#----------------------------------------------------------------------
# Determine directories
lassign $argv inDir outDir
# Initialize count of errors
set errorCount 0
# Parse the Olson files
loadFiles $inDir
if {$errorCount > 0} {
exit 1
}
# Check that all riles appearing in Zone and Link lines actually exist
checkForwardRuleRefs
if {$errorCount > 0} {
exit 1
}
# Write the time zone information files
writeZones $outDir
writeLinks $outDir
if {$errorCount > 0} {
exit 1
}
# All done!
exit
|
Changes to tools/tcltk-man2html.tcl.
| ︙ | ︙ | |||
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 |
# Set defaults based on original code.
set tcltkdir ../..
set tkdir {}
set tcldir {}
set webdir ../html
set build_tcl 0
set build_tk 0
# Handle arguments a la GNU:
# --version
# --help
# --srcdir=/path
# --htmldir=/path
foreach option $argv {
switch -glob -- $option {
--version {
puts "tcltk-man-html $Version"
exit 0
}
--help {
puts "usage: tcltk-man-html \[OPTION\] ...\n"
puts " --help print this help, then exit"
puts " --version print version number, then exit"
puts " --srcdir=DIR find tcl and tk source below DIR"
puts " --htmldir=DIR put generated HTML in DIR"
puts " --tcl build tcl help"
puts " --tk build tk help"
exit 0
}
--srcdir=* {
# length of "--srcdir=" is 9.
set tcltkdir [string range $option 9 end]
}
--htmldir=* {
# length of "--htmldir=" is 10
set webdir [string range $option 10 end]
}
--tcl {
set build_tcl 1
}
--tk {
set build_tk 1
}
default {
puts stderr "tcltk-man-html: unrecognized option -- `$option'"
exit 1
}
}
}
if {!$build_tcl && !$build_tk} {set build_tcl 1; set build_tk 1}
if {$build_tcl} {
| > > > > > > > > > | | | | | | | | | | | | | | | | | 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 |
# Set defaults based on original code.
set tcltkdir ../..
set tkdir {}
set tcldir {}
set webdir ../html
set build_tcl 0
set build_tk 0
# Default search version is a glob pattern
set useversion {{,[8-9].[0-9]{,.[0-9]}}}
# Handle arguments a la GNU:
# --version
# --useversion=<version>
# --help
# --srcdir=/path
# --htmldir=/path
foreach option $argv {
switch -glob -- $option {
--version {
puts "tcltk-man-html $Version"
exit 0
}
--help {
puts "usage: tcltk-man-html \[OPTION\] ...\n"
puts " --help print this help, then exit"
puts " --version print version number, then exit"
puts " --srcdir=DIR find tcl and tk source below DIR"
puts " --htmldir=DIR put generated HTML in DIR"
puts " --tcl build tcl help"
puts " --tk build tk help"
puts " --useversion version of tcl/tk to search for"
exit 0
}
--srcdir=* {
# length of "--srcdir=" is 9.
set tcltkdir [string range $option 9 end]
}
--htmldir=* {
# length of "--htmldir=" is 10
set webdir [string range $option 10 end]
}
--useversion=* {
# length of "--useversion=" is 13
set useversion [string range $option 13 end]
}
--tcl {
set build_tcl 1
}
--tk {
set build_tk 1
}
default {
puts stderr "tcltk-man-html: unrecognized option -- `$option'"
exit 1
}
}
}
if {!$build_tcl && !$build_tk} {set build_tcl 1; set build_tk 1}
if {$build_tcl} {
# Find Tcl.
set tcldir [lindex [lsort [glob -nocomplain -tails -type d \
-directory $tcltkdir tcl$useversion]] end]
if {$tcldir == ""} then {
puts stderr "tcltk-man-html: couldn't find Tcl below $tcltkdir"
exit 1
}
puts "using Tcl source directory $tcldir"
}
if {$build_tk} {
# Find Tk.
set tkdir [lindex [lsort [glob -nocomplain -tails -type d \
-directory $tcltkdir tk$useversion]] end]
if {$tkdir == ""} then {
puts stderr "tcltk-man-html: couldn't find Tk below $tcltkdir"
exit 1
}
puts "using Tk source directory $tkdir"
}
# the title for the man pages overall
global overall_title
set overall_title ""
if {$build_tcl} {append overall_title "[capitalize $tcldir]"}
if {$build_tcl && $build_tk} {append overall_title "/"}
|
| ︙ | ︙ |
Changes to unix/Makefile.in.
1 2 3 4 5 6 7 | # # This file is a Makefile for Tcl. If it has the name "Makefile.in" # then it is a template for a Makefile; to generate the actual Makefile, # run "./configure", which is a configuration script generated by the # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # # This file is a Makefile for Tcl. If it has the name "Makefile.in" # then it is a template for a Makefile; to generate the actual Makefile, # run "./configure", which is a configuration script generated by the # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # # RCS: @(#) $Id: Makefile.in,v 1.163.2.1 2005/06/13 01:46:52 msofer Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ MINOR_VERSION = @TCL_MINOR_VERSION@ PATCH_LEVEL = @TCL_PATCH_LEVEL@ #---------------------------------------------------------------- |
| ︙ | ︙ | |||
34 35 36 37 38 39 40 | mandir = @mandir@ # The following definition can be set to non-null for special systems # like AFS with replication. It allows the pathnames used for installation # to be different than those used for actually reference files at # run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix # when installing files. | | | > > > | > > > > > > | | 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 | mandir = @mandir@ # The following definition can be set to non-null for special systems # like AFS with replication. It allows the pathnames used for installation # to be different than those used for actually reference files at # run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix # when installing files. INSTALL_ROOT = $(DESTDIR) # Path for the platform independent Tcl scripting libraries: TCL_LIBRARY = @TCL_LIBRARY@ # Path to use at runtime to refer to LIB_INSTALL_DIR: LIB_RUNTIME_DIR = $(libdir) # Directory in which to install the program tclsh: BIN_INSTALL_DIR = $(INSTALL_ROOT)$(bindir) # Directory in which to install libtcl.so or libtcl.a: LIB_INSTALL_DIR = $(INSTALL_ROOT)$(libdir) # Path name to use when installing library scripts. SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY) # Directory in which to install the include file tcl.h: INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir) # Path to the private tcl header dir: PRIVATE_INCLUDE_DIR = @PRIVATE_INCLUDE_DIR@ # Directory in which to (optionally) install the private tcl headers: PRIVATE_INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(PRIVATE_INCLUDE_DIR) # Top-level directory in which to install manual entries: MAN_INSTALL_DIR = $(INSTALL_ROOT)$(mandir) # Directory in which to install manual entry for tclsh: MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1 # Directory in which to install manual entries for Tcl's C library # procedures: MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3 # Directory in which to install manual entries for the built-in # Tcl commands: MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann # Path to the html documentation dir: HTML_DIR = @HTML_DIR@ # Directory in which to install html documentation: HTML_INSTALL_DIR = $(INSTALL_ROOT)$(HTML_DIR) # Package search path. TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ # Tcl Module default path roots (TIP189). TCL_MODULE_PATH = @TCL_MODULE_PATH@ # warning flags CFLAGS_WARNING = @CFLAGS_WARNING@ # The default switches for optimization or debugging CFLAGS_DEBUG = @CFLAGS_DEBUG@ CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ |
| ︙ | ︙ | |||
101 102 103 104 105 106 107 | LDFLAGS = @LDFLAGS_DEFAULT@ @LDFLAGS@ # To disable ANSI-C procedure prototypes reverse the comment characters # on the following lines: PROTO_FLAGS = #PROTO_FLAGS = -DNO_PROTOTYPE | < < < < < < | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | LDFLAGS = @LDFLAGS_DEFAULT@ @LDFLAGS@ # To disable ANSI-C procedure prototypes reverse the comment characters # on the following lines: PROTO_FLAGS = #PROTO_FLAGS = -DNO_PROTOTYPE # If you use the setenv, putenv, or unsetenv procedures to modify # environment variables in your application and you'd like those # modifications to appear in the "env" Tcl variable, switch the # comments on the two lines below so that Tcl provides these # procedures instead of your standard C library. ENV_FLAGS = |
| ︙ | ︙ | |||
159 160 161 162 163 164 165 | # Tcl used to let the configure script choose which program to use # for installing, but there are just too many different versions of # "install" around; better to use the install-sh script that comes # with the distribution, which is slower but guaranteed to work. INSTALL_STRIP_PROGRAM = -s | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# Tcl used to let the configure script choose which program to use
# for installing, but there are just too many different versions of
# "install" around; better to use the install-sh script that comes
# with the distribution, which is slower but guaranteed to work.
INSTALL_STRIP_PROGRAM = -s
INSTALL_STRIP_LIBRARY = -S -S
INSTALL = @srcdir@/install-sh -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_LIBRARY = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
# TCL_EXE is the name of a tclsh executable that is available *BEFORE*
|
| ︙ | ︙ | |||
234 235 236 237 238 239 240 241 242 243 244 245 246 247 | AC_FLAGS = @DEFS@ AR = @AR@ RANLIB = @RANLIB@ SRC_DIR = @srcdir@ TOP_DIR = $(SRC_DIR)/.. BUILD_DIR = @builddir@ GENERIC_DIR = $(TOP_DIR)/generic COMPAT_DIR = $(TOP_DIR)/compat TOOL_DIR = $(TOP_DIR)/tools UNIX_DIR = $(SRC_DIR) MAC_OSX_DIR = $(TOP_DIR)/macosx # Must be absolute because of the cd dltest $(DLTEST_DIR)/configure below. DLTEST_DIR = @TCL_SRC_DIR@/unix/dltest # Must be absolute to so the corresponding tcltest's tcl_library is absolute. | > | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | AC_FLAGS = @DEFS@ AR = @AR@ RANLIB = @RANLIB@ SRC_DIR = @srcdir@ TOP_DIR = $(SRC_DIR)/.. BUILD_DIR = @builddir@ GENERIC_DIR = $(TOP_DIR)/generic TOMMATH_DIR = $(TOP_DIR)/libtommath COMPAT_DIR = $(TOP_DIR)/compat TOOL_DIR = $(TOP_DIR)/tools UNIX_DIR = $(SRC_DIR) MAC_OSX_DIR = $(TOP_DIR)/macosx # Must be absolute because of the cd dltest $(DLTEST_DIR)/configure below. DLTEST_DIR = @TCL_SRC_DIR@/unix/dltest # Must be absolute to so the corresponding tcltest's tcl_library is absolute. |
| ︙ | ︙ | |||
267 268 269 270 271 272 273 |
# The information below should be usable as is. The configure
# script won't modify it and you shouldn't need to modify it
# either.
#----------------------------------------------------------------
CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
| | | | | | < | | > | > | > > > > > > > > > > > > > > > > > > | | | | 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 |
# The information below should be usable as is. The configure
# script won't modify it and you shouldn't need to modify it
# either.
#----------------------------------------------------------------
CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I${BUILD_DIR} -I${UNIX_DIR} -I${GENERIC_DIR} -DTCL_TOMMATH -I${TOMMATH_DIR} \
${AC_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} \
${NO_DEPRECATED_FLAGS} ${ENV_FLAGS} @EXTRA_CC_SWITCHES@
STUB_CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I${BUILD_DIR} -I${UNIX_DIR} -I${GENERIC_DIR} -DTCL_TOMMATH -I${TOMMATH_DIR} \
${AC_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} ${ENV_FLAGS} @EXTRA_CC_SWITCHES@
LIBS = @TCL_LIBS@
DEPEND_SWITCHES = ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} \
${AC_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} @EXTRA_CC_SWITCHES@
TCLSH_OBJS = tclAppInit.o
TCLTEST_OBJS = tclTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \
tclThreadTest.o tclUnixTest.o
XTTEST_OBJS = xtTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \
tclThreadTest.o tclUnixTest.o tclXtNotify.o tclXtTest.o
GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \
tclAsync.o tclBasic.o tclBinary.o tclCkalloc.o tclClock.o \
tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclCompCmds.o tclCompExpr.o \
tclCompile.o tclConfig.o tclDate.o tclDictObj.o tclEncoding.o \
tclEnv.o tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o \
tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o tclIOCmd.o \
tclIOGT.o tclIOSock.o tclIOUtil.o tclLink.o tclListObj.o \
tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o \
tclObj.o tclPanic.o tclParse.o tclParseExpr.o tclPathObj.o tclPipe.o \
tclPkg.o tclPkgConfig.o tclPosixStr.o \
tclPreserve.o tclProc.o tclRegexp.o \
tclResolve.o tclResult.o tclScan.o tclStringObj.o \
tclStrToD.o tclThread.o \
tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \
tclStubLib.o tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o \
tclTomMathInterface.o
TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \
bn_fast_s_mp_sqr.o bn_mp_add.o \
bn_mp_add_d.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o \
bn_mp_cmp.o bn_mp_cmp_mag.o bn_mp_copy.o bn_mp_count_bits.o \
bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o bn_mp_div_2d.o bn_mp_div_3.o \
bn_mp_exch.o bn_mp_grow.o bn_mp_init.o bn_mp_init_copy.o \
bn_mp_init_multi.o bn_mp_init_set.o \
bn_mp_init_size.o bn_mp_karatsuba_mul.o \
bn_mp_karatsuba_sqr.o \
bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mul.o bn_mp_mul_2.o \
bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_radix_size.o bn_mp_radix_smap.o \
bn_mp_read_radix.o bn_mp_rshd.o bn_mp_set.o bn_mp_sqr.o \
bn_mp_sub.o bn_mp_sub_d.o \
bn_mp_toom_mul.o bn_mp_toom_sqr.o \
bn_mp_toradix_n.o bn_mp_zero.o bn_s_mp_add.o \
bn_s_mp_mul_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o
STUB_LIB_OBJS = tclStubLib.o ${COMPAT_OBJS}
MAC_OSX_OBJS = tclMacOSXBundle.o tclMacOSXFCmd.o tclMacOSXNotify.o
OBJS = ${GENERIC_OBJS} ${TOMMATH_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} \
${COMPAT_OBJS} @DL_OBJS@ @PLAT_OBJS@
TCL_DECLS = \
$(GENERIC_DIR)/tcl.decls \
$(GENERIC_DIR)/tclInt.decls
GENERIC_HDRS = \
$(GENERIC_DIR)/tcl.h \
|
| ︙ | ︙ | |||
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 | $(GENERIC_DIR)/tclRegexp.c \ $(GENERIC_DIR)/tclResolve.c \ $(GENERIC_DIR)/tclResult.c \ $(GENERIC_DIR)/tclScan.c \ $(GENERIC_DIR)/tclStubInit.c \ $(GENERIC_DIR)/tclStubLib.c \ $(GENERIC_DIR)/tclStringObj.c \ $(GENERIC_DIR)/tclTest.c \ $(GENERIC_DIR)/tclTestObj.c \ $(GENERIC_DIR)/tclTestProcBodyObj.c \ $(GENERIC_DIR)/tclThread.c \ $(GENERIC_DIR)/tclThreadAlloc.c \ $(GENERIC_DIR)/tclThreadJoin.c \ $(GENERIC_DIR)/tclThreadStorage.c \ $(GENERIC_DIR)/tclTimer.c \ $(GENERIC_DIR)/tclTrace.c \ $(GENERIC_DIR)/tclUtil.c \ $(GENERIC_DIR)/tclVar.c STUB_SRCS = \ $(GENERIC_DIR)/tclStubLib.c UNIX_HDRS = \ $(UNIX_DIR)/tclUnixPort.h # $(UNIX_DIR)/tclConfig.h UNIX_SRCS = \ $(UNIX_DIR)/tclAppInit.c \ $(UNIX_DIR)/tclUnixChan.c \ $(UNIX_DIR)/tclUnixEvent.c \ $(UNIX_DIR)/tclUnixFCmd.c \ $(UNIX_DIR)/tclUnixFile.c \ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > > | > | > > | 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 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
$(GENERIC_DIR)/tclRegexp.c \
$(GENERIC_DIR)/tclResolve.c \
$(GENERIC_DIR)/tclResult.c \
$(GENERIC_DIR)/tclScan.c \
$(GENERIC_DIR)/tclStubInit.c \
$(GENERIC_DIR)/tclStubLib.c \
$(GENERIC_DIR)/tclStringObj.c \
$(GENERIC_DIR)/tclStrToD.c \
$(GENERIC_DIR)/tclTest.c \
$(GENERIC_DIR)/tclTestObj.c \
$(GENERIC_DIR)/tclTestProcBodyObj.c \
$(GENERIC_DIR)/tclThread.c \
$(GENERIC_DIR)/tclThreadAlloc.c \
$(GENERIC_DIR)/tclThreadJoin.c \
$(GENERIC_DIR)/tclThreadStorage.c \
$(GENERIC_DIR)/tclTimer.c \
$(GENERIC_DIR)/tclTrace.c \
$(GENERIC_DIR)/tclUtil.c \
$(GENERIC_DIR)/tclVar.c
STUB_SRCS = \
$(GENERIC_DIR)/tclStubLib.c
TOMMATH_SRCS = \
$(TOMMATH_DIR)/bncore.c \
$(TOMMATH_DIR)/bn_reverse.c \
$(TOMMATH_DIR)/bn_fast_s_mp_mul_digs.c \
$(TOMMATH_DIR)/bn_fast_s_mp_sqr.c \
$(TOMMATH_DIR)/bn_mp_add.c \
$(TOMMATH_DIR)/bn_mp_add_d.c \
$(TOMMATH_DIR)/bn_mp_clamp.c \
$(TOMMATH_DIR)/bn_mp_clear.c \
$(TOMMATH_DIR)/bn_mp_clear_multi.c \
$(TOMMATH_DIR)/bn_mp_cmp.c \
$(TOMMATH_DIR)/bn_mp_cmp_mag.c \
$(TOMMATH_DIR)/bn_mp_copy.c \
$(TOMMATH_DIR)/bn_mp_count_bits.c \
$(TOMMATH_DIR)/bn_mp_div.c \
$(TOMMATH_DIR)/bn_mp_div_d.c \
$(TOMMATH_DIR)/bn_mp_div_2.c \
$(TOMMATH_DIR)/bn_mp_div_2d.c \
$(TOMMATH_DIR)/bn_mp_div_3.c \
$(TOMMATH_DIR)/bn_mp_exch.c \
$(TOMMATH_DIR)/bn_mp_grow.c \
$(TOMMATH_DIR)/bn_mp_init.c \
$(TOMMATH_DIR)/bn_mp_init_copy.c \
$(TOMMATH_DIR)/bn_mp_init_multi.c \
$(TOMMATH_DIR)/bn_mp_init_set.c \
$(TOMMATH_DIR)/bn_mp_init_size.c \
$(TOMMATH_DIR)/bn_mp_karatsuba_mul.c \
$(TOMMATH_DIR)/bn_mp_karatsuba_sqr.c \
$(TOMMATH_DIR)/bn_mp_lshd.c \
$(TOMMATH_DIR)/bn_mp_mod.c \
$(TOMMATH_DIR)/bn_mp_mod_2d.c \
$(TOMMATH_DIR)/bn_mp_mul.c \
$(TOMMATH_DIR)/bn_mp_mul_2.c \
$(TOMMATH_DIR)/bn_mp_mul_2d.c \
$(TOMMATH_DIR)/bn_mp_mul_d.c \
$(TOMMATH_DIR)/bn_mp_radix_size.c \
$(TOMMATH_DIR)/bn_mp_radix_smap.c \
$(TOMMATH_DIR)/bn_mp_read_radix.c \
$(TOMMATH_DIR)/bn_mp_rshd.c \
$(TOMMATH_DIR)/bn_mp_set.c \
$(TOMMATH_DIR)/bn_mp_sqr.c \
$(TOMMATH_DIR)/bn_mp_sub.c \
$(TOMMATH_DIR)/bn_mp_sub_d.c \
$(TOMMATH_DIR)/bn_mp_toom_mul.c \
$(TOMMATH_DIR)/bn_mp_toom_sqr.c \
$(TOMMATH_DIR)/bn_mp_toradix_n.c \
$(TOMMATH_DIR)/bn_mp_zero.c \
$(TOMMATH_DIR)/bn_s_mp_add.c \
$(TOMMATH_DIR)/bn_s_mp_mul_digs.c \
$(TOMMATH_DIR)/bn_s_mp_sqr.c \
$(TOMMATH_DIR)/bn_s_mp_sub.c
UNIX_HDRS = \
$(UNIX_DIR)/tclUnixPort.h
# $(UNIX_DIR)/tclConfig.h
UNIX_SRCS = \
$(UNIX_DIR)/tclAppInit.c \
$(UNIX_DIR)/tclUnixChan.c \
$(UNIX_DIR)/tclUnixEvent.c \
$(UNIX_DIR)/tclUnixFCmd.c \
$(UNIX_DIR)/tclUnixFile.c \
$(UNIX_DIR)/tclUnixPipe.c \
$(UNIX_DIR)/tclUnixSock.c \
$(UNIX_DIR)/tclUnixTest.c \
$(UNIX_DIR)/tclUnixThrd.c \
$(UNIX_DIR)/tclUnixTime.c \
$(UNIX_DIR)/tclUnixInit.c
NOTIFY_SRCS = \
$(UNIX_DIR)/tclUnixNotfy.c
DL_SRCS = \
$(UNIX_DIR)/tclLoadAix.c \
$(UNIX_DIR)/tclLoadAout.c \
$(UNIX_DIR)/tclLoadDl.c \
$(UNIX_DIR)/tclLoadDl2.c \
$(UNIX_DIR)/tclLoadDld.c \
$(UNIX_DIR)/tclLoadDyld.c \
$(GENERIC_DIR)/tclLoadNone.c \
$(UNIX_DIR)/tclLoadOSF.c \
$(UNIX_DIR)/tclLoadShl.c
MAC_OSX_SRCS = \
$(MAC_OSX_DIR)/tclMacOSXBundle.c \
$(MAC_OSX_DIR)/tclMacOSXFCmd.c \
$(MAC_OSX_DIR)/tclMacOSXNotify.c
# Note: don't include DL_SRCS or MAC_OSX_SRCS in SRCS: most of those
# files won't compile on the current machine, and they will cause
# problems for things like "make depend".
SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) \
$(UNIX_SRCS) $(NOTIFY_SRCS) $(STUB_SRCS) \
@PLAT_SRCS@
all: binaries libraries doc
binaries: ${LIB_FILE} $(STUB_LIB_FILE) $(TCL_BUILD_EXP_FILE) tclsh
libraries:
|
| ︙ | ︙ | |||
493 494 495 496 497 498 499 | # "make test" won't work in the case where the compilation directory # isn't the same as the source directory. # Specifying TESTFLAGS on the command line is the standard way to pass # args to tcltest, ie: # % make test TESTFLAGS="-verbose bps -file fileName.test" test: tcltest | | | | | | | | | 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 |
# "make test" won't work in the case where the compilation directory
# isn't the same as the source directory.
# Specifying TESTFLAGS on the command line is the standard way to pass
# args to tcltest, ie:
# % make test TESTFLAGS="-verbose bps -file fileName.test"
test: tcltest
@LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
./tcltest $(TOP_DIR)/tests/all.tcl $(TESTFLAGS) $(TCLTESTARGS)
# Useful target to launch a built tcltest with the proper path,...
runtest: tcltest
@LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
./tcltest
# Useful target for running the test suite with an unwritable current
# directory...
ro-test: tcltest
@LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
echo 'exec chmod -w .;package require tcltest;tcltest::temporaryDirectory /tmp;source ../tests/all.tcl;exec chmod +w .' | ./tcltest
# This target can be used to run tclsh from the build directory
# via `make shell SCRIPT=/tmp/foo.tcl`
shell: tclsh
@LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
./tclsh $(SCRIPT)
# This target can be used to run tclsh inside either gdb or insight
gdb: tclsh
@echo "set env @LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}" > gdb.run
@echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run
$(GDB) ./tclsh --command=gdb.run
rm gdb.run
# This target can be used to run tclsh inside ddd
ddd: tclsh
@echo "set env @LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}" > gdb.run
@echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run
$(DDD) -command=gdb.run ./tclsh
rm gdb.run
valgrind: tclsh tcltest
@LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
valgrind --num-callers=8 --leak-resolution=high -v --leak-check=yes --show-reachable=yes $(VALGRINDARGS) ./tcltest $(TOP_DIR)/tests/all.tcl -singleproc 1 $(TESTFLAGS) $(TCLTESTARGS)
# The following target outputs the name of the top-level source directory
# for Tcl (it is used by Tk's configure script, for example). The
# .NO_PARALLEL line is needed to avoid problems under Sun's "pmake".
# Note: this target is now obsolete (use the autoconf variable
|
| ︙ | ︙ | |||
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | # -e '/#ifdef __STDC__/,/#endif/d' -e '/TclDateerrlab:/d' \ # -e '/TclDatenewstate:/d' -e '/#pragma/d' \ # -e '/#include <inttypes.h>/d' -e 's/const /CONST /g' \ # -e '/#define YYNEW/s/malloc/TclDateAlloc/g' \ # -e '/#define YYENLARGE/,/realloc/s/realloc/TclDateRealloc/g' \ # <y.tab.c >$(GENERIC_DIR)/tclDate.c # rm y.tab.c # The following target generates the shared libraries in dltest/ that # are used for testing; they are included as part of the "tcltest" # target (via the BUILD_DLTEST variable) if dynamic loading is supported # on this platform. The Makefile in the dltest subdirectory creates # the dltest.marker file in this directory after a successful build. dltest.marker: cd dltest ; $(MAKE) | > > > > > > > > > | > > | | 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 |
# -e '/#ifdef __STDC__/,/#endif/d' -e '/TclDateerrlab:/d' \
# -e '/TclDatenewstate:/d' -e '/#pragma/d' \
# -e '/#include <inttypes.h>/d' -e 's/const /CONST /g' \
# -e '/#define YYNEW/s/malloc/TclDateAlloc/g' \
# -e '/#define YYENLARGE/,/realloc/s/realloc/TclDateRealloc/g' \
# <y.tab.c >$(GENERIC_DIR)/tclDate.c
# rm y.tab.c
# The following target generates the file generic/tommath.h.
# It needs to be run (and the results checked) after updating
# to a new release of libtommath.
gentommath_h:
$(TCL_EXE) "$(TOP_DIR)/tools/fix_tommath_h.tcl" \
"$(TOMMATH_DIR)/tommath.h" \
> "$(GENERIC_DIR)/tommath.h"
# The following target generates the shared libraries in dltest/ that
# are used for testing; they are included as part of the "tcltest"
# target (via the BUILD_DLTEST variable) if dynamic loading is supported
# on this platform. The Makefile in the dltest subdirectory creates
# the dltest.marker file in this directory after a successful build.
dltest.marker:
cd dltest ; $(MAKE)
INSTALL_TARGETS = install-binaries install-libraries install-doc @EXTRA_INSTALL@
install: $(INSTALL_TARGETS)
install-strip:
$(MAKE) $(INSTALL_TARGETS) \
INSTALL_PROGRAM="$(INSTALL_PROGRAM) ${INSTALL_STRIP_PROGRAM}" \
INSTALL_LIBRARY="$(INSTALL_LIBRARY) ${INSTALL_STRIP_LIBRARY}"
# Note: before running ranlib below, must cd to target directory because
# some ranlibs write to current directory, and this might not always be
# possible (e.g. if installing as root).
|
| ︙ | ︙ | |||
618 619 620 621 622 623 624 625 626 627 628 629 630 631 | @$(INSTALL_PROGRAM) tclsh $(BIN_INSTALL_DIR)/tclsh$(VERSION) @echo "Installing tclConfig.sh to $(LIB_INSTALL_DIR)/" @$(INSTALL_DATA) tclConfig.sh $(LIB_INSTALL_DIR)/tclConfig.sh @if test "$(STUB_LIB_FILE)" != "" ; then \ echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ @INSTALL_STUB_LIB@ ; \ fi install-libraries: libraries install-tzdata install-msgs @for i in $(INCLUDE_INSTALL_DIR) $(SCRIPT_INSTALL_DIR); \ do \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ mkdir -p $$i; \ | > | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | @$(INSTALL_PROGRAM) tclsh $(BIN_INSTALL_DIR)/tclsh$(VERSION) @echo "Installing tclConfig.sh to $(LIB_INSTALL_DIR)/" @$(INSTALL_DATA) tclConfig.sh $(LIB_INSTALL_DIR)/tclConfig.sh @if test "$(STUB_LIB_FILE)" != "" ; then \ echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ @INSTALL_STUB_LIB@ ; \ fi @EXTRA_INSTALL_BINARIES@ install-libraries: libraries install-tzdata install-msgs @for i in $(INCLUDE_INSTALL_DIR) $(SCRIPT_INSTALL_DIR); \ do \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ mkdir -p $$i; \ |
| ︙ | ︙ | |||
680 681 682 683 684 685 686 |
echo "Customizing tcl module path"; \
echo "::tcl::tm::roots {$(TCL_MODULE_PATH)}" >> \
$(SCRIPT_INSTALL_DIR)/tm.tcl; \
fi
install-tzdata:
@echo "Installing time zone data"
| | | | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
echo "Customizing tcl module path"; \
echo "::tcl::tm::roots {$(TCL_MODULE_PATH)}" >> \
$(SCRIPT_INSTALL_DIR)/tm.tcl; \
fi
install-tzdata:
@echo "Installing time zone data"
@@LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
./tclsh $(TOOL_DIR)/installData.tcl \
$(TOP_DIR)/library/tzdata $(SCRIPT_INSTALL_DIR)/tzdata
install-msgs:
@echo "Installing message catalogs"
@@LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
./tclsh $(TOOL_DIR)/installData.tcl \
$(TOP_DIR)/library/msgs $(SCRIPT_INSTALL_DIR)/msgs
install-doc: doc
@if test ! -x $(UNIX_DIR)/installManPage; then \
chmod +x $(UNIX_DIR)/installManPage; \
|
| ︙ | ︙ | |||
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | @echo "Installing private header files"; @for i in $(GENERIC_DIR)/tclInt.h $(GENERIC_DIR)/tclIntDecls.h \ $(GENERIC_DIR)/tclIntPlatDecls.h $(GENERIC_DIR)/tclPort.h \ $(UNIX_DIR)/tclUnixPort.h; \ do \ $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \ done; Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status #tclConfig.h: $(UNIX_DIR)/tclConfig.h.in # $(SHELL) config.status clean: rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ | > > > | | | 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 | @echo "Installing private header files"; @for i in $(GENERIC_DIR)/tclInt.h $(GENERIC_DIR)/tclIntDecls.h \ $(GENERIC_DIR)/tclIntPlatDecls.h $(GENERIC_DIR)/tclPort.h \ $(UNIX_DIR)/tclUnixPort.h; \ do \ $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \ done; @if test -f tclConfig.h; then\ $(INSTALL_DATA) tclConfig.h $(PRIVATE_INCLUDE_INSTALL_DIR); \ fi; Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status #tclConfig.h: $(UNIX_DIR)/tclConfig.h.in # $(SHELL) config.status clean: rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ errors tclsh tcltest lib.exp Tcl cd dltest ; $(MAKE) clean distclean: clean rm -rf Makefile config.status config.cache config.log tclConfig.sh \ $(PACKAGE).* prototype tclConfig.h *.plist Tcl.framework cd dltest ; $(MAKE) distclean depend: makedepend -- $(DEPEND_SWITCHES) -- $(SRCS) # Test binaries. The rules for tclTestInit.o and xtTestInit.o are # complicated because they are compiled from tclAppInit.c. Can't use |
| ︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | tclScan.o: $(GENERIC_DIR)/tclScan.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclScan.c tclStringObj.o: $(GENERIC_DIR)/tclStringObj.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStringObj.c tclStubInit.o: $(GENERIC_DIR)/tclStubInit.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStubInit.c tclTrace.o: $(GENERIC_DIR)/tclTrace.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclTrace.c tclUtil.o: $(GENERIC_DIR)/tclUtil.c | > > > | 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | tclScan.o: $(GENERIC_DIR)/tclScan.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclScan.c tclStringObj.o: $(GENERIC_DIR)/tclStringObj.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStringObj.c tclStrToD.o: $(GENERIC_DIR)/tclStrToD.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStrToD.c tclStubInit.o: $(GENERIC_DIR)/tclStubInit.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStubInit.c tclTrace.o: $(GENERIC_DIR)/tclTrace.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclTrace.c tclUtil.o: $(GENERIC_DIR)/tclUtil.c |
| ︙ | ︙ | |||
1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | tclThreadStorage.o: $(GENERIC_DIR)/tclThreadStorage.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadStorage.c tclThreadTest.o: $(GENERIC_DIR)/tclThreadTest.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadTest.c tclUnixChan.o: $(UNIX_DIR)/tclUnixChan.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixChan.c tclUnixEvent.o: $(UNIX_DIR)/tclUnixEvent.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixEvent.c tclUnixFCmd.o: $(UNIX_DIR)/tclUnixFCmd.c | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 | tclThreadStorage.o: $(GENERIC_DIR)/tclThreadStorage.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadStorage.c tclThreadTest.o: $(GENERIC_DIR)/tclThreadTest.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadTest.c tclTomMathInterface.o: $(GENERIC_DIR)/tclTomMathInterface.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclTomMathInterface.c bncore.o: $(TOMMATH_DIR)/bncore.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bncore.c bn_reverse.o: $(TOMMATH_DIR)/bn_reverse.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_reverse.c bn_fast_s_mp_mul_digs.o: $(TOMMATH_DIR)/bn_fast_s_mp_mul_digs.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_fast_s_mp_mul_digs.c bn_fast_s_mp_sqr.o: $(TOMMATH_DIR)/bn_fast_s_mp_sqr.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_fast_s_mp_sqr.c bn_mp_add.o: $(TOMMATH_DIR)/bn_mp_add.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_add.c bn_mp_add_d.o: $(TOMMATH_DIR)/bn_mp_add_d.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_add_d.c bn_mp_clamp.o: $(TOMMATH_DIR)/bn_mp_clamp.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_clamp.c bn_mp_clear.o: $(TOMMATH_DIR)/bn_mp_clear.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_clear.c bn_mp_clear_multi.o: $(TOMMATH_DIR)/bn_mp_clear_multi.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_clear_multi.c bn_mp_cmp.o: $(TOMMATH_DIR)/bn_mp_cmp.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_cmp.c bn_mp_cmp_mag.o: $(TOMMATH_DIR)/bn_mp_cmp_mag.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_cmp_mag.c bn_mp_copy.o: $(TOMMATH_DIR)/bn_mp_copy.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_copy.c bn_mp_count_bits.o: $(TOMMATH_DIR)/bn_mp_count_bits.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_count_bits.c bn_mp_div.o: $(TOMMATH_DIR)/bn_mp_div.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_div.c bn_mp_div_d.o: $(TOMMATH_DIR)/bn_mp_div_d.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_div_d.c bn_mp_div_2.o: $(TOMMATH_DIR)/bn_mp_div_2.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_div_2.c bn_mp_div_2d.o: $(TOMMATH_DIR)/bn_mp_div_2d.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_div_2d.c bn_mp_div_3.o: $(TOMMATH_DIR)/bn_mp_div_3.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_div_3.c bn_mp_exch.o: $(TOMMATH_DIR)/bn_mp_exch.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_exch.c bn_mp_grow.o: $(TOMMATH_DIR)/bn_mp_grow.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_grow.c bn_mp_init.o: $(TOMMATH_DIR)/bn_mp_init.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_init.c bn_mp_init_copy.o: $(TOMMATH_DIR)/bn_mp_init_copy.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_init_copy.c bn_mp_init_multi.o: $(TOMMATH_DIR)/bn_mp_init_multi.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_init_multi.c bn_mp_init_set.o: $(TOMMATH_DIR)/bn_mp_init_set.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_init_set.c bn_mp_init_size.o:$(TOMMATH_DIR)/bn_mp_init_size.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_init_size.c bn_mp_karatsuba_mul.o: $(TOMMATH_DIR)/bn_mp_karatsuba_mul.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_karatsuba_mul.c bn_mp_karatsuba_sqr.o: $(TOMMATH_DIR)/bn_mp_karatsuba_sqr.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_karatsuba_sqr.c bn_mp_lshd.o: $(TOMMATH_DIR)/bn_mp_lshd.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_lshd.c bn_mp_mod.o: $(TOMMATH_DIR)/bn_mp_mod.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_mod.c bn_mp_mod_2d.o: $(TOMMATH_DIR)/bn_mp_mod_2d.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_mod_2d.c bn_mp_mul.o: $(TOMMATH_DIR)/bn_mp_mul.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_mul.c bn_mp_mul_2.o: $(TOMMATH_DIR)/bn_mp_mul_2.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_mul_2.c bn_mp_mul_2d.o: $(TOMMATH_DIR)/bn_mp_mul_2d.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_mul_2d.c bn_mp_mul_d.o: $(TOMMATH_DIR)/bn_mp_mul_d.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_mul_d.c bn_mp_radix_size.o: $(TOMMATH_DIR)/bn_mp_radix_size.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_radix_size.c bn_mp_radix_smap.o: $(TOMMATH_DIR)/bn_mp_radix_smap.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_radix_smap.c bn_mp_read_radix.o: $(TOMMATH_DIR)/bn_mp_read_radix.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_read_radix.c bn_mp_rshd.o: $(TOMMATH_DIR)/bn_mp_rshd.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_rshd.c bn_mp_set.o: $(TOMMATH_DIR)/bn_mp_set.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set.c bn_mp_sqr.o: $(TOMMATH_DIR)/bn_mp_sqr.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_sqr.c bn_mp_sub.o: $(TOMMATH_DIR)/bn_mp_sub.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_sub.c bn_mp_sub_d.o: $(TOMMATH_DIR)/bn_mp_sub_d.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_sub_d.c bn_mp_toom_mul.o: $(TOMMATH_DIR)/bn_mp_toom_mul.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_toom_mul.c bn_mp_toom_sqr.o: $(TOMMATH_DIR)/bn_mp_toom_sqr.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_toom_sqr.c bn_mp_toradix_n.o: $(TOMMATH_DIR)/bn_mp_toradix_n.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_toradix_n.c bn_mp_zero.o: $(TOMMATH_DIR)/bn_mp_zero.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_zero.c bn_s_mp_add.o: $(TOMMATH_DIR)/bn_s_mp_add.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_s_mp_add.c bn_s_mp_mul_digs.o: $(TOMMATH_DIR)/bn_s_mp_mul_digs.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_s_mp_mul_digs.c bn_s_mp_sqr.o: $(TOMMATH_DIR)/bn_s_mp_sqr.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_s_mp_sqr.c bn_s_mp_sub.o: $(TOMMATH_DIR)/bn_s_mp_sub.c $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_s_mp_sub.c tclUnixChan.o: $(UNIX_DIR)/tclUnixChan.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixChan.c tclUnixEvent.o: $(UNIX_DIR)/tclUnixEvent.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixEvent.c tclUnixFCmd.o: $(UNIX_DIR)/tclUnixFCmd.c |
| ︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 |
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixTime.c
tclUnixInit.o: $(UNIX_DIR)/tclUnixInit.c tclConfig.sh
$(CC) -c $(CC_SWITCHES) -DTCL_LIBRARY=\"${TCL_LIBRARY}\" \
-DTCL_PACKAGE_PATH="\"${TCL_PACKAGE_PATH}\"" \
$(UNIX_DIR)/tclUnixInit.c
| | > > > | 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 |
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixTime.c
tclUnixInit.o: $(UNIX_DIR)/tclUnixInit.c tclConfig.sh
$(CC) -c $(CC_SWITCHES) -DTCL_LIBRARY=\"${TCL_LIBRARY}\" \
-DTCL_PACKAGE_PATH="\"${TCL_PACKAGE_PATH}\"" \
$(UNIX_DIR)/tclUnixInit.c
# The following are Mac OS X only sources:
tclMacOSXBundle.o: $(MAC_OSX_DIR)/tclMacOSXBundle.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tclMacOSXBundle.c
tclMacOSXFCmd.o: $(MAC_OSX_DIR)/tclMacOSXFCmd.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tclMacOSXFCmd.c
tclMacOSXNotify.o: $(MAC_OSX_DIR)/tclMacOSXNotify.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tclMacOSXNotify.c
# The following targets are not completely general. They are provide
# purely for documentation purposes so people who are interested in
# the Xt based notifier can modify them to suit their own installation.
xttest: ${XTTEST_OBJS} ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} \
@DL_OBJS@ ${BUILD_DLTEST}
${CC} ${XTTEST_OBJS} ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} \
|
| ︙ | ︙ | |||
1173 1174 1175 1176 1177 1178 1179 | $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/tmpnam.c waitpid.o: $(COMPAT_DIR)/waitpid.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/waitpid.c # Stub library binaries, these must be compiled for use in a shared library # even though they will be placed in a static archive | < | 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 | $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/tmpnam.c waitpid.o: $(COMPAT_DIR)/waitpid.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/waitpid.c # Stub library binaries, these must be compiled for use in a shared library # even though they will be placed in a static archive tclStubLib.o: $(GENERIC_DIR)/tclStubLib.c $(CC) -c $(STUB_CC_SWITCHES) $(GENERIC_DIR)/tclStubLib.c .c.o: $(CC) -c $(CC_SWITCHES) $< |
| ︙ | ︙ | |||
1263 1264 1265 1266 1267 1268 1269 | rpm -bb THIS.TCL.SPEC mv RPMS/i386/*.rpm . rm -rf RPMS THIS.TCL.SPEC # # Target to create a proper Tcl distribution from information in the # master source directory. DISTDIR must be defined to indicate where | | | 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 |
rpm -bb THIS.TCL.SPEC
mv RPMS/i386/*.rpm .
rm -rf RPMS THIS.TCL.SPEC
#
# Target to create a proper Tcl distribution from information in the
# master source directory. DISTDIR must be defined to indicate where
# to put the distribution. DISTDIR must be an absolute path name.
#
DISTROOT = /tmp/dist
DISTNAME = tcl${VERSION}${PATCH_LEVEL}
ZIPNAME = tcl${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip
DISTDIR = $(DISTROOT)/$(DISTNAME)
$(UNIX_DIR)/configure: $(UNIX_DIR)/configure.in $(UNIX_DIR)/tcl.m4
|
| ︙ | ︙ | |||
1351 1352 1353 1354 1355 1356 1357 | $(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/tcl.hpj.in cp -p $(TOP_DIR)/win/tcl.ds* $(DISTDIR)/win $(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/tcl.ds* cp -p $(TOP_DIR)/win/README $(DISTDIR)/win cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win mkdir $(DISTDIR)/macosx cp -p $(TOP_DIR)/macosx/Makefile \ | | > > > | 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 | $(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/tcl.hpj.in cp -p $(TOP_DIR)/win/tcl.ds* $(DISTDIR)/win $(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/tcl.ds* cp -p $(TOP_DIR)/win/README $(DISTDIR)/win cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win mkdir $(DISTDIR)/macosx cp -p $(TOP_DIR)/macosx/Makefile \ $(TOP_DIR)/macosx/*.c $(TOP_DIR)/macosx/*.in \ $(DISTDIR)/macosx mkdir $(DISTDIR)/macosx/Tcl.pbproj cp -p $(TOP_DIR)/macosx/Tcl.pbproj/*.pbx* $(DISTDIR)/macosx/Tcl.pbproj cp -p $(TOP_DIR)/macosx/README $(DISTDIR)/macosx mkdir $(DISTDIR)/unix/dltest cp -p $(UNIX_DIR)/dltest/*.c $(UNIX_DIR)/dltest/Makefile.in \ $(UNIX_DIR)/dltest/README \ $(DISTDIR)/unix/dltest mkdir $(DISTDIR)/tools cp -p $(TOP_DIR)/tools/Makefile.in $(TOP_DIR)/tools/README \ $(TOP_DIR)/tools/configure $(TOP_DIR)/tools/configure.in \ $(TOP_DIR)/tools/*.tcl $(TOP_DIR)/tools/man2tcl.c \ $(TOP_DIR)/tools/tcl.wse.in $(TOP_DIR)/tools/*.bmp \ $(TOP_DIR)/tools/tcl.hpj.in \ $(DISTDIR)/tools $(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/tools/tcl.hpj.in \ $(DISTDIR)/tools/tcl.wse.in mkdir $(DISTDIR)/libtommath cp -p $(TOP_DIR)/libtommath/*.* \ $(DISTDIR)/libtommath # # The following target can only be used for non-patch releases. Use # the "allpatch" target below for patch releases. # alldist: dist |
| ︙ | ︙ | |||
1401 1402 1403 1404 1405 1406 1407 |
mv $(DISTROOT)/tcl${VERSION} $(DISTROOT)/$(DISTNAME)
mv $(DISTROOT)/old $(DISTROOT)/tcl${VERSION}
#
# This target creates the HTML folder for Tcl & Tk and places it
# in DISTDIR/html. It uses the tcltk-man2html.tcl tool from
# the Tcl group's tool workspace. It depends on the Tcl & Tk being
| | > > > > > | | | 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 |
mv $(DISTROOT)/tcl${VERSION} $(DISTROOT)/$(DISTNAME)
mv $(DISTROOT)/old $(DISTROOT)/tcl${VERSION}
#
# This target creates the HTML folder for Tcl & Tk and places it
# in DISTDIR/html. It uses the tcltk-man2html.tcl tool from
# the Tcl group's tool workspace. It depends on the Tcl & Tk being
# in directories called tcl8.* & tk8.* up two directories from the
# TOOL_DIR.
#
html:
$(BUILD_HTML)
@EXTRA_BUILD_HTML@
html-tcl:
$(BUILD_HTML) --tcl
@EXTRA_BUILD_HTML@
html-tk:
$(BUILD_HTML) --tk
@EXTRA_BUILD_HTML@
BUILD_HTML = \
@@LD_LIBRARY_PATH_VAR@=`pwd`:$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
./tclsh $(TOOL_DIR)/tcltk-man2html.tcl --htmldir=$(HTML_INSTALL_DIR) \
--srcdir=$(TOP_DIR)/.. $(BUILD_HTML_FLAGS)
#
# Targets to build Solaris package of the distribution for the current
# architecture. To build stream packages for both sun4 and i86pc
# architectures:
#
# On the sun4 machine, execute the following:
|
| ︙ | ︙ |
Changes to unix/configure.
| ︙ | ︙ | |||
304 305 306 307 308 309 310 | # include <stdint.h> # endif #endif #if HAVE_UNISTD_H # include <unistd.h> #endif" | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | # include <stdint.h> # endif #endif #if HAVE_UNISTD_H # include <unistd.h> #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAN_FLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP TCL_THREADS RANLIB ac_ct_RANLIB AR LIBOBJS TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS PLAT_SRCS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING LDFLAGS_DEBUG LDFLAGS_OPTIMIZE CC_SEARCH_FLAGS LD_SEARCH_FLAGS STLIB_LD SHLIB_LD TCL_SHLIB_LD_EXTRAS TK_SHLIB_LD_EXTRAS SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX MAKE_LIB MAKE_STUB_LIB INSTALL_LIB INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_YEAR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_STUB_LIB_PATH TCL_INCLUDE_SPEC TCL_BUILD_STUB_LIB_SPEC TCL_BUILD_STUB_LIB_PATH TCL_SRC_DIR CFG_TCL_SHARED_LIB_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_EXPORT_FILE_SUFFIX TCL_SHARED_BUILD LD_LIBRARY_PATH_VAR TCL_BUILD_LIB_SPEC TCL_NEEDS_EXP_FILE TCL_BUILD_EXP_FILE TCL_EXP_FILE TCL_LIB_VERSIONS_OK TCL_SHARED_LIB_SUFFIX TCL_UNSHARED_LIB_SUFFIX TCL_HAS_LONGLONG BUILD_DLTEST TCL_PACKAGE_PATH TCL_MODULE_PATH TCL_LIBRARY PRIVATE_INCLUDE_DIR HTML_DIR EXTRA_CC_SWITCHES EXTRA_INSTALL EXTRA_INSTALL_BINARIES EXTRA_BUILD_HTML' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. |
| ︙ | ︙ | |||
837 838 839 840 841 842 843 |
short | recursive ) echo "Configuration of tcl 8.5:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
| | | | > | | | | > > | | | > | | | > | 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 |
short | recursive ) echo "Configuration of tcl 8.5:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-man-symlinks use symlinks for the manpages (default: off)
--enable-man-compression=PROG
compress the manpages with PROG (default: off)
--enable-man-suffix=STRING
use STRING as a suffix to manpage file names
(default: no, tcl if enabled without
specifying STRING)
--enable-threads build with threads (default: off)
--enable-shared build and link with shared libraries (default: on)
--enable-64bit enable 64bit support (default: off)
--enable-64bit-vis enable 64bit Sparc VIS support (default: off)
--enable-corefoundation use CoreFoundation API on MacOSX (default: yes)
--disable-load disallow dynamic loading and "load" command
(default: enabled)
--enable-symbols build with debugging symbols (default: off)
--enable-langinfo use nl_langinfo if possible to determine encoding at
startup, otherwise use old heuristic (default: on)
--enable-dll-unloading turn on the 'unload' command (default: on)
--enable-framework package shared libraries in MacOSX frameworks
(default: off)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-encoding encoding for configuration values (default:
iso8859-1)
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
|
| ︙ | ︙ | |||
959 960 961 962 963 964 965 |
elif test -f $ac_srcdir/configure.ac ||
test -f $ac_srcdir/configure.in; then
echo
$ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
| | | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 |
elif test -f $ac_srcdir/configure.ac ||
test -f $ac_srcdir/configure.in; then
echo
$ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
cd "$ac_popdir"
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
tcl configure 8.5
|
| ︙ | ︙ | |||
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 | TCL_VERSION=8.5 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=5 | > | < < < | | | | | > | | > | > | | | | | | | | | | | | > | > | > | | 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 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 |
TCL_VERSION=8.5
TCL_MAJOR_VERSION=8
TCL_MINOR_VERSION=5
TCL_PATCH_LEVEL="a4"
VERSION=${TCL_VERSION}
#------------------------------------------------------------------------
# Handle the --prefix=... option
#------------------------------------------------------------------------
if test "${prefix}" = "NONE"; then
prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
TCL_SRC_DIR=`cd $srcdir/..; pwd`
#------------------------------------------------------------------------
# Compress and/or soft link the manpages?
#------------------------------------------------------------------------
echo "$as_me:$LINENO: checking whether to use symlinks for manpages" >&5
echo $ECHO_N "checking whether to use symlinks for manpages... $ECHO_C" >&6
# Check whether --enable-man-symlinks or --disable-man-symlinks was given.
if test "${enable_man_symlinks+set}" = set; then
enableval="$enable_man_symlinks"
test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks"
else
enableval="no"
fi;
echo "$as_me:$LINENO: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
echo "$as_me:$LINENO: checking whether to compress the manpages" >&5
echo $ECHO_N "checking whether to compress the manpages... $ECHO_C" >&6
# Check whether --enable-man-compression or --disable-man-compression was given.
if test "${enable_man_compression+set}" = set; then
enableval="$enable_man_compression"
case $enableval in
yes) { { echo "$as_me:$LINENO: error: missing argument to --enable-man-compression" >&5
echo "$as_me: error: missing argument to --enable-man-compression" >&2;}
{ (exit 1); exit 1; }; };;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
esac
else
enableval="no"
fi;
echo "$as_me:$LINENO: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
if test "$enableval" != "no"; then
echo "$as_me:$LINENO: checking for compressed file suffix" >&5
echo $ECHO_N "checking for compressed file suffix... $ECHO_C" >&6
touch TeST
$enableval TeST
Z=`ls TeST* | sed 's/^....//'`
rm -f TeST*
MAN_FLAGS="$MAN_FLAGS --extension $Z"
echo "$as_me:$LINENO: result: $Z" >&5
echo "${ECHO_T}$Z" >&6
fi
echo "$as_me:$LINENO: checking whether to add a package name suffix for the manpages" >&5
echo $ECHO_N "checking whether to add a package name suffix for the manpages... $ECHO_C" >&6
# Check whether --enable-man-suffix or --disable-man-suffix was given.
if test "${enable_man_suffix+set}" = set; then
enableval="$enable_man_suffix"
case $enableval in
yes) enableval="tcl";;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
esac
else
enableval="no"
fi;
echo "$as_me:$LINENO: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
#------------------------------------------------------------------------
# Standard compiler checks
|
| ︙ | ︙ | |||
1975 1976 1977 1978 1979 1980 1981 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
2034 2035 2036 2037 2038 2039 2040 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
2151 2152 2153 2154 2155 2156 2157 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
2206 2207 2208 2209 2210 2211 2212 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
2252 2253 2254 2255 2256 2257 2258 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
2297 2298 2299 2300 2301 2302 2303 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
2346 2347 2348 2349 2350 2351 2352 | # Supply substitutes for missing POSIX header files. Special notes: # - stdlib.h doesn't define strtol, strtoul, or # strtod insome versions of SunOS # - some versions of string.h don't declare procedures such # as strstr # Do this early, otherwise an autoconf bug throws errors on configure #-------------------------------------------------------------------- | < | 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 | # Supply substitutes for missing POSIX header files. Special notes: # - stdlib.h doesn't define strtol, strtoul, or # strtod insome versions of SunOS # - some versions of string.h don't declare procedures such # as strstr # Do this early, otherwise an autoconf bug throws errors on configure #-------------------------------------------------------------------- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 |
| ︙ | ︙ | |||
2631 2632 2633 2634 2635 2636 2637 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
2802 2803 2804 2805 2806 2807 2808 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
2839 2840 2841 2842 2843 2844 2845 |
done
echo "$as_me:$LINENO: checking dirent.h" >&5
echo $ECHO_N "checking dirent.h... $ECHO_C" >&6
| > > > > | | 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 |
done
echo "$as_me:$LINENO: checking dirent.h" >&5
echo $ECHO_N "checking dirent.h... $ECHO_C" >&6
if test "${tcl_cv_dirent_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <dirent.h>
|
| ︙ | ︙ | |||
2882 2883 2884 2885 2886 2887 2888 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | | > > | | 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 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_dirent_h=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_dirent_h=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
if test $tcl_cv_dirent_h = no; then
cat >>confdefs.h <<\_ACEOF
#define NO_DIRENT_H 1
_ACEOF
fi
|
| ︙ | ︙ | |||
2945 2946 2947 2948 2949 2950 2951 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
3093 3094 3095 3096 3097 3098 3099 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
3241 3242 3243 3244 3245 3246 3247 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
3389 3390 3391 3392 3393 3394 3395 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
3541 3542 3543 3544 3545 3546 3547 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
3743 3744 3745 3746 3747 3748 3749 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
3933 3934 3935 3936 3937 3938 3939 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4081 4082 4083 4084 4085 4086 4087 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4235 4236 4237 4238 4239 4240 4241 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4451 4452 4453 4454 4455 4456 4457 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4527 4528 4529 4530 4531 4532 4533 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4603 4604 4605 4606 4607 4608 4609 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4677 4678 4679 4680 4681 4682 4683 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4748 4749 4750 4751 4752 4753 4754 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4866 4867 4868 4869 4870 4871 4872 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
4964 4965 4966 4967 4968 4969 4970 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5100 5101 5102 5103 5104 5105 5106 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5242 5243 5244 5245 5246 5247 5248 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5346 5347 5348 5349 5350 5351 5352 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5409 5410 5411 5412 5413 5414 5415 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5477 5478 5479 5480 5481 5482 5483 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5537 5538 5539 5540 5541 5542 5543 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5739 5740 5741 5742 5743 5744 5745 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5836 5837 5838 5839 5840 5841 5842 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
5902 5903 5904 5905 5906 5907 5908 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
6005 6006 6007 6008 6009 6010 6011 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
6102 6103 6104 6105 6106 6107 6108 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
6168 6169 6170 6171 6172 6173 6174 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
6439 6440 6441 6442 6443 6444 6445 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 |
{ { echo "$as_me:$LINENO: error: Required archive tool 'ar' not found on PATH." >&5
echo "$as_me: error: Required archive tool 'ar' not found on PATH." >&2;}
{ (exit 1); exit 1; }; }
fi
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
case $system in
AIX-*)
if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
# AIX requires the _r compiler when gcc isn't being used
if test "${CC}" != "cc_r" ; then
CC=${CC}_r
fi
| > | 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 |
{ { echo "$as_me:$LINENO: error: Required archive tool 'ar' not found on PATH." >&5
echo "$as_me: error: Required archive tool 'ar' not found on PATH." >&2;}
{ (exit 1); exit 1; }; }
fi
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
PLAT_SRCS=""
case $system in
AIX-*)
if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
# AIX requires the _r compiler when gcc isn't being used
if test "${CC}" != "cc_r" ; then
CC=${CC}_r
fi
|
| ︙ | ︙ | |||
6665 6666 6667 6668 6669 6670 6671 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
6757 6758 6759 6760 6761 6762 6763 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
6872 6873 6874 6875 6876 6877 6878 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
6989 6990 6991 6992 6993 6994 6995 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
7153 7154 7155 7156 7157 7158 7159 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
7337 7338 7339 7340 7341 7342 7343 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
7512 7513 7514 7515 7516 7517 7518 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
7680 7681 7682 7683 7684 7685 7686 |
# FreeBSD doesn't handle version numbers with dots.
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
OpenBSD-*)
| > > > > > > > > > > > > > > > > > > > > > | | | | | | | > | | | | > > | 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 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 |
# FreeBSD doesn't handle version numbers with dots.
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
OpenBSD-*)
case `arch -s` in
m88k|vax)
SHLIB_CFLAGS=""
SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".a"
DL_OBJS="tclLoadAout.o"
DL_LIBS=""
LDFLAGS=""
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
;;
*)
# OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
case `machine` in
sparc|sparc64)
SHLIB_CFLAGS="-fPIC";;
*)
SHLIB_CFLAGS="-fpic";;
esac
SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
echo "$as_me:$LINENO: checking for ELF" >&5
echo $ECHO_N "checking for ELF... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __ELF__
yes
#endif
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
LDFLAGS=-Wl,-export-dynamic
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
LDFLAGS=""
fi
rm -f conftest*
;;
esac
# OpenBSD doesn't do version numbers with dots.
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
FreeBSD-*)
# FreeBSD 3.* and greater have ELF.
|
| ︙ | ︙ | |||
7746 7747 7748 7749 7750 7751 7752 7753 7754 |
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
TCL_LIB_VERSIONS_OK=nodots
;;
esac
;;
Darwin-*)
SHLIB_CFLAGS="-fno-common"
SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
| > > > > > > | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 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 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 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 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 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 8052 8053 8054 8055 8056 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 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 |
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
TCL_LIB_VERSIONS_OK=nodots
;;
esac
;;
Darwin-*)
CFLAGS_OPTIMIZE="-Os"
SHLIB_CFLAGS="-fno-common"
SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5
echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6
if test "${tcl_cv_ld_single_module+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
int i;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_ld_single_module=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_ld_single_module=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5
echo "${ECHO_T}$tcl_cv_ld_single_module" >&6
if test $tcl_cv_ld_single_module = yes; then
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
fi
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
LDFLAGS="$LDFLAGS -prebind"
echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6
if test "${tcl_cv_ld_search_paths_first+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
int i;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_ld_search_paths_first=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_ld_search_paths_first=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5
echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6
if test $tcl_cv_ld_search_paths_first = yes; then
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
fi
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
PLAT_OBJS='${MAC_OSX_OBJS}'
PLAT_SRCS='${MAC_OSX_SRCS}'
echo "$as_me:$LINENO: checking whether to use CoreFoundation" >&5
echo $ECHO_N "checking whether to use CoreFoundation... $ECHO_C" >&6
# Check whether --enable-corefoundation or --disable-corefoundation was given.
if test "${enable_corefoundation+set}" = set; then
enableval="$enable_corefoundation"
tcl_corefoundation=$enableval
else
tcl_corefoundation=yes
fi;
echo "$as_me:$LINENO: result: $tcl_corefoundation" >&5
echo "${ECHO_T}$tcl_corefoundation" >&6
if test $tcl_corefoundation = yes; then
echo "$as_me:$LINENO: checking for CoreFoundation.framework" >&5
echo $ECHO_N "checking for CoreFoundation.framework... $ECHO_C" >&6
if test "${tcl_cv_lib_corefoundation+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
hold_libs=$LIBS
LIBS="$LIBS -framework CoreFoundation"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <CoreFoundation/CoreFoundation.h>
int
main ()
{
CFBundleRef b = CFBundleGetMainBundle();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_lib_corefoundation=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_lib_corefoundation=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$hold_libs
fi
echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation" >&5
echo "${ECHO_T}$tcl_cv_lib_corefoundation" >&6
if test $tcl_cv_lib_corefoundation = yes; then
LIBS="$LIBS -framework CoreFoundation"
cat >>confdefs.h <<\_ACEOF
#define HAVE_COREFOUNDATION 1
_ACEOF
fi
fi
for ac_header in libkern/OSAtomic.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------ ##
## Report this to the tcl lists. ##
## ------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in OSSpinLockLock
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
char (*f) () = $ac_func;
#endif
#ifdef __cplusplus
}
#endif
int
main ()
{
return f != $ac_func;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
cat >>confdefs.h <<\_ACEOF
#define MAC_OSX_TCL 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define USE_VFORK 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define TCL_DEFAULT_ENCODING "utf-8"
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define MODULE_SCOPE __private_extern__
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define TCL_LOAD_FROM_MEMORY 1
_ACEOF
# prior to Darwin 7, realpath is not threadsafe, so don't
# use it when threads are enabled, c.f. bug # 711232:
echo "$as_me:$LINENO: checking for realpath" >&5
echo $ECHO_N "checking for realpath... $ECHO_C" >&6
if test "${ac_cv_func_realpath+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define realpath to an innocuous variant, in case <limits.h> declares realpath.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define realpath innocuous_realpath
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char realpath (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef realpath
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char realpath ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_realpath) || defined (__stub___realpath)
choke me
#else
char (*f) () = realpath;
#endif
#ifdef __cplusplus
}
#endif
int
main ()
{
return f != realpath;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_realpath=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_realpath=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func_realpath" >&5
echo "${ECHO_T}$ac_cv_func_realpath" >&6
if test "$ac_cv_func_realpath" = yes -a "${TCL_THREADS}" = 1 \
-a `uname -r | awk -F. '{print $1}'` -lt 7 ; then
ac_cv_func_realpath=no
fi
;;
NEXTSTEP-*)
SHLIB_CFLAGS=""
SHLIB_LD="cc -nostdlib -r"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadNext.o"
|
| ︙ | ︙ | |||
7932 7933 7934 7935 7936 7937 7938 |
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
| | > | 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 |
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
SunOS-5.[0-6])
# Careful to not let 5.10+ fall into this case
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
cat >>confdefs.h <<\_ACEOF
#define _REENTRANT 1
|
| ︙ | ︙ | |||
7968 7969 7970 7971 7972 7973 7974 |
else
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
fi
;;
SunOS-5*)
| < | 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 |
else
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
fi
;;
SunOS-5*)
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
cat >>confdefs.h <<\_ACEOF
#define _REENTRANT 1
_ACEOF
|
| ︙ | ︙ | |||
8009 8010 8011 8012 8013 8014 8015 | CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" else CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi fi | > > > > | > > > > > | | | 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 |
CFLAGS="$CFLAGS -xarch=v9a"
LDFLAGS_ARCH="-xarch=v9a"
else
CFLAGS="$CFLAGS -xarch=v9"
LDFLAGS_ARCH="-xarch=v9"
fi
fi
elif test "$arch" = "amd64 i386" ; then
if test "$GCC" = "yes" ; then
{ echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
else
do64bit_ok=yes
CFLAGS="$CFLAGS -xarch=amd64"
LDFLAGS="$LDFLAGS -xarch=amd64"
fi
else
{ echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5
echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;}
fi
fi
# Note: need the LIBS below, otherwise Tk won't find Tcl's
# symbols when dynamically loaded into tclsh.
SHLIB_LD_LIBS='${LIBS}'
|
| ︙ | ︙ | |||
8092 8093 8094 8095 8096 8097 8098 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8191 8192 8193 8194 8195 8196 8197 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8258 8259 8260 8261 8262 8263 8264 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8325 8326 8327 8328 8329 8330 8331 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 |
cat >>confdefs.h <<_ACEOF
#define TCL_SHLIB_EXT "${SHLIB_SUFFIX}"
_ACEOF
| > | 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 |
cat >>confdefs.h <<_ACEOF
#define TCL_SHLIB_EXT "${SHLIB_SUFFIX}"
_ACEOF
|
| ︙ | ︙ | |||
8608 8609 8610 8611 8612 8613 8614 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8651 8652 8653 8654 8655 8656 8657 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8712 8713 8714 8715 8716 8717 8718 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8755 8756 8757 8758 8759 8760 8761 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8829 8830 8831 8832 8833 8834 8835 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8879 8880 8881 8882 8883 8884 8885 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
8950 8951 8952 8953 8954 8955 8956 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9014 9015 9016 9017 9018 9019 9020 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9117 9118 9119 9120 9121 9122 9123 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9181 9182 9183 9184 9185 9186 9187 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9260 9261 9262 9263 9264 9265 9266 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9303 9304 9305 9306 9307 9308 9309 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9361 9362 9363 9364 9365 9366 9367 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9531 9532 9533 9534 9535 9536 9537 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9647 9648 9649 9650 9651 9652 9653 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9755 9756 9757 9758 9759 9760 9761 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9855 9856 9857 9858 9859 9860 9861 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
9955 9956 9957 9958 9959 9960 9961 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
10055 10056 10057 10058 10059 10060 10061 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
10155 10156 10157 10158 10159 10160 10161 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
10232 10233 10234 10235 10236 10237 10238 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
10694 10695 10696 10697 10698 10699 10700 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
10799 10800 10801 10802 10803 10804 10805 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
10866 10867 10868 10869 10870 10871 10872 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11015 11016 11017 11018 11019 11020 11021 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11081 11082 11083 11084 11085 11086 11087 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11128 11129 11130 11131 11132 11133 11134 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11203 11204 11205 11206 11207 11208 11209 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11309 11310 11311 11312 11313 11314 11315 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11372 11373 11374 11375 11376 11377 11378 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11434 11435 11436 11437 11438 11439 11440 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11502 11503 11504 11505 11506 11507 11508 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11568 11569 11570 11571 11572 11573 11574 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11639 11640 11641 11642 11643 11644 11645 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11683 11684 11685 11686 11687 11688 11689 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11788 11789 11790 11791 11792 11793 11794 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
11980 11981 11982 11983 11984 11985 11986 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
12093 12094 12095 12096 12097 12098 12099 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
12260 12261 12262 12263 12264 12265 12266 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
12427 12428 12429 12430 12431 12432 12433 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
12596 12597 12598 12599 12600 12601 12602 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
12749 12750 12751 12752 12753 12754 12755 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
12815 12816 12817 12818 12819 12820 12821 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
12881 12882 12883 12884 12885 12886 12887 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13066 13067 13068 13069 13070 13071 13072 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13144 13145 13146 13147 13148 13149 13150 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13249 13250 13251 13252 13253 13254 13255 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13319 13320 13321 13322 13323 13324 13325 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13391 13392 13393 13394 13395 13396 13397 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13512 13513 13514 13515 13516 13517 13518 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13610 13611 13612 13613 13614 13615 13616 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13720 13721 13722 13723 13724 13725 13726 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13783 13784 13785 13786 13787 13788 13789 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
13935 13936 13937 13938 13939 13940 13941 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
14078 14079 14080 14081 14082 14083 14084 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
14187 14188 14189 14190 14191 14192 14193 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
14294 14295 14296 14297 14298 14299 14300 | (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 |
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 |
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
#--------------------------------------------------------------------
# The statements below check for systems where POSIX-style
# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
# On these systems (mostly older ones), use the old BSD-style
# FIONBIO approach instead.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 16433 16434 16435 16436 16437 16438 16439 16440 16441 16442 16443 16444 16445 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 |
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
#--------------------------------------------------------------------
# Define the size of pointers and of the different integer types
#--------------------------------------------------------------------
echo "$as_me:$LINENO: checking for short " >&5
echo $ECHO_N "checking for short ... $ECHO_C" >&6
if test "${ac_cv_type_short_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
if ((short *) 0)
return 0;
if (sizeof (short ))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_short_=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_short_=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_short_" >&5
echo "${ECHO_T}$ac_cv_type_short_" >&6
echo "$as_me:$LINENO: checking size of short " >&5
echo $ECHO_N "checking size of short ... $ECHO_C" >&6
if test "${ac_cv_sizeof_short_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$ac_cv_type_short_" = yes; then
# The cast to unsigned long works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (short ))) >= 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_lo=0 ac_mid=0
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (short ))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=$ac_mid; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr $ac_mid + 1`
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid + 1`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (short ))) < 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=-1 ac_mid=-1
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (short ))) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_lo=$ac_mid; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_hi=`expr '(' $ac_mid ')' - 1`
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo= ac_hi=
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (short ))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=$ac_mid
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr '(' $ac_mid ')' + 1`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
?*) ac_cv_sizeof_short_=$ac_lo;;
'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short ), 77
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute sizeof (short ), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
if test "$cross_compiling" = yes; then
{ { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
{ (exit 1); exit 1; }; }
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
long longval () { return (long) (sizeof (short )); }
unsigned long ulongval () { return (long) (sizeof (short )); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
exit (1);
if (((long) (sizeof (short ))) < 0)
{
long i = longval ();
if (i != ((long) (sizeof (short ))))
exit (1);
fprintf (f, "%ld\n", i);
}
else
{
unsigned long i = ulongval ();
if (i != ((long) (sizeof (short ))))
exit (1);
fprintf (f, "%lu\n", i);
}
exit (ferror (f) || fclose (f) != 0);
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_short_=`cat conftest.val`
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short ), 77
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute sizeof (short ), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
rm -f conftest.val
else
ac_cv_sizeof_short_=0
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_sizeof_short_" >&5
echo "${ECHO_T}$ac_cv_sizeof_short_" >&6
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SHORT_ $ac_cv_sizeof_short_
_ACEOF
echo "$as_me:$LINENO: checking for int " >&5
echo $ECHO_N "checking for int ... $ECHO_C" >&6
if test "${ac_cv_type_int_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
if ((int *) 0)
return 0;
if (sizeof (int ))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_int_=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_int_=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_int_" >&5
echo "${ECHO_T}$ac_cv_type_int_" >&6
echo "$as_me:$LINENO: checking size of int " >&5
echo $ECHO_N "checking size of int ... $ECHO_C" >&6
if test "${ac_cv_sizeof_int_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$ac_cv_type_int_" = yes; then
# The cast to unsigned long works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (int ))) >= 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_lo=0 ac_mid=0
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (int ))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=$ac_mid; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr $ac_mid + 1`
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid + 1`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (int ))) < 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=-1 ac_mid=-1
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (int ))) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_lo=$ac_mid; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_hi=`expr '(' $ac_mid ')' - 1`
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo= ac_hi=
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (int ))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=$ac_mid
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr '(' $ac_mid ')' + 1`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
?*) ac_cv_sizeof_int_=$ac_lo;;
'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int ), 77
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute sizeof (int ), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
if test "$cross_compiling" = yes; then
{ { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
{ (exit 1); exit 1; }; }
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
long longval () { return (long) (sizeof (int )); }
unsigned long ulongval () { return (long) (sizeof (int )); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
exit (1);
if (((long) (sizeof (int ))) < 0)
{
long i = longval ();
if (i != ((long) (sizeof (int ))))
exit (1);
fprintf (f, "%ld\n", i);
}
else
{
unsigned long i = ulongval ();
if (i != ((long) (sizeof (int ))))
exit (1);
fprintf (f, "%lu\n", i);
}
exit (ferror (f) || fclose (f) != 0);
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_int_=`cat conftest.val`
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int ), 77
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute sizeof (int ), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
rm -f conftest.val
else
ac_cv_sizeof_int_=0
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_sizeof_int_" >&5
echo "${ECHO_T}$ac_cv_sizeof_int_" >&6
cat >>confdefs.h <<_ACEOF
#define SIZEOF_INT_ $ac_cv_sizeof_int_
_ACEOF
echo "$as_me:$LINENO: checking for long " >&5
echo $ECHO_N "checking for long ... $ECHO_C" >&6
if test "${ac_cv_type_long_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
if ((long *) 0)
return 0;
if (sizeof (long ))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_long_=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_long_=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_long_" >&5
echo "${ECHO_T}$ac_cv_type_long_" >&6
echo "$as_me:$LINENO: checking size of long " >&5
echo $ECHO_N "checking size of long ... $ECHO_C" >&6
if test "${ac_cv_sizeof_long_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$ac_cv_type_long_" = yes; then
# The cast to unsigned long works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (long ))) >= 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_lo=0 ac_mid=0
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (long ))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=$ac_mid; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr $ac_mid + 1`
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid + 1`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (long ))) < 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=-1 ac_mid=-1
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (long ))) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_lo=$ac_mid; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_hi=`expr '(' $ac_mid ')' - 1`
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo= ac_hi=
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (long ))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=$ac_mid
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr '(' $ac_mid ')' + 1`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
?*) ac_cv_sizeof_long_=$ac_lo;;
'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long ), 77
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute sizeof (long ), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
if test "$cross_compiling" = yes; then
{ { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
{ (exit 1); exit 1; }; }
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
long longval () { return (long) (sizeof (long )); }
unsigned long ulongval () { return (long) (sizeof (long )); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
exit (1);
if (((long) (sizeof (long ))) < 0)
{
long i = longval ();
if (i != ((long) (sizeof (long ))))
exit (1);
fprintf (f, "%ld\n", i);
}
else
{
unsigned long i = ulongval ();
if (i != ((long) (sizeof (long ))))
exit (1);
fprintf (f, "%lu\n", i);
}
exit (ferror (f) || fclose (f) != 0);
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_long_=`cat conftest.val`
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long ), 77
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute sizeof (long ), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
rm -f conftest.val
else
ac_cv_sizeof_long_=0
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_" >&5
echo "${ECHO_T}$ac_cv_sizeof_long_" >&6
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG_ $ac_cv_sizeof_long_
_ACEOF
echo "$as_me:$LINENO: checking for void * " >&5
echo $ECHO_N "checking for void * ... $ECHO_C" >&6
if test "${ac_cv_type_void_p_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
if ((void * *) 0)
return 0;
if (sizeof (void * ))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_void_p_=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_void_p_=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_void_p_" >&5
echo "${ECHO_T}$ac_cv_type_void_p_" >&6
echo "$as_me:$LINENO: checking size of void * " >&5
echo $ECHO_N "checking size of void * ... $ECHO_C" >&6
if test "${ac_cv_sizeof_void_p_+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$ac_cv_type_void_p_" = yes; then
# The cast to unsigned long works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (void * ))) >= 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_lo=0 ac_mid=0
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (void * ))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=$ac_mid; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr $ac_mid + 1`
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid + 1`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (void * ))) < 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=-1 ac_mid=-1
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (void * ))) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_lo=$ac_mid; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_hi=`expr '(' $ac_mid ')' - 1`
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo= ac_hi=
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long) (sizeof (void * ))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_hi=$ac_mid
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr '(' $ac_mid ')' + 1`
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
?*) ac_cv_sizeof_void_p_=$ac_lo;;
'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void * ), 77
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute sizeof (void * ), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
if test "$cross_compiling" = yes; then
{ { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
{ (exit 1); exit 1; }; }
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
long longval () { return (long) (sizeof (void * )); }
unsigned long ulongval () { return (long) (sizeof (void * )); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
exit (1);
if (((long) (sizeof (void * ))) < 0)
{
long i = longval ();
if (i != ((long) (sizeof (void * ))))
exit (1);
fprintf (f, "%ld\n", i);
}
else
{
unsigned long i = ulongval ();
if (i != ((long) (sizeof (void * ))))
exit (1);
fprintf (f, "%lu\n", i);
}
exit (ferror (f) || fclose (f) != 0);
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_void_p_=`cat conftest.val`
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void * ), 77
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute sizeof (void * ), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
rm -f conftest.val
else
ac_cv_sizeof_void_p_=0
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p_" >&5
echo "${ECHO_T}$ac_cv_sizeof_void_p_" >&6
cat >>confdefs.h <<_ACEOF
#define SIZEOF_VOID_P_ $ac_cv_sizeof_void_p_
_ACEOF
#--------------------------------------------------------------------
# The statements below check for systems where POSIX-style
# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
# On these systems (mostly older ones), use the old BSD-style
# FIONBIO approach instead.
|
| ︙ | ︙ | |||
14370 14371 14372 14373 14374 14375 14376 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
14520 14521 14522 14523 14524 14525 14526 | (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && | | < | 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 |
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
| ︙ | ︙ | |||
14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 |
;;
*)
echo "$as_me:$LINENO: result: O_NONBLOCK" >&5
echo "${ECHO_T}O_NONBLOCK" >&6
;;
esac
#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtcl as a shared library instead of a static library.
#--------------------------------------------------------------------
TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
echo "$as_me:$LINENO: checking how to package libraries" >&5
echo $ECHO_N "checking how to package libraries... $ECHO_C" >&6
# Check whether --enable-framework or --disable-framework was given.
if test "${enable_framework+set}" = set; then
enableval="$enable_framework"
tcl_ok=$enableval
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 |
;;
*)
echo "$as_me:$LINENO: result: O_NONBLOCK" >&5
echo "${ECHO_T}O_NONBLOCK" >&6
;;
esac
#------------------------------------------------------------------------
# Check whether --enable-dll-unloading or --disable-dll-unloading was given.
if test "${enable_dll_unloading+set}" = set; then
enableval="$enable_dll_unloading"
tcl_ok=$enableval
else
tcl_ok=yes
fi;
if test $tcl_ok = yes; then
cat >>confdefs.h <<\_ACEOF
#define TCL_UNLOAD_DLLS 1
_ACEOF
fi
#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtcl as a shared library instead of a static library.
#--------------------------------------------------------------------
TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
# tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
# since on some platforms TCL_LIB_FILE contains shell escapes.
# (See also: TCL_TRIM_DOTS).
eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
PRIVATE_INCLUDE_DIR='$(includedir)'
HTML_DIR='$(DISTDIR)/html'
# Note: in the following variable, it's important to use the absolute
# path name of the Tcl directory rather than "..": this is because
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.
if test "`uname -s`" = "Darwin" ; then
echo "$as_me:$LINENO: checking how to package libraries" >&5
echo $ECHO_N "checking how to package libraries... $ECHO_C" >&6
# Check whether --enable-framework or --disable-framework was given.
if test "${enable_framework+set}" = set; then
enableval="$enable_framework"
tcl_ok=$enableval
|
| ︙ | ︙ | |||
14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 |
echo "${ECHO_T}framework" >&6
FRAMEWORK_BUILD=1
if test "${SHARED_BUILD}" = "0" ; then
{ echo "$as_me:$LINENO: WARNING: \"Frameworks can only be built if --enable-shared is yes\"" >&5
echo "$as_me: WARNING: \"Frameworks can only be built if --enable-shared is yes\"" >&2;}
FRAMEWORK_BUILD=0
fi
else
echo "$as_me:$LINENO: result: standard shared library" >&5
echo "${ECHO_T}standard shared library" >&6
FRAMEWORK_BUILD=0
fi
| > > > > > | < < < | < | < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | > | > > | | < < < < < < < < < < < < < < < < < | 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 |
echo "${ECHO_T}framework" >&6
FRAMEWORK_BUILD=1
if test "${SHARED_BUILD}" = "0" ; then
{ echo "$as_me:$LINENO: WARNING: \"Frameworks can only be built if --enable-shared is yes\"" >&5
echo "$as_me: WARNING: \"Frameworks can only be built if --enable-shared is yes\"" >&2;}
FRAMEWORK_BUILD=0
fi
if test $tcl_corefoundation = no; then
{ echo "$as_me:$LINENO: WARNING: \"Frameworks can only be used when CoreFoundation is available\"" >&5
echo "$as_me: WARNING: \"Frameworks can only be used when CoreFoundation is available\"" >&2;}
FRAMEWORK_BUILD=0
fi
else
echo "$as_me:$LINENO: result: standard shared library" >&5
echo "${ECHO_T}standard shared library" >&6
FRAMEWORK_BUILD=0
fi
TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version ${TCL_VERSION}`echo ${TCL_PATCH_LEVEL} | awk '{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}'`"
TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000'
fi
if test "$FRAMEWORK_BUILD" = "1" ; then
cat >>confdefs.h <<\_ACEOF
#define TCL_FRAMEWORK 1
_ACEOF
ac_config_files="$ac_config_files Tcl-Info.plist:../macosx/Tcl-Info.plist.in"
# Construct a fake local framework structure to make linking with
# '-framework Tcl' and running of tcltest work
ac_config_commands="$ac_config_commands Tcl.framework"
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
# override libdir default
libdir="/Library/Frameworks"
fi
TCL_LIB_FILE="Tcl"
TCL_LIB_FLAG="-framework Tcl"
TCL_BUILD_LIB_SPEC="-F`pwd` -framework Tcl"
TCL_LIB_SPEC="-F${libdir} -framework Tcl"
libdir="${libdir}/Tcl.framework/Versions/\${VERSION}"
TCL_LIBRARY="${libdir}/Resources/Scripts"
includedir="${libdir}/Headers"
PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
HTML_DIR="${libdir}/Resources/Documentation/Reference/Tcl"
EXTRA_INSTALL="install-private-headers html-tcl"
EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TclTOC.html'
EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tcl-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tcl.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tclConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
TCL_YEAR="`date +%Y`"
# Don't use AC_DEFINE for the following as the framework version define
# needs to go into the Makefile even when using autoheader, so that we
# can pick up a potential make override of VERSION. Also, don't put this
# into CFLAGS as it should not go into tclConfig.sh
EXTRA_CC_SWITCHES='-DTCL_FRAMEWORK_VERSION=\"$(VERSION)\"'
else
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
TCL_LIB_FLAG="-ltcl${TCL_VERSION}"
else
TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`"
fi
TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
TCL_LIB_SPEC="-L${libdir} ${TCL_LIB_FLAG}"
else
TCL_BUILD_EXP_FILE="lib.exp"
eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
if test "$GCC" = "yes" ; then
TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`"
TCL_LIB_SPEC="-Wl,-bI:${libdir}/${TCL_EXP_FILE} -L`pwd`"
else
TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}"
TCL_LIB_SPEC="-bI:${libdir}/${TCL_EXP_FILE}"
fi
fi
fi
VERSION='${VERSION}'
eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
VERSION=${TCL_VERSION}
#--------------------------------------------------------------------
# The statements below define the symbol TCL_PACKAGE_PATH, which
# gives a list of directories that may contain packages. The list
# consists of one directory for machine-dependent binaries and
# another for platform-independent scripts.
#--------------------------------------------------------------------
if test "$FRAMEWORK_BUILD" = "1" ; then
TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks"
TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl"
elif test "$prefix/lib" != "$libdir"; then
TCL_PACKAGE_PATH="${libdir} ${prefix}/lib"
else
TCL_PACKAGE_PATH="${prefix}/lib"
fi
#--------------------------------------------------------------------
# The statements below define various symbols relating to Tcl
# stub support.
#--------------------------------------------------------------------
# Replace ${VERSION} with contents of ${TCL_VERSION}
# double-eval to account for TCL_TRIM_DOTS.
#
eval "TCL_STUB_LIB_FILE=libtclstub${TCL_UNSHARED_LIB_SUFFIX}"
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
eval "TCL_STUB_LIB_DIR=${libdir}"
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
TCL_STUB_LIB_FLAG="-ltclstub${TCL_VERSION}"
else
TCL_STUB_LIB_FLAG="-ltclstub`echo ${TCL_VERSION} | tr -d .`"
fi
TCL_BUILD_STUB_LIB_SPEC="-L`pwd` ${TCL_STUB_LIB_FLAG}"
TCL_STUB_LIB_SPEC="-L${TCL_STUB_LIB_DIR} ${TCL_STUB_LIB_FLAG}"
TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}"
TCL_STUB_LIB_PATH="${TCL_STUB_LIB_DIR}/${TCL_STUB_LIB_FILE}"
# Install time header dir can be set via --includedir
eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
#------------------------------------------------------------------------
# tclConfig.sh refers to this by a different name
#------------------------------------------------------------------------
TCL_SHARED_BUILD=${SHARED_BUILD}
|
| ︙ | ︙ | |||
14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 |
ac_config_files="$ac_config_files Makefile dltest/Makefile tclConfig.sh"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
| > > > > > > > > > > > > | 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 17074 17075 17076 |
ac_config_files="$ac_config_files Makefile dltest/Makefile tclConfig.sh"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
|
| ︙ | ︙ | |||
15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 |
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
Configuration files:
$config_files
Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
tcl config.status 8.5
| > > > | 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 |
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
Configuration files:
$config_files
Configuration commands:
$config_commands
Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
tcl config.status 8.5
|
| ︙ | ︙ | |||
15415 15416 15417 15418 15419 15420 15421 | if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF | > | > > > > > > > > > | 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 |
if \$ac_cs_recheck; then
echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
# INIT-COMMANDS section.
#
VERSION=${TCL_VERSION}
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
case "$ac_config_target" in
# Handling of arguments.
"Tcl-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tcl-Info.plist:../macosx/Tcl-Info.plist.in" ;;
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"dltest/Makefile" ) CONFIG_FILES="$CONFIG_FILES dltest/Makefile" ;;
"tclConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tclConfig.sh" ;;
"Tcl.framework" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Tcl.framework" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason to put it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
|
| ︙ | ︙ | |||
15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 | s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@AR@,$AR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@TCL_LIBS@,$TCL_LIBS,;t t s,@DL_LIBS@,$DL_LIBS,;t t s,@DL_OBJS@,$DL_OBJS,;t t s,@PLAT_OBJS@,$PLAT_OBJS,;t t s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t s,@CC_SEARCH_FLAGS@,$CC_SEARCH_FLAGS,;t t s,@LD_SEARCH_FLAGS@,$LD_SEARCH_FLAGS,;t t | > | 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 | s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@AR@,$AR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@TCL_LIBS@,$TCL_LIBS,;t t s,@DL_LIBS@,$DL_LIBS,;t t s,@DL_OBJS@,$DL_OBJS,;t t s,@PLAT_OBJS@,$PLAT_OBJS,;t t s,@PLAT_SRCS@,$PLAT_SRCS,;t t s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t s,@CC_SEARCH_FLAGS@,$CC_SEARCH_FLAGS,;t t s,@LD_SEARCH_FLAGS@,$LD_SEARCH_FLAGS,;t t |
| ︙ | ︙ | |||
15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 | s,@INSTALL_STUB_LIB@,$INSTALL_STUB_LIB,;t t s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t s,@TCL_VERSION@,$TCL_VERSION,;t t s,@TCL_MAJOR_VERSION@,$TCL_MAJOR_VERSION,;t t s,@TCL_MINOR_VERSION@,$TCL_MINOR_VERSION,;t t s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t s,@TCL_STUB_LIB_PATH@,$TCL_STUB_LIB_PATH,;t t | > | 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 | s,@INSTALL_STUB_LIB@,$INSTALL_STUB_LIB,;t t s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t s,@TCL_VERSION@,$TCL_VERSION,;t t s,@TCL_MAJOR_VERSION@,$TCL_MAJOR_VERSION,;t t s,@TCL_MINOR_VERSION@,$TCL_MINOR_VERSION,;t t s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t s,@TCL_YEAR@,$TCL_YEAR,;t t s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t s,@TCL_STUB_LIB_PATH@,$TCL_STUB_LIB_PATH,;t t |
| ︙ | ︙ | |||
15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 | s,@TCL_EXP_FILE@,$TCL_EXP_FILE,;t t s,@TCL_LIB_VERSIONS_OK@,$TCL_LIB_VERSIONS_OK,;t t s,@TCL_SHARED_LIB_SUFFIX@,$TCL_SHARED_LIB_SUFFIX,;t t s,@TCL_UNSHARED_LIB_SUFFIX@,$TCL_UNSHARED_LIB_SUFFIX,;t t s,@TCL_HAS_LONGLONG@,$TCL_HAS_LONGLONG,;t t s,@BUILD_DLTEST@,$BUILD_DLTEST,;t t s,@TCL_PACKAGE_PATH@,$TCL_PACKAGE_PATH,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. | > > > > > > > > | 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 17789 17790 | s,@TCL_EXP_FILE@,$TCL_EXP_FILE,;t t s,@TCL_LIB_VERSIONS_OK@,$TCL_LIB_VERSIONS_OK,;t t s,@TCL_SHARED_LIB_SUFFIX@,$TCL_SHARED_LIB_SUFFIX,;t t s,@TCL_UNSHARED_LIB_SUFFIX@,$TCL_UNSHARED_LIB_SUFFIX,;t t s,@TCL_HAS_LONGLONG@,$TCL_HAS_LONGLONG,;t t s,@BUILD_DLTEST@,$BUILD_DLTEST,;t t s,@TCL_PACKAGE_PATH@,$TCL_PACKAGE_PATH,;t t s,@TCL_MODULE_PATH@,$TCL_MODULE_PATH,;t t s,@TCL_LIBRARY@,$TCL_LIBRARY,;t t s,@PRIVATE_INCLUDE_DIR@,$PRIVATE_INCLUDE_DIR,;t t s,@HTML_DIR@,$HTML_DIR,;t t s,@EXTRA_CC_SWITCHES@,$EXTRA_CC_SWITCHES,;t t s,@EXTRA_INSTALL@,$EXTRA_INSTALL,;t t s,@EXTRA_INSTALL_BINARIES@,$EXTRA_INSTALL_BINARIES,;t t s,@EXTRA_BUILD_HTML@,$EXTRA_BUILD_HTML,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. |
| ︙ | ︙ | |||
15741 15742 15743 15744 15745 15746 15747 | [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac | < < < < < | 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 |
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
if test x"$ac_file" = x-; then
configure_input=
else
configure_input="$ac_file. "
|
| ︙ | ︙ | |||
15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 |
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
esac
done` || { (exit 1); exit 1; }
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
| > > > > > > | 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 |
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
esac
done` || { (exit 1); exit 1; }
if test x"$ac_file" != x-; then
{ echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
|
| ︙ | ︙ | |||
15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 |
if test x"$ac_file" != x-; then
mv $tmp/out $ac_file
else
cat $tmp/out
rm -f $tmp/out
fi
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 |
if test x"$ac_file" != x-; then
mv $tmp/out $ac_file
else
cat $tmp/out
rm -f $tmp/out
fi
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
#
# CONFIG_COMMANDS section.
#
for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_dest" : 'X\(//\)[^/]' \| \
X"$ac_dest" : 'X\(//\)$' \| \
X"$ac_dest" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_dest" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A "../" for each directory in $ac_dir_suffix.
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
{ echo "$as_me:$LINENO: executing $ac_dest commands" >&5
echo "$as_me: executing $ac_dest commands" >&6;}
case $ac_dest in
Tcl.framework ) n=Tcl &&
f=$n.framework && v=Versions/$VERSION &&
rm -rf $f && mkdir -p $f/$v/Resources &&
ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
unset n f v
;;
esac
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
|
| ︙ | ︙ |
Changes to unix/configure.in.
1 2 3 4 5 | #! /bin/bash -norc dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tcl installation dnl to configure the system for the local environment. # | | > | > > > | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
#! /bin/bash -norc
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl installation
dnl to configure the system for the local environment.
#
# RCS: @(#) $Id: configure.in,v 1.127.2.4 2005/10/08 23:15:59 msofer Exp $
AC_INIT([tcl],[8.5])
AC_PREREQ(2.57)
dnl AC_CONFIG_HEADERS([tclConfig.h])
dnl AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TCL_CONFIG_H -imacros tclConfig.h"])
dnl AH_TOP([#ifndef _TCLCONFIG
dnl #define _TCLCONFIG])
dnl AH_BOTTOM([#endif /* _TCLCONFIG */])
TCL_VERSION=8.5
TCL_MAJOR_VERSION=8
TCL_MINOR_VERSION=5
TCL_PATCH_LEVEL="a4"
VERSION=${TCL_VERSION}
#------------------------------------------------------------------------
# Handle the --prefix=... option
#------------------------------------------------------------------------
if test "${prefix}" = "NONE"; then
prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
TCL_SRC_DIR=`cd $srcdir/..; pwd`
#------------------------------------------------------------------------
# Compress and/or soft link the manpages?
#------------------------------------------------------------------------
SC_CONFIG_MANPAGES
|
| ︙ | ︙ | |||
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 |
AC_CHECK_FUNCS(chflags)
#--------------------------------------------------------------------
# Check for support of getattrlist function (Darwin, HFS+)
#--------------------------------------------------------------------
AC_CHECK_FUNCS(getattrlist)
#--------------------------------------------------------------------
# The statements below check for systems where POSIX-style
# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
# On these systems (mostly older ones), use the old BSD-style
# FIONBIO approach instead.
#--------------------------------------------------------------------
SC_BLOCKING_STYLE
#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtcl as a shared library instead of a static library.
#--------------------------------------------------------------------
TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
| > > > > > > > > > > > > > > > > > > > < < > > > > > > > > > > < < < < < > > > > | > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | > | > > | | < < < < < < < < < > | 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 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
AC_CHECK_FUNCS(chflags)
#--------------------------------------------------------------------
# Check for support of getattrlist function (Darwin, HFS+)
#--------------------------------------------------------------------
AC_CHECK_FUNCS(getattrlist)
#--------------------------------------------------------------------
# Define the size of pointers and of the different integer types
#--------------------------------------------------------------------
AC_CHECK_SIZEOF( short )
AC_CHECK_SIZEOF( int )
AC_CHECK_SIZEOF( long )
AC_CHECK_SIZEOF( void * )
#--------------------------------------------------------------------
# The statements below check for systems where POSIX-style
# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
# On these systems (mostly older ones), use the old BSD-style
# FIONBIO approach instead.
#--------------------------------------------------------------------
SC_BLOCKING_STYLE
#------------------------------------------------------------------------
AC_ARG_ENABLE(dll-unloading,
AC_HELP_STRING([--enable-dll-unloading],
[turn on the 'unload' command (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
if test $tcl_ok = yes; then
AC_DEFINE(TCL_UNLOAD_DLLS, 1, [Do we allow unloading of shared libraries?])
fi
#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtcl as a shared library instead of a static library.
#--------------------------------------------------------------------
TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
# tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
# since on some platforms TCL_LIB_FILE contains shell escapes.
# (See also: TCL_TRIM_DOTS).
eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
PRIVATE_INCLUDE_DIR='$(includedir)'
HTML_DIR='$(DISTDIR)/html'
# Note: in the following variable, it's important to use the absolute
# path name of the Tcl directory rather than "..": this is because
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.
if test "`uname -s`" = "Darwin" ; then
SC_ENABLE_FRAMEWORK
TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version ${TCL_VERSION}`echo ${TCL_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`"
TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000'
fi
if test "$FRAMEWORK_BUILD" = "1" ; then
AC_DEFINE(TCL_FRAMEWORK, 1, [Is Tcl built as a framework?])
AC_CONFIG_FILES([Tcl-Info.plist:../macosx/Tcl-Info.plist.in])
# Construct a fake local framework structure to make linking with
# '-framework Tcl' and running of tcltest work
AC_CONFIG_COMMANDS([Tcl.framework], [n=Tcl &&
f=$n.framework && v=Versions/$VERSION &&
rm -rf $f && mkdir -p $f/$v/Resources &&
ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
unset n f v
], VERSION=${TCL_VERSION})
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
# override libdir default
libdir="/Library/Frameworks"
fi
TCL_LIB_FILE="Tcl"
TCL_LIB_FLAG="-framework Tcl"
TCL_BUILD_LIB_SPEC="-F`pwd` -framework Tcl"
TCL_LIB_SPEC="-F${libdir} -framework Tcl"
libdir="${libdir}/Tcl.framework/Versions/\${VERSION}"
TCL_LIBRARY="${libdir}/Resources/Scripts"
includedir="${libdir}/Headers"
PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
HTML_DIR="${libdir}/Resources/Documentation/Reference/Tcl"
EXTRA_INSTALL="install-private-headers html-tcl"
EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TclTOC.html'
EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tcl-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tcl.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tclConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
TCL_YEAR="`date +%Y`"
# Don't use AC_DEFINE for the following as the framework version define
# needs to go into the Makefile even when using autoheader, so that we
# can pick up a potential make override of VERSION. Also, don't put this
# into CFLAGS as it should not go into tclConfig.sh
EXTRA_CC_SWITCHES='-DTCL_FRAMEWORK_VERSION=\"$(VERSION)\"'
else
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
TCL_LIB_FLAG="-ltcl${TCL_VERSION}"
else
TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`"
fi
TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
TCL_LIB_SPEC="-L${libdir} ${TCL_LIB_FLAG}"
else
TCL_BUILD_EXP_FILE="lib.exp"
eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
if test "$GCC" = "yes" ; then
TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`"
TCL_LIB_SPEC="-Wl,-bI:${libdir}/${TCL_EXP_FILE} -L`pwd`"
else
TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}"
TCL_LIB_SPEC="-bI:${libdir}/${TCL_EXP_FILE}"
fi
fi
fi
VERSION='${VERSION}'
eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
VERSION=${TCL_VERSION}
#--------------------------------------------------------------------
# The statements below define the symbol TCL_PACKAGE_PATH, which
# gives a list of directories that may contain packages. The list
# consists of one directory for machine-dependent binaries and
# another for platform-independent scripts.
#--------------------------------------------------------------------
if test "$FRAMEWORK_BUILD" = "1" ; then
TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks"
TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl"
elif test "$prefix/lib" != "$libdir"; then
TCL_PACKAGE_PATH="${libdir} ${prefix}/lib"
else
TCL_PACKAGE_PATH="${prefix}/lib"
fi
#--------------------------------------------------------------------
# The statements below define various symbols relating to Tcl
# stub support.
#--------------------------------------------------------------------
# Replace ${VERSION} with contents of ${TCL_VERSION}
# double-eval to account for TCL_TRIM_DOTS.
#
eval "TCL_STUB_LIB_FILE=libtclstub${TCL_UNSHARED_LIB_SUFFIX}"
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
eval "TCL_STUB_LIB_DIR=${libdir}"
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
TCL_STUB_LIB_FLAG="-ltclstub${TCL_VERSION}"
else
TCL_STUB_LIB_FLAG="-ltclstub`echo ${TCL_VERSION} | tr -d .`"
fi
TCL_BUILD_STUB_LIB_SPEC="-L`pwd` ${TCL_STUB_LIB_FLAG}"
TCL_STUB_LIB_SPEC="-L${TCL_STUB_LIB_DIR} ${TCL_STUB_LIB_FLAG}"
TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}"
TCL_STUB_LIB_PATH="${TCL_STUB_LIB_DIR}/${TCL_STUB_LIB_FILE}"
# Install time header dir can be set via --includedir
eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
#------------------------------------------------------------------------
# tclConfig.sh refers to this by a different name
#------------------------------------------------------------------------
TCL_SHARED_BUILD=${SHARED_BUILD}
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_MAJOR_VERSION)
AC_SUBST(TCL_MINOR_VERSION)
AC_SUBST(TCL_PATCH_LEVEL)
AC_SUBST(TCL_YEAR)
AC_SUBST(TCL_LIB_FILE)
AC_SUBST(TCL_LIB_FLAG)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(TCL_STUB_LIB_FILE)
AC_SUBST(TCL_STUB_LIB_FLAG)
AC_SUBST(TCL_STUB_LIB_SPEC)
|
| ︙ | ︙ | |||
568 569 570 571 572 573 574 575 576 577 578 | AC_SUBST(TCL_SHARED_LIB_SUFFIX) AC_SUBST(TCL_UNSHARED_LIB_SUFFIX) AC_SUBST(TCL_HAS_LONGLONG) AC_SUBST(BUILD_DLTEST) AC_SUBST(TCL_PACKAGE_PATH) dnl Disable the automake-friendly normalization of LIBOBJS dnl performed by autoconf 2.53 and later. It's not correct for us. define([_AC_LIBOBJS_NORMALIZE],[]) | > > > > > > > > > > | > | 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | AC_SUBST(TCL_SHARED_LIB_SUFFIX) AC_SUBST(TCL_UNSHARED_LIB_SUFFIX) AC_SUBST(TCL_HAS_LONGLONG) AC_SUBST(BUILD_DLTEST) AC_SUBST(TCL_PACKAGE_PATH) AC_SUBST(TCL_MODULE_PATH) AC_SUBST(TCL_LIBRARY) AC_SUBST(PRIVATE_INCLUDE_DIR) AC_SUBST(HTML_DIR) AC_SUBST(EXTRA_CC_SWITCHES) AC_SUBST(EXTRA_INSTALL) AC_SUBST(EXTRA_INSTALL_BINARIES) AC_SUBST(EXTRA_BUILD_HTML) dnl Disable the automake-friendly normalization of LIBOBJS dnl performed by autoconf 2.53 and later. It's not correct for us. define([_AC_LIBOBJS_NORMALIZE],[]) AC_CONFIG_FILES([Makefile dltest/Makefile tclConfig.sh]) AC_OUTPUT |
Changes to unix/dltest/Makefile.in.
1 2 3 | # This Makefile is used to create several test cases for Tcl's load # command. It also illustrates how to take advantage of configuration # exported by Tcl to set up Makefiles for shared libraries. | | | 1 2 3 4 5 6 7 8 9 10 11 | # This Makefile is used to create several test cases for Tcl's load # command. It also illustrates how to take advantage of configuration # exported by Tcl to set up Makefiles for shared libraries. # RCS: @(#) $Id: Makefile.in,v 1.17.2.1 2005/06/13 01:47:17 msofer Exp $ CC = @CC@ LIBS = @TCL_BUILD_STUB_LIB_SPEC@ @TCL_LIBS@ AC_FLAGS = @DEFS@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ |
| ︙ | ︙ |
Changes to unix/tcl.m4.
| ︙ | ︙ | |||
23 24 25 26 27 28 29 |
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tcl
#
if test x"${no_tcl}" = x ; then
# we reset no_tcl in case something fails here
no_tcl=true
| > > | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tcl
#
if test x"${no_tcl}" = x ; then
# we reset no_tcl in case something fails here
no_tcl=true
AC_ARG_WITH(tcl,
AC_HELP_STRING([--with-tcl],
[directory containing tcl configuration (tclConfig.sh)]),
with_tclconfig=${withval})
AC_MSG_CHECKING([for Tcl configuration])
AC_CACHE_VAL(ac_cv_c_tclconfig,[
# First check to see if --with-tcl was specified.
if test x"${with_tclconfig}" != x ; then
case ${with_tclconfig} in
*/tclConfig.sh )
|
| ︙ | ︙ | |||
134 135 136 137 138 139 140 |
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tk
#
if test x"${no_tk}" = x ; then
# we reset no_tk in case something fails here
no_tk=true
| > > | > | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tk
#
if test x"${no_tk}" = x ; then
# we reset no_tk in case something fails here
no_tk=true
AC_ARG_WITH(tk,
AC_HELP_STRING([--with-tk],
[directory containing tk configuration (tkConfig.sh)]),
with_tkconfig=${withval})
AC_MSG_CHECKING([for Tk configuration])
AC_CACHE_VAL(ac_cv_c_tkconfig,[
# First check to see if --with-tkconfig was specified.
if test x"${with_tkconfig}" != x ; then
case ${with_tkconfig} in
*/tkConfig.sh )
|
| ︙ | ︙ | |||
341 342 343 344 345 346 347 |
# Sets the following vars:
# SHARED_BUILD Value of 1 or 0
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_SHARED, [
AC_MSG_CHECKING([how to build libraries])
AC_ARG_ENABLE(shared,
| > | | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# Sets the following vars:
# SHARED_BUILD Value of 1 or 0
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_SHARED, [
AC_MSG_CHECKING([how to build libraries])
AC_ARG_ENABLE(shared,
AC_HELP_STRING([--enable-shared],
[build and link with shared libraries (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
tcl_ok=$enableval
else
tcl_ok=yes
|
| ︙ | ︙ | |||
381 382 383 384 385 386 387 |
# Sets the following vars:
# FRAMEWORK_BUILD Value of 1 or 0
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_FRAMEWORK, [
AC_MSG_CHECKING([how to package libraries])
AC_ARG_ENABLE(framework,
| > | > > > > | 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 |
# Sets the following vars:
# FRAMEWORK_BUILD Value of 1 or 0
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_FRAMEWORK, [
AC_MSG_CHECKING([how to package libraries])
AC_ARG_ENABLE(framework,
AC_HELP_STRING([--enable-framework],
[package shared libraries in MacOSX frameworks (default: off)]),
[tcl_ok=$enableval], [tcl_ok=no])
if test "${enable_framework+set}" = set; then
enableval="$enable_framework"
tcl_ok=$enableval
else
tcl_ok=no
fi
if test "$tcl_ok" = "yes" ; then
AC_MSG_RESULT([framework])
FRAMEWORK_BUILD=1
if test "${SHARED_BUILD}" = "0" ; then
AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes")
FRAMEWORK_BUILD=0
fi
if test $tcl_corefoundation = no; then
AC_MSG_WARN("Frameworks can only be used when CoreFoundation is available")
FRAMEWORK_BUILD=0
fi
else
AC_MSG_RESULT([standard shared library])
FRAMEWORK_BUILD=0
fi
])
|
| ︙ | ︙ | |||
429 430 431 432 433 434 435 |
# _REENTRANT
# _THREAD_SAFE
#
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_THREADS, [
AC_MSG_CHECKING(for building with threads)
| | > > | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# _REENTRANT
# _THREAD_SAFE
#
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_THREADS, [
AC_MSG_CHECKING(for building with threads)
AC_ARG_ENABLE(threads,
AC_HELP_STRING([--enable-threads],
[build with threads (default: off)]),
[tcl_ok=$enableval], [tcl_ok=no])
if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
if test "${TCL_THREADS}" = 1; then
AC_MSG_RESULT([yes (threaded core)])
else
AC_MSG_RESULT([yes])
|
| ︙ | ︙ | |||
565 566 567 568 569 570 571 |
# DBGX Formerly used as debug library extension;
# always blank now.
#
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_SYMBOLS, [
AC_MSG_CHECKING([for build with symbols])
| | > > > | 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
# DBGX Formerly used as debug library extension;
# always blank now.
#
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_SYMBOLS, [
AC_MSG_CHECKING([for build with symbols])
AC_ARG_ENABLE(symbols,
AC_HELP_STRING([--enable-symbols],
[build with debugging symbols (default: off)]),
[tcl_ok=$enableval], [tcl_ok=no])
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
DBGX=""
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
AC_MSG_RESULT([no])
AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
|
| ︙ | ︙ | |||
623 624 625 626 627 628 629 |
# Defines the following vars:
# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
#
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_LANGINFO, [
AC_ARG_ENABLE(langinfo,
| | | | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 |
# Defines the following vars:
# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
#
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_LANGINFO, [
AC_ARG_ENABLE(langinfo,
AC_HELP_STRING([--enable-langinfo],
[use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
[langinfo_ok=$enableval], [langinfo_ok=yes])
HAVE_LANGINFO=0
if test "$langinfo_ok" = "yes"; then
if test "$langinfo_ok" = "yes"; then
AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
fi
|
| ︙ | ︙ | |||
673 674 675 676 677 678 679 680 | # # Defines the following variable: # # MAN_FLAGS - The apropriate flags for installManPage # according to the user's selection. # #-------------------------------------------------------------------- AC_DEFUN(SC_CONFIG_MANPAGES, [ | > < | | | | | | | | | | | > | > | > | | | | | | | | | | | | | | | > | > | > | | | | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 |
#
# Defines the following variable:
#
# MAN_FLAGS - The apropriate flags for installManPage
# according to the user's selection.
#
#--------------------------------------------------------------------
AC_DEFUN(SC_CONFIG_MANPAGES, [
AC_MSG_CHECKING([whether to use symlinks for manpages])
AC_ARG_ENABLE(man-symlinks,
AC_HELP_STRING([--enable-man-symlinks],
[use symlinks for the manpages (default: off)]),
test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
enableval="no")
AC_MSG_RESULT([$enableval])
AC_MSG_CHECKING([whether to compress the manpages])
AC_ARG_ENABLE(man-compression,
AC_HELP_STRING([--enable-man-compression=PROG],
[compress the manpages with PROG (default: off)]),
[case $enableval in
yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
esac],
enableval="no")
AC_MSG_RESULT([$enableval])
if test "$enableval" != "no"; then
AC_MSG_CHECKING([for compressed file suffix])
touch TeST
$enableval TeST
Z=`ls TeST* | sed 's/^....//'`
rm -f TeST*
MAN_FLAGS="$MAN_FLAGS --extension $Z"
AC_MSG_RESULT([$Z])
fi
AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
AC_ARG_ENABLE(man-suffix,
AC_HELP_STRING([--enable-man-suffix=STRING],
[use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]),
[case $enableval in
yes) enableval="AC_PACKAGE_NAME";;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
esac],
enableval="no")
AC_MSG_RESULT([$enableval])
AC_SUBST(MAN_FLAGS)
])
#--------------------------------------------------------------------
# SC_CONFIG_CFLAGS
#
# Try to determine the proper flags to pass to the compiler
# for building shared libraries and other such nonsense.
|
| ︙ | ︙ | |||
814 815 816 817 818 819 820 |
#--------------------------------------------------------------------
AC_DEFUN(SC_CONFIG_CFLAGS, [
# Step 0.a: Enable 64 bit support?
AC_MSG_CHECKING([if 64bit support is requested])
| | > > > | > > > | 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 |
#--------------------------------------------------------------------
AC_DEFUN(SC_CONFIG_CFLAGS, [
# Step 0.a: Enable 64 bit support?
AC_MSG_CHECKING([if 64bit support is requested])
AC_ARG_ENABLE(64bit,
AC_HELP_STRING([--enable-64bit],
[enable 64bit support (default: off)]),
,enableval="no")
if test "$enableval" = "yes"; then
do64bit=yes
else
do64bit=no
fi
AC_MSG_RESULT($do64bit)
# Step 0.b: Enable Solaris 64 bit VIS support?
AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
AC_ARG_ENABLE(64bit-vis,
AC_HELP_STRING([--enable-64bit-vis],
[enable 64bit Sparc VIS support (default: off)]),
,enableval="no")
if test "$enableval" = "yes"; then
# Force 64bit on with VIS
do64bit=yes
do64bitVIS=yes
else
do64bitVIS=no
|
| ︙ | ︙ | |||
904 905 906 907 908 909 910 911 912 913 914 915 916 917 |
AC_CHECK_PROG(AR, ar, ar)
if test "${AR}" = "" ; then
AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
fi
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
case $system in
AIX-*)
if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
# AIX requires the _r compiler when gcc isn't being used
if test "${CC}" != "cc_r" ; then
CC=${CC}_r
fi
| > | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 |
AC_CHECK_PROG(AR, ar, ar)
if test "${AR}" = "" ; then
AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
fi
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
PLAT_SRCS=""
case $system in
AIX-*)
if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
# AIX requires the _r compiler when gcc isn't being used
if test "${CC}" != "cc_r" ; then
CC=${CC}_r
fi
|
| ︙ | ︙ | |||
1300 1301 1302 1303 1304 1305 1306 |
# FreeBSD doesn't handle version numbers with dots.
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
OpenBSD-*)
| > > > > > > > > > > > > > > > > > > > > > | | | | | | | > | | | | < > | < > | > > | 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 |
# FreeBSD doesn't handle version numbers with dots.
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
OpenBSD-*)
case `arch -s` in
m88k|vax)
SHLIB_CFLAGS=""
SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".a"
DL_OBJS="tclLoadAout.o"
DL_LIBS=""
LDFLAGS=""
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
;;
*)
# OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
case `machine` in
sparc|sparc64)
SHLIB_CFLAGS="-fPIC";;
*)
SHLIB_CFLAGS="-fpic";;
esac
SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
AC_MSG_CHECKING(for ELF)
AC_EGREP_CPP(yes, [
#ifdef __ELF__
yes
#endif
],
AC_MSG_RESULT(yes)
[ LDFLAGS=-Wl,-export-dynamic ],
AC_MSG_RESULT(no)
LDFLAGS=""
)
;;
esac
# OpenBSD doesn't do version numbers with dots.
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
FreeBSD-*)
# FreeBSD 3.* and greater have ELF.
|
| ︙ | ︙ | |||
1350 1351 1352 1353 1354 1355 1356 1357 1358 |
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
TCL_LIB_VERSIONS_OK=nodots
;;
esac
;;
Darwin-*)
SHLIB_CFLAGS="-fno-common"
SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
| > < | > > > > > > > < | > > > > > > > > < > > > > > > > > > > > > > > > > > > | | > > > > > < > > > > > > > > > | 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 |
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
TCL_LIB_VERSIONS_OK=nodots
;;
esac
;;
Darwin-*)
CFLAGS_OPTIMIZE="-Os"
SHLIB_CFLAGS="-fno-common"
SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
LDFLAGS=$hold_ldflags])
if test $tcl_cv_ld_single_module = yes; then
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
fi
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
LDFLAGS="$LDFLAGS -prebind"
AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
LDFLAGS=$hold_ldflags])
if test $tcl_cv_ld_search_paths_first = yes; then
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
fi
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
PLAT_OBJS='${MAC_OSX_OBJS}'
PLAT_SRCS='${MAC_OSX_SRCS}'
AC_MSG_CHECKING([whether to use CoreFoundation])
AC_ARG_ENABLE(corefoundation,
AC_HELP_STRING([--enable-corefoundation],
[use CoreFoundation API on MacOSX (default: yes)]),
[tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
AC_MSG_RESULT([$tcl_corefoundation])
if test $tcl_corefoundation = yes; then
AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
hold_libs=$LIBS
LIBS="$LIBS -framework CoreFoundation"
AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
[CFBundleRef b = CFBundleGetMainBundle();],
tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
LIBS=$hold_libs])
if test $tcl_cv_lib_corefoundation = yes; then
LIBS="$LIBS -framework CoreFoundation"
AC_DEFINE(HAVE_COREFOUNDATION, 1,
[Do we have access to Darwin CoreFoundation.framework ?])
fi
fi
AC_CHECK_HEADERS(libkern/OSAtomic.h)
AC_CHECK_FUNCS(OSSpinLockLock)
AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?])
AC_DEFINE(USE_VFORK, 1, [Should we use vfork() instead of fork()?])
AC_DEFINE(TCL_DEFAULT_ENCODING,"utf-8",
[Are we to override what our default encoding is?])
AC_DEFINE(MODULE_SCOPE, __private_extern__, [Linker support for module scope symbols])
AC_DEFINE(TCL_LOAD_FROM_MEMORY, 1, [Can this platform load code from memory?])
# prior to Darwin 7, realpath is not threadsafe, so don't
# use it when threads are enabled, c.f. bug # 711232:
AC_CHECK_FUNC(realpath)
if test "$ac_cv_func_realpath" = yes -a "${TCL_THREADS}" = 1 \
-a `uname -r | awk -F. '{print [$]1}'` -lt 7 ; then
ac_cv_func_realpath=no
fi
;;
NEXTSTEP-*)
SHLIB_CFLAGS=""
SHLIB_LD="cc -nostdlib -r"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadNext.o"
|
| ︙ | ︙ | |||
1518 1519 1520 1521 1522 1523 1524 |
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
| | > | 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 |
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
SunOS-5.[[0-6]])
# Careful to not let 5.10+ fall into this case
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
[Do we really want to follow the standard? Yes we do!])
|
| ︙ | ︙ | |||
1547 1548 1549 1550 1551 1552 1553 |
else
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
fi
;;
SunOS-5*)
| < | 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 |
else
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
fi
;;
SunOS-5*)
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
[Do we really want to follow the standard? Yes we do!])
|
| ︙ | ︙ | |||
1580 1581 1582 1583 1584 1585 1586 | CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" else CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi fi | > > > | > > > > > | | 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 |
CFLAGS="$CFLAGS -xarch=v9a"
LDFLAGS_ARCH="-xarch=v9a"
else
CFLAGS="$CFLAGS -xarch=v9"
LDFLAGS_ARCH="-xarch=v9"
fi
fi
elif test "$arch" = "amd64 i386" ; then
if test "$GCC" = "yes" ; then
AC_MSG_WARN([64bit mode not supported with GCC on $system])
else
do64bit_ok=yes
CFLAGS="$CFLAGS -xarch=amd64"
LDFLAGS="$LDFLAGS -xarch=amd64"
fi
else
AC_MSG_WARN([64bit mode not supported for $arch])
fi
fi
# Note: need the LIBS below, otherwise Tk won't find Tcl's
# symbols when dynamically loaded into tclsh.
SHLIB_LD_LIBS='${LIBS}'
|
| ︙ | ︙ | |||
1735 1736 1737 1738 1739 1740 1741 |
fi
fi
fi
fi
# Step 5: disable dynamic loading if requested via a command-line switch.
| > > | | 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 |
fi
fi
fi
fi
# Step 5: disable dynamic loading if requested via a command-line switch.
AC_ARG_ENABLE(load,
AC_HELP_STRING([--disable-load],
[disallow dynamic loading and "load" command (default: enabled)]),
[tcl_ok=$enableval], [tcl_ok=yes])
if test "$tcl_ok" = "no"; then
DL_OBJS=""
fi
if test "x$DL_OBJS" != "x" ; then
BUILD_DLTEST="\$(DLTEST_TARGETS)"
|
| ︙ | ︙ | |||
1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 |
# FIXME: This subst was left in only because the TCL_DL_LIBS
# entry in tclConfig.sh uses it. It is not clear why someone
# would use TCL_DL_LIBS instead of TCL_LIBS.
AC_SUBST(DL_LIBS)
AC_SUBST(DL_OBJS)
AC_SUBST(PLAT_OBJS)
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS_DEBUG)
AC_SUBST(CFLAGS_OPTIMIZE)
AC_SUBST(CFLAGS_WARNING)
AC_SUBST(LDFLAGS)
AC_SUBST(LDFLAGS_DEBUG)
| > | 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 |
# FIXME: This subst was left in only because the TCL_DL_LIBS
# entry in tclConfig.sh uses it. It is not clear why someone
# would use TCL_DL_LIBS instead of TCL_LIBS.
AC_SUBST(DL_LIBS)
AC_SUBST(DL_OBJS)
AC_SUBST(PLAT_OBJS)
AC_SUBST(PLAT_SRCS)
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS_DEBUG)
AC_SUBST(CFLAGS_OPTIMIZE)
AC_SUBST(CFLAGS_WARNING)
AC_SUBST(LDFLAGS)
AC_SUBST(LDFLAGS_DEBUG)
|
| ︙ | ︙ | |||
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 |
#
# HAVE_STRING_H ?
#
#--------------------------------------------------------------------
AC_DEFUN(SC_MISSING_POSIX_HEADERS, [
AC_MSG_CHECKING(dirent.h)
AC_TRY_LINK([#include <sys/types.h>
#include <dirent.h>], [
#ifndef _POSIX_SOURCE
# ifdef __Lynx__
/*
* Generate compilation error to make the test fail: Lynx headers
* are only valid if really in the POSIX environment.
*/
missing_procedure();
# endif
#endif
DIR *d;
struct dirent *entryPtr;
char *p;
d = opendir("foobar");
entryPtr = readdir(d);
p = entryPtr->d_name;
closedir(d);
| > | | | 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 |
#
# HAVE_STRING_H ?
#
#--------------------------------------------------------------------
AC_DEFUN(SC_MISSING_POSIX_HEADERS, [
AC_MSG_CHECKING(dirent.h)
AC_CACHE_VAL(tcl_cv_dirent_h,
AC_TRY_LINK([#include <sys/types.h>
#include <dirent.h>], [
#ifndef _POSIX_SOURCE
# ifdef __Lynx__
/*
* Generate compilation error to make the test fail: Lynx headers
* are only valid if really in the POSIX environment.
*/
missing_procedure();
# endif
#endif
DIR *d;
struct dirent *entryPtr;
char *p;
d = opendir("foobar");
entryPtr = readdir(d);
p = entryPtr->d_name;
closedir(d);
], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no))
if test $tcl_cv_dirent_h = no; then
AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
fi
AC_MSG_RESULT($tcl_ok)
AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
|
| ︙ | ︙ | |||
2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 |
AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
fi
if test "$XLIBSW" = nope ; then
AC_MSG_RESULT(couldn't find any! Using -lX11.)
XLIBSW=-lX11
fi
])
#--------------------------------------------------------------------
# SC_BLOCKING_STYLE
#
# The statements below check for systems where POSIX-style
# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
# On these systems (mostly older ones), use the old BSD-style
# FIONBIO approach instead.
| > | 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 |
AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
fi
if test "$XLIBSW" = nope ; then
AC_MSG_RESULT(couldn't find any! Using -lX11.)
XLIBSW=-lX11
fi
])
#--------------------------------------------------------------------
# SC_BLOCKING_STYLE
#
# The statements below check for systems where POSIX-style
# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
# On these systems (mostly older ones), use the old BSD-style
# FIONBIO approach instead.
|
| ︙ | ︙ | |||
2585 2586 2587 2588 2589 2590 2591 | # # Will define the following vars: # TCL_CFGVAL_ENCODING # #-------------------------------------------------------------------- AC_DEFUN(SC_TCL_CFG_ENCODING, [ | | > > > | 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 |
#
# Will define the following vars:
# TCL_CFGVAL_ENCODING
#
#--------------------------------------------------------------------
AC_DEFUN(SC_TCL_CFG_ENCODING, [
AC_ARG_WITH(encoding,
AC_HELP_STRING([--with-encoding],
[encoding for configuration values (default: iso8859-1)]),
with_tcencoding=${withval})
if test x"${with_tcencoding}" != x ; then
AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
[What encoding should be used for embedded configuration info?])
else
AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
[What encoding should be used for embedded configuration info?])
|
| ︙ | ︙ |
Changes to unix/tcl.spec.
|
| | | | 1 2 3 4 5 6 7 8 9 10 11 |
# $Id: tcl.spec,v 1.21.2.1 2005/06/13 01:47:15 msofer Exp $
# This file is the basis for a binary Tcl RPM for Linux.
%define version 8.5a4
%define directory /usr/local
Summary: Tcl scripting language development environment
Name: tcl
Version: %{version}
Release: 1
Copyright: BSD
|
| ︙ | ︙ |
Changes to unix/tclConfig.h.in.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* tclConfig.h.in. Generated from configure.in by autoheader. */ /* Is pthread_attr_get_np() declared in <pthread.h>? */ #undef ATTRGETNP_NOT_DECLARED /* Is pthread_getattr_np declared in <pthread.h>? */ #undef GETATTRNP_NOT_DECLARED /* Is gettimeofday() actually declared in <sys/time.h>? */ #undef GETTOD_NOT_DECLARED /* Do we have BSDgettimeofday()? */ #undef HAVE_BSDGETTIMEOFDAY | > > > | | | | > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | /* tclConfig.h.in. Generated from configure.in by autoheader. */ #ifndef _TCLCONFIG #define _TCLCONFIG /* Is pthread_attr_get_np() declared in <pthread.h>? */ #undef ATTRGETNP_NOT_DECLARED /* Is pthread_getattr_np declared in <pthread.h>? */ #undef GETATTRNP_NOT_DECLARED /* Is gettimeofday() actually declared in <sys/time.h>? */ #undef GETTOD_NOT_DECLARED /* Do we have BSDgettimeofday()? */ #undef HAVE_BSDGETTIMEOFDAY /* Define to 1 if you have the `chflags' function. */ #undef HAVE_CHFLAGS /* Do we have access to Darwin CoreFoundation.framework ? */ #undef HAVE_COREFOUNDATION /* Define to 1 if you have the `getattrlist' function. */ #undef HAVE_GETATTRLIST /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the `gmtime_r' function. */ #undef HAVE_GMTIME_R /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H /* Do we have nl_langinfo()? */ #undef HAVE_LANGINFO /* Define to 1 if you have the <libkern/OSAtomic.h> header file. */ #undef HAVE_LIBKERN_OSATOMIC_H /* Do we have <limits.h>? */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R /* Define to 1 if you have the `lseek64' function. */ #undef HAVE_LSEEK64 /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mktime' function. */ #undef HAVE_MKTIME /* Do we have <net/errno.h>? */ #undef HAVE_NET_ERRNO_H /* Define to 1 if you have the `open64' function. */ #undef HAVE_OPEN64 /* Define to 1 if you have the `opendir' function. */ #undef HAVE_OPENDIR /* Define to 1 if you have the `OSSpinLockLock' function. */ #undef HAVE_OSSPINLOCKLOCK /* Do we want a BSD-like thread-attribute interface? */ #undef HAVE_PTHREAD_ATTR_GET_NP /* Define to 1 if you have the `pthread_attr_setstacksize' function. */ #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE |
| ︙ | ︙ | |||
74 75 76 77 78 79 80 | /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H | < < < | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoll' function. */ #undef HAVE_STRTOLL /* Define to 1 if you have the `strtoull' function. */ |
| ︙ | ︙ | |||
155 156 157 158 159 160 161 | /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `waitpid' function. */ #undef HAVE_WAITPID | | > > > | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `waitpid' function. */ #undef HAVE_WAITPID /* Is this a Mac I see before me? */ #undef MAC_OSX_TCL /* Linker support for module scope symbols */ #undef MODULE_SCOPE /* Do we have <dirent.h>? */ #undef NO_DIRENT_H /* Do we have <dlfcn.h>? */ #undef NO_DLFCN_H |
| ︙ | ︙ | |||
257 258 259 260 261 262 263 | /* Is bytecode debugging enabled? */ #undef TCL_COMPILE_DEBUG /* Are bytecode statistics enabled? */ #undef TCL_COMPILE_STATS | < < < > > > | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | /* Is bytecode debugging enabled? */ #undef TCL_COMPILE_DEBUG /* Are bytecode statistics enabled? */ #undef TCL_COMPILE_STATS /* Are we to override what our default encoding is? */ #undef TCL_DEFAULT_ENCODING /* Is Tcl built as a framework? */ #undef TCL_FRAMEWORK /* Can this platform load code from memory? */ #undef TCL_LOAD_FROM_MEMORY /* Is memory debugging enabled? */ #undef TCL_MEM_DEBUG /* What is the default extension for shared libraries? */ #undef TCL_SHLIB_EXT |
| ︙ | ︙ | |||
382 383 384 385 386 387 388 | #undef socklen_t /* Do we want to use the strtod() in compat? */ #undef strtod /* Define to `int' if <sys/types.h> doesn't define. */ #undef uid_t | > > | 397 398 399 400 401 402 403 404 405 | #undef socklen_t /* Do we want to use the strtod() in compat? */ #undef strtod /* Define to `int' if <sys/types.h> doesn't define. */ #undef uid_t #endif /* _TCLCONFIG */ |
Changes to unix/tclConfig.sh.in.
1 2 3 4 5 6 7 8 9 10 11 | # tclConfig.sh -- # # This shell script (for sh) is generated automatically by Tcl's # configure script. It will create shell variables for most of # the configuration options discovered by the configure script. # This script is intended to be included by the configure scripts # for Tcl extensions so that they don't have to figure this all # out for themselves. # # The information in this file is specific to a single platform. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # tclConfig.sh -- # # This shell script (for sh) is generated automatically by Tcl's # configure script. It will create shell variables for most of # the configuration options discovered by the configure script. # This script is intended to be included by the configure scripts # for Tcl extensions so that they don't have to figure this all # out for themselves. # # The information in this file is specific to a single platform. # # RCS: @(#) $Id: tclConfig.sh.in,v 1.20.2.1 2005/06/13 01:47:15 msofer Exp $ # Tcl's version number. TCL_VERSION='@TCL_VERSION@' TCL_MAJOR_VERSION='@TCL_MAJOR_VERSION@' TCL_MINOR_VERSION='@TCL_MINOR_VERSION@' TCL_PATCH_LEVEL='@TCL_PATCH_LEVEL@' |
| ︙ | ︙ |
Changes to unix/tclLoadDyld.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclLoadDyld.c -- * * This procedure provides a version of the TclLoadFile that * works with Apple's dyld dynamic loading. This file * provided by Wilfredo Sanchez (wsanchez@apple.com). * This works on Mac OS X. * * Copyright (c) 1995 Apple Computer, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > | > > > | | | | | | | | | | | > > | > > > > > > | | > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | < > | | | | > > > > | < > > > > > | > | | | > | | > > | | | | | > > > > > > > | | > | | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 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 |
/*
* tclLoadDyld.c --
*
* This procedure provides a version of the TclLoadFile that
* works with Apple's dyld dynamic loading. This file
* provided by Wilfredo Sanchez (wsanchez@apple.com).
* This works on Mac OS X.
*
* Copyright (c) 1995 Apple Computer, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclLoadDyld.c,v 1.15.4.1 2005/06/13 01:47:15 msofer Exp $
*/
#include "tclInt.h"
#include <mach-o/dyld.h>
#include <mach/mach.h>
typedef struct Tcl_DyldModuleHandle {
struct Tcl_DyldModuleHandle *nextModuleHandle;
NSModule module;
} Tcl_DyldModuleHandle;
typedef struct Tcl_DyldLoadHandle {
CONST struct mach_header *dyld_lib;
Tcl_DyldModuleHandle *firstModuleHandle;
} Tcl_DyldLoadHandle;
#ifdef TCL_LOAD_FROM_MEMORY
typedef struct ThreadSpecificData {
int haveLoadMemory;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
#endif
/*
*----------------------------------------------------------------------
*
* DyldOFIErrorMsg --
*
* Converts a numerical NSObjectFileImage error into an
* error message string.
*
* Results:
* Error message string.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static CONST char* DyldOFIErrorMsg(int err) {
CONST char *ofi_msg = NULL;
if (err != NSObjectFileImageSuccess) {
switch(err) {
case NSObjectFileImageFailure:
ofi_msg = "object file setup failure";
break;
case NSObjectFileImageInappropriateFile:
ofi_msg = "not a Mach-O MH_BUNDLE file";
break;
case NSObjectFileImageArch:
ofi_msg = "no object for this architecture";
break;
case NSObjectFileImageFormat:
ofi_msg = "bad object file format";
break;
case NSObjectFileImageAccess:
ofi_msg = "can't read object file";
break;
default:
ofi_msg = "unknown error";
break;
}
}
return ofi_msg;
}
/*
*----------------------------------------------------------------------
*
* TclpDlopen --
*
* Dynamically loads a binary code file into memory and returns
* a handle to the new code.
*
* Results:
* A standard Tcl completion code. If an error occurs, an error
* message is left in the interpreter's result.
*
* Side effects:
* New code suddenly appears in memory.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE int
TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Obj *pathPtr; /* Name of the file containing the desired
* code (UTF-8). */
Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
Tcl_FSUnloadFileProc **unloadProcPtr;
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for
* this file. */
{
Tcl_DyldLoadHandle *dyldLoadHandle;
CONST struct mach_header *dyld_lib;
NSObjectFileImage dyld_ofi = NULL;
Tcl_DyldModuleHandle *dyldModuleHandle = NULL;
CONST char *native;
/*
* 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);
dyld_lib = NSAddImage(native,
NSADDIMAGE_OPTION_WITH_SEARCHING |
NSADDIMAGE_OPTION_RETURN_ON_ERROR);
if (!dyld_lib) {
NSLinkEditErrors editError;
CONST char *name, *msg, *ofi_msg = NULL;
NSLinkEditError(&editError, &errno, &name, &msg);
if (editError == NSLinkEditFileAccessError) {
/* The requested file was not found:
* 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;
char *fileName = Tcl_GetString(pathPtr);
CONST char *native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
dyld_lib = NSAddImage(native,
NSADDIMAGE_OPTION_WITH_SEARCHING |
NSADDIMAGE_OPTION_RETURN_ON_ERROR);
Tcl_DStringFree(&ds);
if (!dyld_lib) {
NSLinkEditError(&editError, &errno, &name, &msg);
}
} else if ((editError == NSLinkEditFileFormatError && errno == EBADMACHO)) {
/* The requested file was found but was not of type MH_DYLIB,
* attempt to load it as a MH_BUNDLE: */
NSObjectFileImageReturnCode err;
err = NSCreateObjectFileImageFromFile(native, &dyld_ofi);
ofi_msg = DyldOFIErrorMsg(err);
}
if (!dyld_lib && !dyld_ofi) {
Tcl_AppendResult(interp, msg, (char *) NULL);
if (ofi_msg) {
Tcl_AppendResult(interp, "NSCreateObjectFileImageFromFile() error: ",
ofi_msg, (char *) NULL);
}
return TCL_ERROR;
}
}
if (dyld_ofi) {
NSModule module;
module = NSLinkModule(dyld_ofi, native, NSLINKMODULE_OPTION_BINDNOW |
NSLINKMODULE_OPTION_RETURN_ON_ERROR);
NSDestroyObjectFileImage(dyld_ofi);
if (module) {
dyldModuleHandle = (Tcl_DyldModuleHandle *)
ckalloc(sizeof(Tcl_DyldModuleHandle));
if (!dyldModuleHandle) return TCL_ERROR;
dyldModuleHandle->module = module;
dyldModuleHandle->nextModuleHandle = NULL;
} else {
NSLinkEditErrors editError;
CONST char *name, *msg;
NSLinkEditError(&editError, &errno, &name, &msg);
Tcl_AppendResult(interp, msg, (char *) NULL);
return TCL_ERROR;
}
}
dyldLoadHandle = (Tcl_DyldLoadHandle *) ckalloc(sizeof(Tcl_DyldLoadHandle));
if (!dyldLoadHandle) return TCL_ERROR;
dyldLoadHandle->dyld_lib = dyld_lib;
dyldLoadHandle->firstModuleHandle = dyldModuleHandle;
*loadHandle = (Tcl_LoadHandle) dyldLoadHandle;
*unloadProcPtr = &TclpUnloadFile;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclpFindSymbol --
*
* Looks up a symbol, by name, through a handle associated with
* a previously loaded piece of code (shared library).
*
* Results:
* Returns a pointer to the function associated with 'symbol' if
* it is found. Otherwise returns NULL and may leave an error
* message in the interp's result.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE Tcl_PackageInitProc*
TclpFindSymbol(interp, loadHandle, symbol)
Tcl_Interp *interp;
Tcl_LoadHandle loadHandle;
CONST char *symbol;
{
NSSymbol nsSymbol;
CONST char *native;
Tcl_DString newName, ds;
Tcl_PackageInitProc* proc = NULL;
Tcl_DyldLoadHandle *dyldLoadHandle = (Tcl_DyldLoadHandle *) loadHandle;
/*
* dyld adds an underscore to the beginning of symbol names.
*/
native = Tcl_UtfToExternalDString(NULL, symbol, -1, &ds);
Tcl_DStringInit(&newName);
Tcl_DStringAppend(&newName, "_", 1);
native = Tcl_DStringAppend(&newName, native, -1);
if (dyldLoadHandle->dyld_lib) {
nsSymbol = NSLookupSymbolInImage(dyldLoadHandle->dyld_lib, native,
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW |
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
if(nsSymbol) {
/* until dyld supports unloading of MY_DYLIB binaries, the
* following is not needed: */
#ifdef DYLD_SUPPORTS_DYLIB_UNLOADING
NSModule module = NSModuleForSymbol(nsSymbol);
Tcl_DyldModuleHandle *dyldModuleHandle = dyldLoadHandle->firstModuleHandle;
while (dyldModuleHandle) {
if (module == dyldModuleHandle->module) break;
dyldModuleHandle = dyldModuleHandle->nextModuleHandle;
}
if (!dyldModuleHandle) {
dyldModuleHandle = (Tcl_DyldModuleHandle *)
ckalloc(sizeof(Tcl_DyldModuleHandle));
if (dyldModuleHandle) {
dyldModuleHandle->module = module;
dyldModuleHandle->nextModuleHandle =
dyldLoadHandle->firstModuleHandle;
dyldLoadHandle->firstModuleHandle = dyldModuleHandle;
}
}
#endif /* DYLD_SUPPORTS_DYLIB_UNLOADING */
} else {
NSLinkEditErrors editError;
CONST char *name, *msg;
NSLinkEditError(&editError, &errno, &name, &msg);
Tcl_AppendResult(interp, msg, (char *) NULL);
}
} else {
nsSymbol = NSLookupSymbolInModule(dyldLoadHandle->firstModuleHandle->module,
native);
}
if(nsSymbol) {
proc = NSAddressOfSymbol(nsSymbol);
}
Tcl_DStringFree(&newName);
Tcl_DStringFree(&ds);
return proc;
}
/*
*----------------------------------------------------------------------
*
* TclpUnloadFile --
*
* Unloads a dynamically loaded binary code file from memory.
* Code pointers in the formerly loaded file are no longer valid
* after calling this function.
*
* Results:
* None.
*
* Side effects:
* Code dissapears from memory.
* Note that dyld currently only supports unloading of binaries of
* type MH_BUNDLE loaded with NSLinkModule() in TclpDlopen() above.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE void
TclpUnloadFile(loadHandle)
Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call
* to TclpDlopen(). The loadHandle is
* a token that represents the loaded
* file. */
{
Tcl_DyldLoadHandle *dyldLoadHandle = (Tcl_DyldLoadHandle *) loadHandle;
Tcl_DyldModuleHandle *dyldModuleHandle = dyldLoadHandle->firstModuleHandle;
void *ptr;
while (dyldModuleHandle) {
NSUnLinkModule(dyldModuleHandle->module,
NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES);
ptr = dyldModuleHandle;
dyldModuleHandle = dyldModuleHandle->nextModuleHandle;
ckfree(ptr);
}
ckfree((char*) dyldLoadHandle);
}
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package
* name, this procedure is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a
* package name; generic code will then try to guess the package
* from the file name. A return value of 1 would have meant that
* we figured out the package name and put it in bufPtr.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE int
TclGuessPackageName(fileName, bufPtr)
CONST char *fileName; /* Name of file containing package (already
* translated to local form if needed). */
Tcl_DString *bufPtr; /* Initialized empty dstring. Append
* package name to this if possible. */
{
return 0;
}
#ifdef TCL_LOAD_FROM_MEMORY
/*
*----------------------------------------------------------------------
*
* TclpLoadMemoryGetBuffer --
*
* Allocate a buffer that can be used with TclpLoadMemory() below.
*
* Results:
* Pointer to allocated buffer or NULL if an error occurs.
*
* Side effects:
* Buffer is allocated.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE void*
TclpLoadMemoryGetBuffer(interp, size)
Tcl_Interp *interp; /* Used for error reporting. */
int size; /* Size of desired buffer */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
void * buffer = NULL;
if (!tsdPtr->haveLoadMemory) {
/* NSCreateObjectFileImageFromMemory is available but always
* fails prior to Darwin 7 */
struct utsname name;
if (!uname(&name)) {
long release = strtol(name.release, NULL, 10);
tsdPtr->haveLoadMemory = (release >= 7) ? 1 : -1;
}
}
if (tsdPtr->haveLoadMemory > 0) {
/* We must allocate the buffer using vm_allocate, because
* NSCreateObjectFileImageFromMemory will dispose of it
* using vm_deallocate.
*/
int err = vm_allocate(mach_task_self(),
(vm_address_t*)&buffer, size, 1);
if (err) {
buffer = NULL;
}
}
return buffer;
}
/*
*----------------------------------------------------------------------
*
* TclpLoadMemory --
*
* Dynamically loads binary code file from memory and returns
* a handle to the new code.
*
* Results:
* A standard Tcl completion code. If an error occurs, an error
* message is left in the interpreter's result.
*
* Side effects:
* New code is loaded from memory.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE int
TclpLoadMemory(interp, buffer, size, codeSize, loadHandle, unloadProcPtr)
Tcl_Interp *interp; /* Used for error reporting. */
void *buffer; /* Buffer containing the desired code
* (allocated with TclpLoadMemoryGetBuffer). */
int size; /* Allocation size of buffer. */
int codeSize; /* Size of code data read into buffer or -1 if
* an error occurred and the buffer should
* just be freed. */
Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
Tcl_FSUnloadFileProc **unloadProcPtr;
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for
* this file. */
{
Tcl_DyldLoadHandle *dyldLoadHandle;
NSObjectFileImage dyld_ofi = NULL;
Tcl_DyldModuleHandle *dyldModuleHandle;
CONST char *ofi_msg = NULL;
if (codeSize >= 0) {
NSObjectFileImageReturnCode err;
err = NSCreateObjectFileImageFromMemory(buffer, codeSize, &dyld_ofi);
ofi_msg = DyldOFIErrorMsg(err);
}
if (!dyld_ofi) {
vm_deallocate(mach_task_self(), (vm_address_t) buffer, size);
if (ofi_msg) {
Tcl_AppendResult(interp, "NSCreateObjectFileImageFromFile() error: ",
ofi_msg, (char *) NULL);
}
return TCL_ERROR;
} else {
NSModule module;
module = NSLinkModule(dyld_ofi, "[Memory Based Bundle]",
NSLINKMODULE_OPTION_BINDNOW |NSLINKMODULE_OPTION_RETURN_ON_ERROR);
NSDestroyObjectFileImage(dyld_ofi);
if (module) {
dyldModuleHandle = (Tcl_DyldModuleHandle *)
ckalloc(sizeof(Tcl_DyldModuleHandle));
if (!dyldModuleHandle) return TCL_ERROR;
dyldModuleHandle->module = module;
dyldModuleHandle->nextModuleHandle = NULL;
} else {
NSLinkEditErrors editError;
CONST char *name, *msg;
NSLinkEditError(&editError, &errno, &name, &msg);
Tcl_AppendResult(interp, msg, (char *) NULL);
return TCL_ERROR;
}
}
dyldLoadHandle = (Tcl_DyldLoadHandle *) ckalloc(sizeof(Tcl_DyldLoadHandle));
if (!dyldLoadHandle) return TCL_ERROR;
dyldLoadHandle->dyld_lib = NULL;
dyldLoadHandle->firstModuleHandle = dyldModuleHandle;
*loadHandle = (Tcl_LoadHandle) dyldLoadHandle;
*unloadProcPtr = &TclpUnloadFile;
return TCL_OK;
}
#endif
|
Changes to unix/tclUnixChan.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUnixChan.c * * Common channel driver for Unix channels based on files, command * pipes and TCP sockets. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclUnixChan.c * * Common channel driver for Unix channels based on files, command * pipes and TCP sockets. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixChan.c,v 1.54.2.1 2005/06/13 01:47:15 msofer Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ #include "tclIO.h" /* To get Channel type declaration. */ /* * sys/ioctl.h has already been included by tclPort.h. Including termios.h |
| ︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #undef ECHO #undef NOFLSH #undef TOSTOP #undef FLUSHO #undef PENDIN #define SUPPORTS_TTY #ifdef USE_TERMIOS # include <termios.h> # ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> # endif /* HAVE_SYS_IOCTL_H */ # ifdef HAVE_SYS_MODEM_H | > > > > > > > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #undef ECHO #undef NOFLSH #undef TOSTOP #undef FLUSHO #undef PENDIN #define SUPPORTS_TTY #undef DIRECT_BAUD #ifdef B4800 # if (B4800 == 4800) # define DIRECT_BAUD # endif /* B4800 == 4800 */ #endif /* B4800 */ #ifdef USE_TERMIOS # include <termios.h> # ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> # endif /* HAVE_SYS_IOCTL_H */ # ifdef HAVE_SYS_MODEM_H |
| ︙ | ︙ | |||
230 231 232 233 234 235 236 | static int FileOutputProc _ANSI_ARGS_(( ClientData instanceData, CONST char *buf, int toWrite, int *errorCode)); static int FileSeekProc _ANSI_ARGS_((ClientData instanceData, long offset, int mode, int *errorCode)); #ifdef DEPRECATED static void FileThreadActionProc _ANSI_ARGS_ (( | | > > | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | static int FileOutputProc _ANSI_ARGS_(( ClientData instanceData, CONST char *buf, int toWrite, int *errorCode)); static int FileSeekProc _ANSI_ARGS_((ClientData instanceData, long offset, int mode, int *errorCode)); #ifdef DEPRECATED static void FileThreadActionProc _ANSI_ARGS_ (( ClientData instanceData, int action)); #endif static int FileTruncateProc _ANSI_ARGS_ ((ClientData instanceData, Tcl_WideInt length)); static Tcl_WideInt FileWideSeekProc _ANSI_ARGS_((ClientData instanceData, Tcl_WideInt offset, int mode, int *errorCode)); static void FileWatchProc _ANSI_ARGS_((ClientData instanceData, int mask)); static void TcpAccept _ANSI_ARGS_((ClientData data, int mask)); static int TcpBlockModeProc _ANSI_ARGS_((ClientData data, int mode)); |
| ︙ | ︙ | |||
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | static void TcpWatchProc _ANSI_ARGS_((ClientData instanceData, int mask)); #ifdef SUPPORTS_TTY static int TtyCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static void TtyGetAttributes _ANSI_ARGS_((int fd, TtyAttrs *ttyPtr)); static int TtyGetBaud _ANSI_ARGS_((unsigned long speed)); static int TtyGetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, CONST char *optionName, Tcl_DString *dsPtr)); static unsigned long TtyGetSpeed _ANSI_ARGS_((int baud)); static FileState * TtyInit _ANSI_ARGS_((int fd, int initialize)); static void TtyModemStatusStr _ANSI_ARGS_((int status, Tcl_DString *dsPtr)); #if BAD_TIP35_FLUSH static int TtyOutputProc _ANSI_ARGS_((ClientData instanceData, CONST char *buf, int toWrite, int *errorCode)); #endif /* BAD_TIP35_FLUSH */ | > > > > | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | static void TcpWatchProc _ANSI_ARGS_((ClientData instanceData, int mask)); #ifdef SUPPORTS_TTY static int TtyCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static void TtyGetAttributes _ANSI_ARGS_((int fd, TtyAttrs *ttyPtr)); #ifndef DIRECT_BAUD static int TtyGetBaud _ANSI_ARGS_((unsigned long speed)); #endif static int TtyGetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, CONST char *optionName, Tcl_DString *dsPtr)); #ifndef DIRECT_BAUD static unsigned long TtyGetSpeed _ANSI_ARGS_((int baud)); #endif static FileState * TtyInit _ANSI_ARGS_((int fd, int initialize)); static void TtyModemStatusStr _ANSI_ARGS_((int status, Tcl_DString *dsPtr)); #if BAD_TIP35_FLUSH static int TtyOutputProc _ANSI_ARGS_((ClientData instanceData, CONST char *buf, int toWrite, int *errorCode)); #endif /* BAD_TIP35_FLUSH */ |
| ︙ | ︙ | |||
310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
NULL, /* handler proc. */
FileWideSeekProc, /* wide seek proc. */
#ifdef DEPRECATED
FileThreadActionProc, /* thread actions */
#else
NULL,
#endif
};
#ifdef SUPPORTS_TTY
/*
* This structure describes the channel type structure for serial IO.
* Note that this type is a subclass of the "file" type.
*/
| > | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
NULL, /* handler proc. */
FileWideSeekProc, /* wide seek proc. */
#ifdef DEPRECATED
FileThreadActionProc, /* thread actions */
#else
NULL,
#endif
FileTruncateProc, /* truncate proc. */
};
#ifdef SUPPORTS_TTY
/*
* This structure describes the channel type structure for serial IO.
* Note that this type is a subclass of the "file" type.
*/
|
| ︙ | ︙ | |||
339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
FileGetHandleProc, /* Get OS handles out of channel. */
NULL, /* close2proc. */
FileBlockModeProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
NULL, /* wide seek proc. */
NULL, /* thread action proc. */
};
#endif /* SUPPORTS_TTY */
/*
* This structure describes the channel type structure for TCP socket
* based IO:
*/
| > | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
FileGetHandleProc, /* Get OS handles out of channel. */
NULL, /* close2proc. */
FileBlockModeProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
NULL, /* wide seek proc. */
NULL, /* thread action proc. */
NULL, /* truncate proc. */
};
#endif /* SUPPORTS_TTY */
/*
* This structure describes the channel type structure for TCP socket
* based IO:
*/
|
| ︙ | ︙ | |||
364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
TcpGetHandleProc, /* Get OS handles out of channel. */
NULL, /* close2proc. */
TcpBlockModeProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
NULL, /* wide seek proc. */
NULL, /* thread action proc. */
};
/*
*----------------------------------------------------------------------
*
* FileBlockModeProc --
| > | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
TcpGetHandleProc, /* Get OS handles out of channel. */
NULL, /* close2proc. */
TcpBlockModeProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
NULL, /* wide seek proc. */
NULL, /* thread action proc. */
NULL, /* truncate proc. */
};
/*
*----------------------------------------------------------------------
*
* FileBlockModeProc --
|
| ︙ | ︙ | |||
1186 1187 1188 1189 1190 1191 1192 |
"mode queue ttystatus xchar");
#else /* !USE_TERMIOS */
"mode");
#endif /* USE_TERMIOS */
}
}
| < < < < < < < | 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 |
"mode queue ttystatus xchar");
#else /* !USE_TERMIOS */
"mode");
#endif /* USE_TERMIOS */
}
}
#ifdef DIRECT_BAUD
# define TtyGetSpeed(baud) ((unsigned) (baud))
# define TtyGetBaud(speed) ((int) (speed))
#else /* !DIRECT_BAUD */
static struct {int baud; unsigned long speed;} speeds[] = {
#ifdef B0
|
| ︙ | ︙ | |||
3029 3030 3031 3032 3033 3034 3035 | * Side effects: * May invoke fdopen to create the FILE * for the requested file. * *---------------------------------------------------------------------- */ int | | | | | | | 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 |
* Side effects:
* May invoke fdopen to create the FILE * for the requested file.
*
*----------------------------------------------------------------------
*/
int
Tcl_GetOpenFile(interp, chanID, forWriting, checkUsage, filePtr)
Tcl_Interp *interp; /* Interpreter in which to find file. */
CONST char *chanID; /* String that identifies file. */
int forWriting; /* 1 means the file is going to be used
* for writing, 0 means for reading. */
int checkUsage; /* 1 means verify that the file was opened
* in a mode that allows the access specified
* by "forWriting". Ignored, we always
* check that the channel is open for the
* requested mode. */
ClientData *filePtr; /* Store pointer to FILE structure here. */
{
Tcl_Channel chan;
int chanMode;
Tcl_ChannelType *chanTypePtr;
ClientData data;
int fd;
FILE *f;
chan = Tcl_GetChannel(interp, chanID, &chanMode);
if (chan == (Tcl_Channel) NULL) {
return TCL_ERROR;
}
if ((forWriting) && ((chanMode & TCL_WRITABLE) == 0)) {
Tcl_AppendResult(interp,
"\"", chanID, "\" wasn't opened for writing", (char *) NULL);
return TCL_ERROR;
} else if ((!(forWriting)) && ((chanMode & TCL_READABLE) == 0)) {
Tcl_AppendResult(interp,
"\"", chanID, "\" wasn't opened for reading", (char *) NULL);
return TCL_ERROR;
}
/*
* We allow creating a FILE * out of file based, pipe based and socket
* based channels. We currently do not allow any other channel types,
* because it is likely that stdio will not know what to do with them.
|
| ︙ | ︙ | |||
3088 3089 3090 3091 3092 3093 3094 |
* The call to fdopen below is probably dangerous, since it will
* truncate an existing file if the file is being opened
* for writing....
*/
f = fdopen(fd, (forWriting ? "w" : "r"));
if (f == NULL) {
| | | | 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 |
* The call to fdopen below is probably dangerous, since it will
* truncate an existing file if the file is being opened
* for writing....
*/
f = fdopen(fd, (forWriting ? "w" : "r"));
if (f == NULL) {
Tcl_AppendResult(interp, "cannot get a FILE * for \"", chanID,
"\"", (char *) NULL);
return TCL_ERROR;
}
*filePtr = (ClientData) f;
return TCL_OK;
}
}
Tcl_AppendResult(interp, "\"", chanID,
"\" cannot be used to get a FILE *", (char *) NULL);
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
3310 3311 3312 3313 3314 3315 3316 |
if (!removed) {
Tcl_Panic("file info ptr not on thread channel list");
}
}
}
#endif
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 |
if (!removed) {
Tcl_Panic("file info ptr not on thread channel list");
}
}
}
#endif
/*
*----------------------------------------------------------------------
*
* FileTruncateProc --
*
* Truncates a file to a given length.
*
* Results:
* 0 if the operation succeeded, and -1 if it failed (in which
* case *errorCodePtr will be set to errno).
*
* Side effects:
* The underlying file is potentially truncated. This can have a
* wide variety of side effects, including moving file pointers
* that point at places later in the file than the truncate
* point.
*
*----------------------------------------------------------------------
*/
int
FileTruncateProc(instanceData, length)
ClientData instanceData;
Tcl_WideInt length;
{
FileState *fsPtr = (FileState *) instanceData;
int result;
#ifdef HAVE_TYPE_OFF64_T
/*
* We assume this goes with the type for now...
*/
result = ftruncate64(fsPtr->fd, (off64_t) length);
#else
result = ftruncate(fsPtr->fd, (off_t) length);
#endif
if (result) {
return errno;
}
return 0;
}
|
Changes to unix/tclUnixEvent.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclUnixEvent.c -- * * This file implements Unix specific event related routines. * * Copyright (c) 1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclUnixEvent.c -- * * This file implements Unix specific event related routines. * * Copyright (c) 1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixEvent.c,v 1.6.2.1 2005/06/13 01:47:15 msofer Exp $ */ #include "tclInt.h" /* *---------------------------------------------------------------------- * |
| ︙ | ︙ |
Changes to unix/tclUnixFCmd.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUnixFCmd.c * * This file implements the unix specific portion of file manipulation * subcommands of the "file" command. All filename arguments should * already be translated to native format. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclUnixFCmd.c * * This file implements the unix specific portion of file manipulation * subcommands of the "file" command. All filename arguments should * already be translated to native format. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixFCmd.c,v 1.41.2.1 2005/06/13 01:47:15 msofer Exp $ * * Portions of this code were derived from NetBSD source code which has * the following copyright notice: * * Copyright (c) 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * |
| ︙ | ︙ | |||
131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
#endif
#ifdef MAC_OSX_TCL
MACOSX_CREATOR_ATTRIBUTE,
MACOSX_TYPE_ATTRIBUTE,
MACOSX_HIDDEN_ATTRIBUTE,
MACOSX_RSRCLENGTH_ATTRIBUTE,
#endif
};
CONST char *tclpFileAttrStrings[] = {
"-group",
"-owner",
"-permissions",
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE)
| > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
#endif
#ifdef MAC_OSX_TCL
MACOSX_CREATOR_ATTRIBUTE,
MACOSX_TYPE_ATTRIBUTE,
MACOSX_HIDDEN_ATTRIBUTE,
MACOSX_RSRCLENGTH_ATTRIBUTE,
#endif
UNIX_INVALID_ATTRIBUTE /* lint - last enum value needs no trailing , */
};
CONST char *tclpFileAttrStrings[] = {
"-group",
"-owner",
"-permissions",
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE)
|
| ︙ | ︙ |
Changes to unix/tclUnixInit.c.
1 2 3 4 5 6 7 8 9 | /* * tclUnixInit.c -- * * Contains the Unix-specific interpreter initialization functions. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* * tclUnixInit.c -- * * Contains the Unix-specific interpreter initialization functions. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * * RCS: @(#) $Id: tclUnixInit.c,v 1.54.2.1 2005/06/13 01:47:16 msofer Exp $ */ #include "tclInt.h" #include <stddef.h> #include <locale.h> #ifdef HAVE_LANGINFO #include <langinfo.h> #endif #include <sys/resource.h> #if defined(__FreeBSD__) # include <floatingpoint.h> #endif #if defined(__bsdi__) # include <sys/param.h> # if _BSDI_VERSION > 199501 # include <dlfcn.h> # endif #endif #ifdef HAVE_COREFOUNDATION #include <CoreFoundation/CoreFoundation.h> #endif /* * Define this if you want to revert to the old behavior of * never checking the stack. */ |
| ︙ | ︙ | |||
126 127 128 129 130 131 132 133 134 |
* encoding to Tcl encoding name.
*/
typedef struct LocaleTable {
CONST char *lang;
CONST char *encoding;
} LocaleTable;
static CONST LocaleTable localeTable[] = {
| > > > > > > > > > > < > > | 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 |
* encoding to Tcl encoding name.
*/
typedef struct LocaleTable {
CONST char *lang;
CONST char *encoding;
} LocaleTable;
/*
* The table below is sorted for the sake of doing binary searches on it.
* The indenting reflects different categories of data. The leftmost
* data represent the encoding names directly implemented by data files
* in Tcl's default encoding directory. Indented by one TAB are the
* encoding names that are common alternative spellings. Indented by
* two TABs are the accumulated "bug fixes" that have been added to
* deal with the wide variability seen among existing platforms.
*/
static CONST LocaleTable localeTable[] = {
{"", "iso8859-1"},
{"ansi_x3.4-1968", "iso8859-1"},
{"ascii", "ascii"},
{"big5", "big5"},
{"cp1250", "cp1250"},
{"cp1251", "cp1251"},
{"cp1252", "cp1252"},
{"cp1253", "cp1253"},
{"cp1254", "cp1254"},
|
| ︙ | ︙ | |||
165 166 167 168 169 170 171 172 173 174 |
{"cp949", "cp949"},
{"cp950", "cp950"},
{"dingbats", "dingbats"},
{"ebcdic", "ebcdic"},
{"euc-cn", "euc-cn"},
{"euc-jp", "euc-jp"},
{"euc-kr", "euc-kr"},
{"gb12345", "gb12345"},
{"gb1988", "gb1988"},
{"gb2312-raw", "gb2312-raw"},
| > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < | < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | < | | | | > < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | < | | < | | | 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 |
{"cp949", "cp949"},
{"cp950", "cp950"},
{"dingbats", "dingbats"},
{"ebcdic", "ebcdic"},
{"euc-cn", "euc-cn"},
{"euc-jp", "euc-jp"},
{"euc-kr", "euc-kr"},
{"eucjp", "euc-jp"},
{"euckr", "euc-kr"},
{"euctw", "euc-cn"},
{"gb12345", "gb12345"},
{"gb1988", "gb1988"},
{"gb2312", "gb2312"},
{"gb2312-1980", "gb2312"},
{"gb2312-raw", "gb2312-raw"},
{"greek8", "cp869"},
{"ibm1250", "cp1250"},
{"ibm1251", "cp1251"},
{"ibm1252", "cp1252"},
{"ibm1253", "cp1253"},
{"ibm1254", "cp1254"},
{"ibm1255", "cp1255"},
{"ibm1256", "cp1256"},
{"ibm1257", "cp1257"},
{"ibm1258", "cp1258"},
{"ibm437", "cp437"},
{"ibm737", "cp737"},
{"ibm775", "cp775"},
{"ibm850", "cp850"},
{"ibm852", "cp852"},
{"ibm855", "cp855"},
{"ibm857", "cp857"},
{"ibm860", "cp860"},
{"ibm861", "cp861"},
{"ibm862", "cp862"},
{"ibm863", "cp863"},
{"ibm864", "cp864"},
{"ibm865", "cp865"},
{"ibm866", "cp866"},
{"ibm869", "cp869"},
{"ibm874", "cp874"},
{"ibm932", "cp932"},
{"ibm936", "cp936"},
{"ibm949", "cp949"},
{"ibm950", "cp950"},
{"iso-2022", "iso2022"},
{"iso-2022-jp", "iso2022-jp"},
{"iso-2022-kr", "iso2022-kr"},
{"iso-8859-1", "iso8859-1"},
{"iso-8859-10", "iso8859-10"},
{"iso-8859-13", "iso8859-13"},
{"iso-8859-14", "iso8859-14"},
{"iso-8859-15", "iso8859-15"},
{"iso-8859-16", "iso8859-16"},
{"iso-8859-2", "iso8859-2"},
{"iso-8859-3", "iso8859-3"},
{"iso-8859-4", "iso8859-4"},
{"iso-8859-5", "iso8859-5"},
{"iso-8859-6", "iso8859-6"},
{"iso-8859-7", "iso8859-7"},
{"iso-8859-8", "iso8859-8"},
{"iso-8859-9", "iso8859-9"},
{"iso2022", "iso2022"},
{"iso2022-jp", "iso2022-jp"},
{"iso2022-kr", "iso2022-kr"},
{"iso8859-1", "iso8859-1"},
{"iso8859-10", "iso8859-10"},
{"iso8859-13", "iso8859-13"},
{"iso8859-14", "iso8859-14"},
{"iso8859-15", "iso8859-15"},
{"iso8859-16", "iso8859-16"},
{"iso8859-2", "iso8859-2"},
{"iso8859-3", "iso8859-3"},
{"iso8859-4", "iso8859-4"},
{"iso8859-5", "iso8859-5"},
{"iso8859-6", "iso8859-6"},
{"iso8859-7", "iso8859-7"},
{"iso8859-8", "iso8859-8"},
{"iso8859-9", "iso8859-9"},
{"iso88591", "iso8859-1"},
{"iso885915", "iso8859-15"},
{"iso88592", "iso8859-2"},
{"iso88595", "iso8859-5"},
{"iso88596", "iso8859-6"},
{"iso88597", "iso8859-7"},
{"iso88598", "iso8859-8"},
{"iso88599", "iso8859-9"},
#ifdef hpux
{"ja", "shiftjis"},
#else
{"ja", "euc-jp"},
#endif
{"ja_jp", "euc-jp"},
{"ja_jp.euc", "euc-jp"},
{"ja_jp.eucjp", "euc-jp"},
{"ja_jp.jis", "iso2022-jp"},
{"ja_jp.mscode", "shiftjis"},
{"ja_jp.sjis", "shiftjis"},
{"ja_jp.ujis", "euc-jp"},
{"japan", "euc-jp"},
#ifdef hpux
{"japanese", "shiftjis"},
#else
{"japanese", "euc-jp"},
#endif
{"japanese-sjis", "shiftjis"},
{"japanese-ujis", "euc-jp"},
{"japanese.euc", "euc-jp"},
{"japanese.sjis", "shiftjis"},
{"jis0201", "jis0201"},
{"jis0208", "jis0208"},
{"jis0212", "jis0212"},
{"jp_jp", "shiftjis"},
{"ko", "euc-kr"},
{"ko_kr", "euc-kr"},
{"ko_kr.euc", "euc-kr"},
{"ko_kw.euckw", "euc-kr"},
{"koi8-r", "koi8-r"},
{"koi8-u", "koi8-u"},
{"korean", "euc-kr"},
{"ksc5601", "ksc5601"},
{"maccenteuro", "macCentEuro"},
{"maccroatian", "macCroatian"},
{"maccyrillic", "macCyrillic"},
{"macdingbats", "macDingbats"},
{"macgreek", "macGreek"},
{"maciceland", "macIceland"},
{"macjapan", "macJapan"},
{"macroman", "macRoman"},
{"macromania", "macRomania"},
{"macthai", "macThai"},
{"macturkish", "macTurkish"},
{"macukraine", "macUkraine"},
{"roman8", "iso8859-1"},
{"ru", "iso8859-5"},
{"ru_ru", "iso8859-5"},
{"ru_su", "iso8859-5"},
{"shiftjis", "shiftjis"},
{"sjis", "shiftjis"},
{"symbol", "symbol"},
{"tis-620", "tis-620"},
{"tis620", "tis-620"},
{"turkish8", "cp857"},
{"utf8", "utf-8"},
{"zh", "cp936"},
{"zh_cn.gb2312", "euc-cn"},
{"zh_cn.gbk", "euc-cn"},
{"zh_cz.gb2312", "euc-cn"},
{"zh_tw", "euc-tw"},
{"zh_tw.big5", "big5"},
};
#ifndef TCL_NO_STACK_CHECK
static int GetStackSize _ANSI_ARGS_((size_t *stackSizePtr));
#endif /* TCL_NO_STACK_CHECK */
#ifdef HAVE_COREFOUNDATION
static int MacOSXGetLibraryPath _ANSI_ARGS_((
Tcl_Interp *interp, int maxPathLen,
char *tclLibPath));
#endif /* HAVE_COREFOUNDATION */
/*
*---------------------------------------------------------------------------
*
* TclpInitPlatform --
*
|
| ︙ | ︙ | |||
521 522 523 524 525 526 527 |
/*
* Finally, look for the library relative to the compiled-in path.
* This is needed when users install Tcl with an exec-prefix that
* is different from the prtefix.
*/
{
| | | | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
/*
* Finally, look for the library relative to the compiled-in path.
* This is needed when users install Tcl with an exec-prefix that
* is different from the prtefix.
*/
{
#ifdef HAVE_COREFOUNDATION
char tclLibPath[MAXPATHLEN + 1];
if (MacOSXGetLibraryPath(NULL, MAXPATHLEN, tclLibPath) == TCL_OK) {
str = tclLibPath;
} else
#endif /* HAVE_COREFOUNDATION */
{
/* TODO: Pull this value from the TIP 59 table */
str = defaultLibraryDir;
}
if (str[0] != '\0') {
objPtr = Tcl_NewStringObj(str, -1);
Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
|
| ︙ | ︙ | |||
584 585 586 587 588 589 590 591 592 593 594 595 596 |
}
void
TclpSetInterfaces()
{
/* do nothing */
}
CONST char *
TclpGetEncodingNameFromEnvironment(bufPtr)
Tcl_DString *bufPtr;
{
CONST char *encoding;
| > > > > > > > > > > > > > > > > > > > > > | < | < | < | < < < | | 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 |
}
void
TclpSetInterfaces()
{
/* do nothing */
}
static CONST char *
SearchKnownEncodings(encoding)
CONST char *encoding;
{
int left = 0;
int right = sizeof(localeTable)/sizeof(LocaleTable);
while (left <= right) {
int test = (left + right)/2;
int code = strcmp(localeTable[test].lang, encoding);
if (code == 0) {
return localeTable[test].encoding;
}
if (code < 0) {
left = test+1;
} else {
right = test-1;
}
}
return NULL;
}
CONST char *
TclpGetEncodingNameFromEnvironment(bufPtr)
Tcl_DString *bufPtr;
{
CONST char *encoding;
CONST char *knownEncoding;
Tcl_DStringInit(bufPtr);
/*
* Determine the current encoding from the LC_* or LANG environment
* variables. We previously used setlocale() to determine the locale,
* but this does not work on some systems (e.g. Linux/i386 RH 5.0).
*/
#ifdef HAVE_LANGINFO
if (setlocale(LC_CTYPE, "") != NULL) {
Tcl_DString ds;
/* Use a DString so we can modify case. */
Tcl_DStringInit(&ds);
encoding = Tcl_DStringAppend(&ds, nl_langinfo(CODESET), -1);
Tcl_UtfToLower(Tcl_DStringValue(&ds));
knownEncoding = SearchKnownEncodings(encoding);
if (knownEncoding != NULL) {
Tcl_DStringAppend(bufPtr, knownEncoding, -1);
} else if (NULL != Tcl_GetEncoding(NULL, encoding)) {
Tcl_DStringAppend(bufPtr, encoding, -1);
}
Tcl_DStringFree(&ds);
if (Tcl_DStringLength(bufPtr)) {
return Tcl_DStringValue(bufPtr);
}
}
|
| ︙ | ︙ | |||
644 645 646 647 648 649 650 651 |
}
if (encoding == NULL || encoding[0] == '\0') {
encoding = NULL;
}
if (encoding != NULL) {
CONST char *p;
| > > | | > | > | < | < < < | > | < | < | < | < < < | < | | < < < | | | < < | 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 693 694 695 696 697 698 |
}
if (encoding == NULL || encoding[0] == '\0') {
encoding = NULL;
}
if (encoding != NULL) {
CONST char *p;
Tcl_DString ds;
Tcl_DStringInit(&ds);
p = encoding;
encoding = Tcl_DStringAppend(&ds, p, -1);
Tcl_UtfToLower(Tcl_DStringValue(&ds));
knownEncoding = SearchKnownEncodings(encoding);
if (knownEncoding != NULL) {
Tcl_DStringAppend(bufPtr, knownEncoding, -1);
} else if (NULL != Tcl_GetEncoding(NULL, encoding)) {
Tcl_DStringAppend(bufPtr, encoding, -1);
}
if (Tcl_DStringLength(bufPtr)) {
Tcl_DStringFree(&ds);
return Tcl_DStringValue(bufPtr);
}
/*
* We didn't recognize the full value as an encoding name.
* If there is an encoding subfield, we can try to guess from that.
*/
for (p = encoding; *p != '\0'; p++) {
if (*p == '.') {
p++;
break;
}
}
if (*p != '\0') {
knownEncoding = SearchKnownEncodings(p);
if (knownEncoding != NULL) {
Tcl_DStringAppend(bufPtr, knownEncoding, -1);
} else if (NULL != Tcl_GetEncoding(NULL, p)) {
Tcl_DStringAppend(bufPtr, p, -1);
}
}
Tcl_DStringFree(&ds);
if (Tcl_DStringLength(bufPtr)) {
return Tcl_DStringValue(bufPtr);
}
}
return Tcl_DStringAppend(bufPtr, TCL_DEFAULT_ENCODING, -1);
}
/*
*---------------------------------------------------------------------------
|
| ︙ | ︙ | |||
730 731 732 733 734 735 736 |
#ifndef NO_UNAME
struct utsname name;
#endif
int unameOK;
CONST char *user;
Tcl_DString ds;
| | | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 |
#ifndef NO_UNAME
struct utsname name;
#endif
int unameOK;
CONST char *user;
Tcl_DString ds;
#ifdef HAVE_COREFOUNDATION
char tclLibPath[MAXPATHLEN + 1];
if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) {
CONST char *str;
Tcl_DString ds;
CFBundleRef bundleRef;
|
| ︙ | ︙ | |||
762 763 764 765 766 767 768 |
Tcl_DStringFree(&ds);
}
if ((bundleRef = CFBundleGetMainBundle())) {
CFURLRef frameworksURL;
Tcl_StatBuf statBuf;
if((frameworksURL = CFBundleCopyPrivateFrameworksURL(bundleRef))) {
if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE,
| | | | | 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 |
Tcl_DStringFree(&ds);
}
if ((bundleRef = CFBundleGetMainBundle())) {
CFURLRef frameworksURL;
Tcl_StatBuf statBuf;
if((frameworksURL = CFBundleCopyPrivateFrameworksURL(bundleRef))) {
if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE,
(unsigned char*) tclLibPath, MAXPATHLEN) &&
! TclOSstat(tclLibPath, &statBuf) &&
S_ISDIR(statBuf.st_mode)) {
Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath,
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
Tcl_SetVar(interp, "tcl_pkgPath", " ",
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
}
CFRelease(frameworksURL);
}
if((frameworksURL = CFBundleCopySharedFrameworksURL(bundleRef))) {
if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE,
(unsigned char*) tclLibPath, MAXPATHLEN) &&
! TclOSstat(tclLibPath, &statBuf) &&
S_ISDIR(statBuf.st_mode)) {
Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath,
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
Tcl_SetVar(interp, "tcl_pkgPath", " ",
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
}
CFRelease(frameworksURL);
}
}
Tcl_SetVar(interp, "tcl_pkgPath", pkgPath,
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
} else
#endif /* HAVE_COREFOUNDATION */
{
Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY);
}
#ifdef DJGPP
Tcl_SetVar2(interp, "tcl_platform", "platform", "dos", TCL_GLOBAL_ONLY);
#else
|
| ︙ | ︙ | |||
1137 1138 1139 1140 1141 1142 1143 | * * Side effects: * Same as for Tcl_MacOSXOpenVersionedBundleResources. * *---------------------------------------------------------------------- */ | | | | | 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 |
*
* Side effects:
* Same as for Tcl_MacOSXOpenVersionedBundleResources.
*
*----------------------------------------------------------------------
*/
#ifdef HAVE_COREFOUNDATION
static int
MacOSXGetLibraryPath(Tcl_Interp *interp, int maxPathLen, char *tclLibPath)
{
int foundInFramework = TCL_ERROR;
#ifdef TCL_FRAMEWORK
foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp,
"com.tcltk.tcllibrary", TCL_FRAMEWORK_VERSION, 0, maxPathLen, tclLibPath);
#endif
return foundInFramework;
}
#endif /* HAVE_COREFOUNDATION */
|
Changes to unix/tclUnixNotfy.c.
1 2 3 4 | /* * tclUnixNotify.c -- * * This file contains the implementation of the select-based | | | | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
/*
* tclUnixNotify.c --
*
* This file contains the implementation of the select-based
* Unix-specific notifier, which is the lowest-level part
* of the Tcl event loop. This file works together with
* generic/tclNotify.c.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclUnixNotfy.c,v 1.20.2.1 2005/06/13 01:47:16 msofer Exp $
*/
#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier
* is in tclMacOSXNotify.c */
#include "tclInt.h"
#include <signal.h>
extern TclStubs tclStubs;
extern Tcl_NotifierProcs tclOriginalNotifier;
/*
|
| ︙ | ︙ | |||
70 71 72 73 74 75 76 |
* select based implementation of the Tcl notifier. One of these structures
* is created for each thread that is using the notifier.
*/
typedef struct ThreadSpecificData {
FileHandler *firstFileHandlerPtr;
/* Pointer to head of file handler list. */
| | | | | | | | | | | | | 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 |
* select based implementation of the Tcl notifier. One of these structures
* is created for each thread that is using the notifier.
*/
typedef struct ThreadSpecificData {
FileHandler *firstFileHandlerPtr;
/* Pointer to head of file handler list. */
SelectMasks checkMasks; /* This structure is used to build up the masks
* to be used in the next call to select.
* Bits are set in response to calls to
* Tcl_CreateFileHandler. */
SelectMasks readyMasks; /* This array reflects the readable/writable
* conditions that were found to exist by the
* last call to select. */
int numFdBits; /* Number of valid bits in checkMasks
* (one more than highest fd for which
* Tcl_WatchFile has been called). */
#ifdef TCL_THREADS
int onList; /* True if it is in this list */
unsigned int pollState; /* pollState is used to implement a polling
* handshake between each thread and the
* notifier thread. Bits defined below. */
struct ThreadSpecificData *nextPtr, *prevPtr;
/* All threads that are currently waiting on
* an event have their ThreadSpecificData
* structure on a doubly-linked listed formed
* from these pointers. You must hold the
* notifierMutex lock before accessing these
* fields. */
Tcl_Condition waitCV; /* Any other thread alerts a notifier
* that an event is ready to be processed
* by signaling this condition variable. */
int eventReady; /* True if an event is ready to be processed.
* Used as condition flag together with
* waitCV above. */
#endif
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
#ifdef TCL_THREADS
/*
|
| ︙ | ︙ | |||
179 180 181 182 183 184 185 | #endif /* * Static routines defined in this file. */ #ifdef TCL_THREADS | | | < | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | #endif /* * Static routines defined in this file. */ #ifdef TCL_THREADS static void NotifierThreadProc(ClientData clientData); #endif static int FileHandlerEventProc(Tcl_Event *evPtr, int flags); /* *---------------------------------------------------------------------- * * Tcl_InitNotifier -- * * Initializes the platform specific notifier state. |
| ︙ | ︙ | |||
215 216 217 218 219 220 221 |
/*
* Start the Notifier thread if necessary.
*/
Tcl_MutexLock(¬ifierMutex);
if (notifierCount == 0) {
if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL,
| | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
/*
* Start the Notifier thread if necessary.
*/
Tcl_MutexLock(¬ifierMutex);
if (notifierCount == 0) {
if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL,
TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) {
Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread");
}
}
notifierCount++;
/*
* Wait for the notifier pipe to be created.
|
| ︙ | ︙ | |||
268 269 270 271 272 273 274 275 276 277 278 |
/*
* If this is the last thread to use the notifier, close the notifier
* pipe and wait for the background thread to terminate.
*/
if (notifierCount == 0) {
if (triggerPipe < 0) {
Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized");
}
| > | > > > > | 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 |
/*
* If this is the last thread to use the notifier, close the notifier
* pipe and wait for the background thread to terminate.
*/
if (notifierCount == 0) {
int result, ignored;
if (triggerPipe < 0) {
Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized");
}
/*
* Send "q" message to the notifier thread so that it will
* terminate. The notifier will return from its call to select()
* and notice that a "q" message has arrived, it will then close
* its side of the pipe and terminate its thread. Note the we can
* not just close the pipe and check for EOF in the notifier
* thread because if a background child process was created with
* exec, select() would not register the EOF on the pipe until the
* child processes had terminated. [Bug: 4139]
*/
write(triggerPipe, "q", 1);
close(triggerPipe);
Tcl_ConditionWait(¬ifierCV, ¬ifierMutex, NULL);
result = Tcl_JoinThread(notifierThread, &ignored);
if (result) {
Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread");
}
}
/*
* Clean up any synchronization objects in the thread local storage.
*/
Tcl_ConditionFinalize(&(tsdPtr->waitCV));
|
| ︙ | ︙ | |||
424 425 426 427 428 429 430 |
if (tclStubs.tcl_CreateFileHandler != tclOriginalNotifier.createFileHandlerProc) {
tclStubs.tcl_CreateFileHandler(fd, mask, proc, clientData);
return;
}
for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
| | | | | | | | | | | | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
if (tclStubs.tcl_CreateFileHandler != tclOriginalNotifier.createFileHandlerProc) {
tclStubs.tcl_CreateFileHandler(fd, mask, proc, clientData);
return;
}
for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
filePtr = filePtr->nextPtr) {
if (filePtr->fd == fd) {
break;
}
}
if (filePtr == NULL) {
filePtr = (FileHandler*) ckalloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->readyMask = 0;
filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
tsdPtr->firstFileHandlerPtr = filePtr;
}
filePtr->proc = proc;
filePtr->clientData = clientData;
filePtr->mask = mask;
/*
* Update the check masks for this file.
*/
if (mask & TCL_READABLE) {
FD_SET(fd, &(tsdPtr->checkMasks.readable));
} else {
FD_CLR(fd, &(tsdPtr->checkMasks.readable));
}
if (mask & TCL_WRITABLE) {
FD_SET(fd, &(tsdPtr->checkMasks.writable));
} else {
FD_CLR(fd, &(tsdPtr->checkMasks.writable));
}
if (mask & TCL_EXCEPTION) {
FD_SET(fd, &(tsdPtr->checkMasks.exceptional));
} else {
FD_CLR(fd, &(tsdPtr->checkMasks.exceptional));
}
if (tsdPtr->numFdBits <= fd) {
tsdPtr->numFdBits = fd+1;
}
}
/*
|
| ︙ | ︙ | |||
513 514 515 516 517 518 519 |
}
/*
* Update the check masks for this file.
*/
if (filePtr->mask & TCL_READABLE) {
| | | | | | | | 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 |
}
/*
* Update the check masks for this file.
*/
if (filePtr->mask & TCL_READABLE) {
FD_CLR(fd, &(tsdPtr->checkMasks.readable));
}
if (filePtr->mask & TCL_WRITABLE) {
FD_CLR(fd, &(tsdPtr->checkMasks.writable));
}
if (filePtr->mask & TCL_EXCEPTION) {
FD_CLR(fd, &(tsdPtr->checkMasks.exceptional));
}
/*
* Find current max fd.
*/
if (fd+1 == tsdPtr->numFdBits) {
tsdPtr->numFdBits = 0;
for (i = fd-1; i >= 0; i--) {
if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))
|| FD_ISSET(i, &(tsdPtr->checkMasks.writable))
|| FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))) {
tsdPtr->numFdBits = i+1;
break;
}
}
}
/*
|
| ︙ | ︙ | |||
596 597 598 599 600 601 602 |
* the event. We do this rather than keeping a pointer to the file
* handler directly in the event, so that the handler can be deleted
* while the event is queued without leaving a dangling pointer.
*/
tsdPtr = TCL_TSD_INIT(&dataKey);
for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
| | | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
* the event. We do this rather than keeping a pointer to the file
* handler directly in the event, so that the handler can be deleted
* while the event is queued without leaving a dangling pointer.
*/
tsdPtr = TCL_TSD_INIT(&dataKey);
for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
filePtr = filePtr->nextPtr) {
if (filePtr->fd != fileEvPtr->fd) {
continue;
}
/*
* The code is tricky for two reasons:
* 1. The file handler's desired events could have changed
|
| ︙ | ︙ | |||
673 674 675 676 677 678 679 |
/*
* Set up the timeout structure. Note that if there are no events to
* check for, we return with a negative result rather than blocking
* forever.
*/
| | | > | > | 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 |
/*
* Set up the timeout structure. Note that if there are no events to
* check for, we return with a negative result rather than blocking
* forever.
*/
if (timePtr != NULL) {
/* TIP #233 (Virtualized Time). Is virtual time in effect ?
* And do we actually have something to scale ? If yes to both
* then we call the handler to do this scaling */
myTime.sec = timePtr->sec;
myTime.usec = timePtr->usec;
if (myTime.sec != 0 || myTime.usec != 0) {
(*tclScaleTimeProcPtr) (&myTime, tclTimeClientData);
}
#ifdef TCL_THREADS
myTimePtr = &myTime;
#else
timeout.tv_sec = myTime.sec;
timeout.tv_usec = myTime.usec;
timeoutPtr = &timeout;
|
| ︙ | ︙ | |||
705 706 707 708 709 710 711 |
* don't handle that case if we aren't using threads.
*/
return -1;
#endif
} else {
#ifdef TCL_THREADS
| | | 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 |
* don't handle that case if we aren't using threads.
*/
return -1;
#endif
} else {
#ifdef TCL_THREADS
myTimePtr = NULL;
#else
timeoutPtr = NULL;
#endif
}
#ifdef TCL_THREADS
/*
|
| ︙ | ︙ | |||
737 738 739 740 741 742 743 |
tsdPtr->pollState = POLL_WANT;
myTimePtr = NULL;
} else {
tsdPtr->pollState = 0;
}
if (waitForFiles) {
| | | | | | < | | | | | | | | | | | | | | | | | | | | 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 797 798 799 800 801 |
tsdPtr->pollState = POLL_WANT;
myTimePtr = NULL;
} else {
tsdPtr->pollState = 0;
}
if (waitForFiles) {
/*
* Add the ThreadSpecificData structure of this thread to the list
* of ThreadSpecificData structures of all threads that are waiting
* on file events.
*/
tsdPtr->nextPtr = waitingListPtr;
if (waitingListPtr) {
waitingListPtr->prevPtr = tsdPtr;
}
tsdPtr->prevPtr = 0;
waitingListPtr = tsdPtr;
tsdPtr->onList = 1;
write(triggerPipe, "", 1);
}
FD_ZERO(&(tsdPtr->readyMasks.readable));
FD_ZERO(&(tsdPtr->readyMasks.writable));
FD_ZERO(&(tsdPtr->readyMasks.exceptional));
if (!tsdPtr->eventReady) {
Tcl_ConditionWait(&tsdPtr->waitCV, ¬ifierMutex, myTimePtr);
}
tsdPtr->eventReady = 0;
if (waitForFiles && tsdPtr->onList) {
/*
* Remove the ThreadSpecificData structure of this thread from the
* waiting list. Alert the notifier thread to recompute its select
* masks - skipping this caused a hang when trying to close a pipe
* which the notifier thread was still doing a select on.
*/
if (tsdPtr->prevPtr) {
tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr;
} else {
waitingListPtr = tsdPtr->nextPtr;
}
if (tsdPtr->nextPtr) {
tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
}
tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
tsdPtr->onList = 0;
write(triggerPipe, "", 1);
}
#else
tsdPtr->readyMasks = tsdPtr->checkMasks;
|
| ︙ | ︙ | |||
811 812 813 814 815 816 817 |
#endif
/*
* Queue all detected file events before returning.
*/
for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL);
| | | | | | < | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 |
#endif
/*
* Queue all detected file events before returning.
*/
for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL);
filePtr = filePtr->nextPtr) {
mask = 0;
if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.readable))) {
mask |= TCL_READABLE;
}
if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.writable))) {
mask |= TCL_WRITABLE;
}
if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.exceptional))) {
mask |= TCL_EXCEPTION;
}
if (!mask) {
continue;
}
/*
* Don't bother to queue an event if the mask was previously
* non-zero since an event must still be on the queue.
*/
if (filePtr->readyMask == 0) {
fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL);
}
filePtr->readyMask = mask;
}
#ifdef TCL_THREADS
|
| ︙ | ︙ | |||
933 934 935 936 937 938 939 |
Tcl_MutexUnlock(¬ifierMutex);
/*
* Look for file events and report them to interested threads.
*/
while (1) {
| < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 |
Tcl_MutexUnlock(¬ifierMutex);
/*
* Look for file events and report them to interested threads.
*/
while (1) {
FD_ZERO(&readableMask);
FD_ZERO(&writableMask);
FD_ZERO(&exceptionalMask);
/*
* Compute the logical OR of the select masks from all the
* waiting notifiers.
*/
Tcl_MutexLock(¬ifierMutex);
timePtr = NULL;
for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) {
for (i = tsdPtr->numFdBits-1; i >= 0; --i) {
if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))) {
FD_SET(i, &readableMask);
}
if (FD_ISSET(i, &(tsdPtr->checkMasks.writable))) {
FD_SET(i, &writableMask);
}
if (FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))) {
FD_SET(i, &exceptionalMask);
}
}
if (tsdPtr->numFdBits > numFdBits) {
numFdBits = tsdPtr->numFdBits;
}
if (tsdPtr->pollState & POLL_WANT) {
/*
* Here we make sure we go through select() with the same
* mask bits that were present when the thread tried to poll.
*/
tsdPtr->pollState |= POLL_DONE;
timePtr = &poll;
}
}
Tcl_MutexUnlock(¬ifierMutex);
/*
* Set up the select mask to include the receive pipe.
*/
if (receivePipe >= numFdBits) {
numFdBits = receivePipe + 1;
}
FD_SET(receivePipe, &readableMask);
if (select(numFdBits, &readableMask, &writableMask, &exceptionalMask,
timePtr) == -1) {
/*
* Try again immediately on an error.
*/
continue;
}
/*
* Alert any threads that are waiting on a ready file descriptor.
*/
Tcl_MutexLock(¬ifierMutex);
for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) {
found = 0;
for (i = tsdPtr->numFdBits-1; i >= 0; --i) {
if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))
&& FD_ISSET(i, &readableMask)) {
FD_SET(i, &(tsdPtr->readyMasks.readable));
found = 1;
}
if (FD_ISSET(i, &(tsdPtr->checkMasks.writable))
&& FD_ISSET(i, &writableMask)) {
FD_SET(i, &(tsdPtr->readyMasks.writable));
found = 1;
}
if (FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))
&& FD_ISSET(i, &exceptionalMask)) {
FD_SET(i, &(tsdPtr->readyMasks.exceptional));
found = 1;
}
}
if (found || (tsdPtr->pollState & POLL_DONE)) {
tsdPtr->eventReady = 1;
if (tsdPtr->onList) {
/*
* Remove the ThreadSpecificData structure of this
* thread from the waiting list. This prevents us from
* continuously spining on select until the other
* threads runs and services the file event.
*/
if (tsdPtr->prevPtr) {
tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr;
} else {
waitingListPtr = tsdPtr->nextPtr;
}
if (tsdPtr->nextPtr) {
tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
}
tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
tsdPtr->onList = 0;
tsdPtr->pollState = 0;
}
Tcl_ConditionNotify(&tsdPtr->waitCV);
}
}
Tcl_MutexUnlock(¬ifierMutex);
/*
* Consume the next byte from the notifier pipe if the pipe was
* readable. Note that there may be multiple bytes pending, but
* to avoid a race condition we only read one at a time.
*/
if (FD_ISSET(receivePipe, &readableMask)) {
i = read(receivePipe, buf, 1);
if ((i == 0) || ((i == 1) && (buf[0] == 'q'))) {
/*
* Someone closed the write end of the pipe or sent us a
* Quit message [Bug: 4139] and then closed the write end
* of the pipe so we need to shut down the notifier thread.
|
| ︙ | ︙ | |||
1078 1079 1080 1081 1082 1083 1084 |
triggerPipe = -1;
Tcl_ConditionNotify(¬ifierCV);
Tcl_MutexUnlock(¬ifierMutex);
TclpThreadExit (0);
}
#endif
| > > | 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
triggerPipe = -1;
Tcl_ConditionNotify(¬ifierCV);
Tcl_MutexUnlock(¬ifierMutex);
TclpThreadExit (0);
}
#endif
#endif /* HAVE_COREFOUNDATION */
|
Changes to unix/tclUnixPipe.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUnixPipe.c -- * * This file implements the UNIX-specific exec pipeline functions, * the "pipe" channel driver, and the "pid" Tcl command. * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclUnixPipe.c -- * * This file implements the UNIX-specific exec pipeline functions, * the "pipe" channel driver, and the "pid" Tcl command. * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixPipe.c,v 1.27.2.1 2005/06/13 01:47:16 msofer Exp $ */ #include "tclInt.h" #ifdef USE_VFORK #define fork vfork #endif |
| ︙ | ︙ |
Changes to unix/tclUnixPort.h.
| ︙ | ︙ | |||
15 16 17 18 19 20 21 | * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixPort.h,v 1.40.2.1 2005/06/13 01:47:16 msofer Exp $ */ #ifndef _TCLUNIXPORT #define _TCLUNIXPORT /* *--------------------------------------------------------------------------- |
| ︙ | ︙ | |||
559 560 561 562 563 564 565 | EXTERN struct tm * TclpLocaltime(CONST time_t *); EXTERN struct tm * TclpGmtime(CONST time_t *); EXTERN char * TclpInetNtoa(struct in_addr); /* #define localtime(x) TclpLocaltime(x) * #define gmtime(x) TclpGmtime(x) */ # undef inet_ntoa # define inet_ntoa(x) TclpInetNtoa(x) | < < < < < < < | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | EXTERN struct tm * TclpLocaltime(CONST time_t *); EXTERN struct tm * TclpGmtime(CONST time_t *); EXTERN char * TclpInetNtoa(struct in_addr); /* #define localtime(x) TclpLocaltime(x) * #define gmtime(x) TclpGmtime(x) */ # undef inet_ntoa # define inet_ntoa(x) TclpInetNtoa(x) # ifdef HAVE_PTHREAD_ATTR_GET_NP # define TclpPthreadGetAttrs pthread_attr_get_np # ifdef ATTRGETNP_NOT_DECLARED /* * Assume it is in pthread_np.h if it isn't in pthread.h. [Bug 1064882] * We might need to revisit this in the future. :^( */ |
| ︙ | ︙ |
Changes to unix/tclUnixSock.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclUnixSock.c -- * * This file contains Unix-specific socket related code. * * Copyright (c) 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclUnixSock.c -- * * This file contains Unix-specific socket related code. * * Copyright (c) 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixSock.c,v 1.10.2.1 2005/06/13 01:47:17 msofer Exp $ */ #include "tclInt.h" /* * There is no portable macro for the maximum length * of host names returned by gethostbyname(). We should only |
| ︙ | ︙ |
Changes to unix/tclUnixThrd.c.
| ︙ | ︙ | |||
929 930 931 932 933 934 935 |
pthread_mutex_destroy(&lockPtr->plock);
free(lockPtr);
}
void TclpFreeAllocCache(ptr)
void *ptr;
{
| | | > > | > | | > | < | 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
pthread_mutex_destroy(&lockPtr->plock);
free(lockPtr);
}
void TclpFreeAllocCache(ptr)
void *ptr;
{
if (ptr != NULL) {
/*
* Called by the pthread lib when a thread exits
*/
TclFreeAllocCache(ptr);
} else if (initialized) {
/*
* Called by us in TclFinalizeThreadAlloc() during
* the library finalization initiated from Tcl_Finalize()
*/
pthread_key_delete(key);
initialized = 0;
}
}
void *
TclpGetAllocCache(void)
|
| ︙ | ︙ |
Changes to unix/tclUnixTime.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclUnixTime.c -- * * Contains Unix specific versions of Tcl functions that * obtain time values from the operating system. * * Copyright (c) 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclUnixTime.c -- * * Contains Unix specific versions of Tcl functions that * obtain time values from the operating system. * * Copyright (c) 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixTime.c,v 1.23.2.1 2005/06/13 01:47:17 msofer Exp $ */ #include "tclInt.h" #include <locale.h> #define TM_YEAR_BASE 1900 #define IsLeapYear(x) ((x % 4 == 0) && (x % 100 != 0 || x % 400 == 0)) |
| ︙ | ︙ |
Changes to win/.cvsignore.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | *.i *.asm Makefile tcl.hpj tclConfig.sh nmakehlp.exe .#* | > > | 9 10 11 12 13 14 15 16 17 | *.i *.asm Makefile tcl.hpj tclConfig.sh nmakehlp.exe .#* tcl.sln tcl.suo |
Changes to win/Makefile.in.
1 2 3 4 5 6 7 | # # This file is a Makefile for Tcl. If it has the name "Makefile.in" # then it is a template for a Makefile; to generate the actual Makefile, # run "./configure", which is a configuration script generated by the # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # # This file is a Makefile for Tcl. If it has the name "Makefile.in" # then it is a template for a Makefile; to generate the actual Makefile, # run "./configure", which is a configuration script generated by the # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # # RCS: @(#) $Id: Makefile.in,v 1.88.2.1 2005/06/13 01:47:17 msofer Exp $ VERSION = @TCL_VERSION@ #---------------------------------------------------------------- # Things you can change to personalize the Makefile for your own # site (you can make these changes in either Makefile.in or # Makefile, but changes to Makefile will get lost if you re-run |
| ︙ | ︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | # Special compiler flags to use when building man2tcl on Windows. MAN2TCLFLAGS = @MAN2TCLFLAGS@ SRC_DIR = @srcdir@ ROOT_DIR = @srcdir@/.. GENERIC_DIR = @srcdir@/../generic WIN_DIR = @srcdir@ COMPAT_DIR = @srcdir@/../compat # Converts a POSIX path to a Windows native path. CYGPATH = @CYGPATH@ GENERIC_DIR_NATIVE = $(shell $(CYGPATH) '$(GENERIC_DIR)') WIN_DIR_NATIVE = $(shell $(CYGPATH) '$(WIN_DIR)') ROOT_DIR_NATIVE = $(shell $(CYGPATH) '$(ROOT_DIR)' | sed 's/\\*$$//' ) LIBRARY_DIR = $(shell echo '$(ROOT_DIR_NATIVE)/library' | sed 's/\\/\//g' ) DLLSUFFIX = @DLLSUFFIX@ LIBSUFFIX = @LIBSUFFIX@ | > > | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | # Special compiler flags to use when building man2tcl on Windows. MAN2TCLFLAGS = @MAN2TCLFLAGS@ SRC_DIR = @srcdir@ ROOT_DIR = @srcdir@/.. GENERIC_DIR = @srcdir@/../generic TOMMATH_DIR = @srcdir@/../libtommath WIN_DIR = @srcdir@ COMPAT_DIR = @srcdir@/../compat # Converts a POSIX path to a Windows native path. CYGPATH = @CYGPATH@ GENERIC_DIR_NATIVE = $(shell $(CYGPATH) '$(GENERIC_DIR)') TOMMATH_DIR_NATIVE = $(shell $(CYGPATH) '$(TOMMATH_DIR)') WIN_DIR_NATIVE = $(shell $(CYGPATH) '$(WIN_DIR)') ROOT_DIR_NATIVE = $(shell $(CYGPATH) '$(ROOT_DIR)' | sed 's/\\*$$//' ) LIBRARY_DIR = $(shell echo '$(ROOT_DIR_NATIVE)/library' | sed 's/\\/\//g' ) DLLSUFFIX = @DLLSUFFIX@ LIBSUFFIX = @LIBSUFFIX@ |
| ︙ | ︙ | |||
152 153 154 155 156 157 158 | @SET_MAKE@ # Setting the VPATH variable to a list of paths will cause the # makefile to look into these paths when resolving .c to .obj # dependencies. | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | @SET_MAKE@ # Setting the VPATH variable to a list of paths will cause the # makefile to look into these paths when resolving .c to .obj # dependencies. VPATH = $(GENERIC_DIR):$(TOMMATH_DIR):$(WIN_DIR):$(COMPAT_DIR) AR = @AR@ RANLIB = @RANLIB@ CC = @CC@ RC = @RC@ RES = @RES@ AC_FLAGS = @EXTRA_CFLAGS@ @DEFS@ |
| ︙ | ︙ | |||
182 183 184 185 186 187 188 |
RMDIR = rm -rf
MKDIR = mkdir -p
SHELL = @SHELL@
RM = rm -f
COPY = cp
CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} \
| > | > | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
RMDIR = rm -rf
MKDIR = mkdir -p
SHELL = @SHELL@
RM = rm -f
COPY = cp
CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} \
-I"${GENERIC_DIR_NATIVE}" -DTCL_TOMMATH -I"${TOMMATH_DIR_NATIVE}" \
-I"${WIN_DIR_NATIVE}" ${AC_FLAGS} \
${COMPILE_DEBUG_FLAGS}
CC_OBJNAME = @CC_OBJNAME@
CC_EXENAME = @CC_EXENAME@
STUB_CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I"${GENERIC_DIR_NATIVE}" -DTCL_TOMMATH -I"${TOMMATH_DIR_NATIVE}" \
-I"${WIN_DIR_NATIVE}" ${AC_FLAGS} \
${COMPILE_DEBUG_FLAGS}
TCLTEST_OBJS = \
tclTest.$(OBJEXT) \
tclTestObj.$(OBJEXT) \
tclTestProcBodyObj.$(OBJEXT) \
tclThreadTest.$(OBJEXT) \
|
| ︙ | ︙ | |||
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 | tclPreserve.$(OBJEXT) \ tclProc.$(OBJEXT) \ tclRegexp.$(OBJEXT) \ tclResolve.$(OBJEXT) \ tclResult.$(OBJEXT) \ tclScan.$(OBJEXT) \ tclStringObj.$(OBJEXT) \ tclStubInit.$(OBJEXT) \ tclStubLib.$(OBJEXT) \ tclThread.$(OBJEXT) \ tclThreadAlloc.$(OBJEXT) \ tclThreadJoin.$(OBJEXT) \ tclThreadStorage.$(OBJEXT) \ tclTimer.$(OBJEXT) \ tclTrace.$(OBJEXT) \ tclUtf.$(OBJEXT) \ tclUtil.$(OBJEXT) \ tclVar.$(OBJEXT) WIN_OBJS = \ tclWin32Dll.$(OBJEXT) \ tclWinChan.$(OBJEXT) \ tclWinConsole.$(OBJEXT) \ tclWinSerial.$(OBJEXT) \ tclWinError.$(OBJEXT) \ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
tclPreserve.$(OBJEXT) \
tclProc.$(OBJEXT) \
tclRegexp.$(OBJEXT) \
tclResolve.$(OBJEXT) \
tclResult.$(OBJEXT) \
tclScan.$(OBJEXT) \
tclStringObj.$(OBJEXT) \
tclStrToD.$(OBJEXT) \
tclStubInit.$(OBJEXT) \
tclStubLib.$(OBJEXT) \
tclThread.$(OBJEXT) \
tclThreadAlloc.$(OBJEXT) \
tclThreadJoin.$(OBJEXT) \
tclThreadStorage.$(OBJEXT) \
tclTimer.$(OBJEXT) \
tclTomMathInterface.$(OBJEXT) \
tclTrace.$(OBJEXT) \
tclUtf.$(OBJEXT) \
tclUtil.$(OBJEXT) \
tclVar.$(OBJEXT)
TOMMATH_OBJS = \
bncore.${OBJEXT} \
bn_reverse.${OBJEXT} \
bn_fast_s_mp_mul_digs.${OBJEXT} \
bn_fast_s_mp_sqr.${OBJEXT} \
bn_mp_add.${OBJEXT} \
bn_mp_add_d.${OBJEXT} \
bn_mp_clamp.${OBJEXT} \
bn_mp_clear.${OBJEXT} \
bn_mp_clear_multi.${OBJEXT} \
bn_mp_cmp.${OBJEXT} \
bn_mp_cmp_mag.${OBJEXT} \
bn_mp_copy.${OBJEXT} \
bn_mp_count_bits.${OBJEXT} \
bn_mp_div.${OBJEXT} \
bn_mp_div_d.${OBJEXT} \
bn_mp_div_2.${OBJEXT} \
bn_mp_div_2d.${OBJEXT} \
bn_mp_div_3.${OBJEXT} \
bn_mp_exch.${OBJEXT} \
bn_mp_grow.${OBJEXT} \
bn_mp_init.${OBJEXT} \
bn_mp_init_copy.${OBJEXT} \
bn_mp_init_multi.${OBJEXT} \
bn_mp_init_set.${OBJEXT} \
bn_mp_init_size.${OBJEXT} \
bn_mp_karatsuba_mul.${OBJEXT} \
bn_mp_karatsuba_sqr.$(OBJEXT) \
bn_mp_lshd.${OBJEXT} \
bn_mp_mod.${OBJEXT} \
bn_mp_mod_2d.${OBJEXT} \
bn_mp_mul.${OBJEXT} \
bn_mp_mul_2.${OBJEXT} \
bn_mp_mul_2d.${OBJEXT} \
bn_mp_mul_d.${OBJEXT} \
bn_mp_radix_size.${OBJEXT} \
bn_mp_radix_smap.${OBJEXT} \
bn_mp_read_radix.${OBJEXT} \
bn_mp_rshd.${OBJEXT} \
bn_mp_set.${OBJEXT} \
bn_mp_sqr.${OBJEXT} \
bn_mp_sub.${OBJEXT} \
bn_mp_sub_d.${OBJEXT} \
bn_mp_toom_mul.${OBJEXT} \
bn_mp_toom_sqr.${OBJEXT} \
bn_mp_toradix_n.${OBJEXT} \
bn_mp_zero.${OBJEXT} \
bn_s_mp_add.${OBJEXT} \
bn_s_mp_mul_digs.${OBJEXT} \
bn_s_mp_sqr.${OBJEXT} \
bn_s_mp_sub.${OBJEXT}
WIN_OBJS = \
tclWin32Dll.$(OBJEXT) \
tclWinChan.$(OBJEXT) \
tclWinConsole.$(OBJEXT) \
tclWinSerial.$(OBJEXT) \
tclWinError.$(OBJEXT) \
|
| ︙ | ︙ | |||
300 301 302 303 304 305 306 | REG_OBJS = tclWinReg.$(OBJEXT) STUB_OBJS = tclStubLib.$(OBJEXT) TCLSH_OBJS = tclAppInit.$(OBJEXT) | | | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
REG_OBJS = tclWinReg.$(OBJEXT)
STUB_OBJS = tclStubLib.$(OBJEXT)
TCLSH_OBJS = tclAppInit.$(OBJEXT)
TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${COMPAT_OBJS}
TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n]
all: binaries libraries doc
tcltest: $(TCLTEST)
|
| ︙ | ︙ | |||
466 467 468 469 470 471 472 473 474 475 476 477 478 479 | # so that make doesn't try to automatically regenerate the .c file. gendate: bison --output-file=$(GENERIC_DIR)/tclDate.c \ --name-prefix=TclDate \ --no-lines \ $(GENERIC_DIR)/tclGetDate.y install: all install-binaries install-libraries install-doc install-binaries: binaries @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \ do \ if [ ! -d $$i ] ; then \ | > > > > > > > > > | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | # so that make doesn't try to automatically regenerate the .c file. gendate: bison --output-file=$(GENERIC_DIR)/tclDate.c \ --name-prefix=TclDate \ --no-lines \ $(GENERIC_DIR)/tclGetDate.y # The following target generates the file generic/tommath.h. # It needs to be run (and the results checked) after updating # to a new release of libtommath. gentommath_h: $(TCL_EXE) "$(ROOT_DIR_NATIVE)\tools\fix_tommath_h.tcl" \ "$(TOMMATH_DIR_NATIVE)\tommath.h" \ > "$(GENERIC_DIR_NATIVE)\tommath.h" install: all install-binaries install-libraries install-doc install-binaries: binaries @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \ do \ if [ ! -d $$i ] ; then \ |
| ︙ | ︙ |
Changes to win/README.binary.
1 2 | Tcl/Tk 8.5 for Windows, Binary Distribution | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Tcl/Tk 8.5 for Windows, Binary Distribution RCS: @(#) $Id: README.binary,v 1.39.2.1 2005/06/13 01:47:17 msofer Exp $ 1. Introduction --------------- This directory contains the binary distribution of Tcl/Tk 8.5a4 for Windows. It was compiled with Microsoft Visual C++ 6.0 using Win32 API, so that it will run under Windows 98, NT, 2000 and XP. Tcl provides a powerful platform for creating integration applications that tie together diverse applications, protocols, devices, and frameworks. When paired with the Tk toolkit, Tcl provides the fastest and most powerful way to create GUI applications that run on PCs, Unix, |
| ︙ | ︙ |
Changes to win/configure.
1 2 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. | | < | > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
|
| ︙ | ︙ | |||
214 215 216 217 218 219 220 221 222 223 224 225 226 | as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. | > | | | 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 | as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" |
| ︙ | ︙ | |||
663 664 665 666 667 668 669 |
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
| | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
localstatedir libdir includedir oldincludedir infodir mandir
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
|
| ︙ | ︙ | |||
703 704 705 706 707 708 709 | # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ | | | | | | 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
srcdir=$ac_confdir
|
| ︙ | ︙ | |||
798 799 800 801 802 803 804 |
--srcdir=DIR find the sources in DIR [configure dir or \`..']
_ACEOF
cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
| | | | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
--srcdir=DIR find the sources in DIR [configure dir or \`..']
_ACEOF
cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
|
| ︙ | ︙ | |||
890 891 892 893 894 895 896 |
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
| | | > > > > > | > > > > > > > | > > > > > > | > > > > > > > > > > | > > > > > | < | | | 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 |
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
cd $ac_dir
# Check for guested configure; otherwise get Cygnus style configure.
if test -f $ac_srcdir/configure.gnu; then
echo
$SHELL $ac_srcdir/configure.gnu --help=recursive
elif test -f $ac_srcdir/configure; then
echo
$SHELL $ac_srcdir/configure --help=recursive
elif test -f $ac_srcdir/configure.ac ||
test -f $ac_srcdir/configure.in; then
echo
$ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
cd $ac_popdir
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit 0
fi
exec 5>config.log
cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
_ACEOF
{
cat <<_ASUNAME
## --------- ##
|
| ︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 |
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2)
ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
| | | | | | | | | | | | | | 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 |
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2)
ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
# Get rid of the leading space.
ac_sep=" "
;;
esac
done
|
| ︙ | ︙ | |||
1056 1057 1058 1059 1060 1061 1062 |
echo
# The following way of writing the cache mishandles newlines in values,
{
(set) 2>&1 |
case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
*ac_space=\ *)
sed -n \
| | | | | 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 |
echo
# The following way of writing the cache mishandles newlines in values,
{
(set) 2>&1 |
case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
*ac_space=\ *)
sed -n \
"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
;;
*)
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
}
echo
cat <<\_ASBOX
## ----------------- ##
|
| ︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 |
## Output files. ##
## ------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
eval ac_val=$`echo $ac_var`
| | | | 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 |
## Output files. ##
## ------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
eval ac_val=$`echo $ac_var`
echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
fi
if test -s confdefs.h; then
cat <<\_ASBOX
## ----------- ##
## confdefs.h. ##
## ----------- ##
_ASBOX
echo
sed "/^$/d" confdefs.h | sort
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core &&
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
|
| ︙ | ︙ | |||
1189 1190 1191 1192 1193 1194 1195 | >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | | | | | | | | 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 |
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in `(set) 2>&1 |
sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val="\$ac_cv_env_${ac_var}_value"
eval ac_new_val="\$ac_env_${ac_var}_value"
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
{ echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
{ echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
|
| ︙ | ︙ | |||
1270 1271 1272 1273 1274 1275 1276 | # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TCL_VERSION=8.5 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=5 | | | 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TCL_VERSION=8.5 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=5 TCL_PATCH_LEVEL="a4" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.3 TCL_DDE_MAJOR_VERSION=1 TCL_DDE_MINOR_VERSION=3 TCL_DDE_PATCH_LEVEL="" DDEVER=$TCL_DDE_MAJOR_VERSION$TCL_DDE_MINOR_VERSION |
| ︙ | ︙ | |||
1644 1645 1646 1647 1648 1649 1650 |
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
(eval $ac_compiler -V </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
| < | | | | | | | | | | | | | | | | 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 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 |
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
(eval $ac_compiler -V </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
(eval $ac_link_default) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
# Find the output, starting from the most likely. This scheme is
# not robust to junk in `.', hence go to wildcards (a.*) only as a last
# resort.
# Be careful to initialize this variable, since it used to be cached.
# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
ac_cv_exeext=
# b.out is created by i960 compilers.
for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
;;
conftest.$ac_ext )
# This is the source file.
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
# FIXME: I believe we export ac_cv_exeext for Libtool,
# but it would be cool to find out if it's true. Does anybody
# maintain Libtool? --akim.
export ac_cv_exeext
break;;
* )
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
|
| ︙ | ︙ | |||
1775 1776 1777 1778 1779 1780 1781 |
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
| | | | 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 |
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
export ac_cv_exeext
break;;
* ) break;;
esac
done
else
{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
|
| ︙ | ︙ | |||
1801 1802 1803 1804 1805 1806 1807 |
ac_exeext=$EXEEXT
echo "$as_me:$LINENO: checking for suffix of object files" >&5
echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 |
ac_exeext=$EXEEXT
echo "$as_me:$LINENO: checking for suffix of object files" >&5
echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
|
| ︙ | ︙ | |||
1852 1853 1854 1855 1856 1857 1858 |
ac_objext=$OBJEXT
echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | > > > > > > > > > > | | < | > > > > > > > > > > | | | 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 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 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 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 |
ac_objext=$OBJEXT
echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_compiler_gnu=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_prog_cc_g=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
|
| ︙ | ︙ | |||
1966 1967 1968 1969 1970 1971 1972 |
echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
if test "${ac_cv_prog_cc_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
| < | 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 |
echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
if test "${ac_cv_prog_cc_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
|
| ︙ | ︙ | |||
1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 |
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
| > > > > > > > > > > | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 |
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std1 is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std1. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
|
| ︙ | ︙ | |||
2020 2021 2022 2023 2024 2025 2026 |
# HP-UX older versions -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
| | > > > > > > > > > > | | | 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 |
# HP-UX older versions -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_stdc=$ac_arg
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext
done
rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
fi
case "x$ac_cv_prog_cc_stdc" in
|
| ︙ | ︙ | |||
2065 2066 2067 2068 2069 2070 2071 |
cat >conftest.$ac_ext <<_ACEOF
#ifndef __cplusplus
choke me
#endif
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
| | > > > > > > > > > > | | < < < > | > > > > > > > > > > | | < | > > > > > > > > > > | | | | 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 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 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 |
cat >conftest.$ac_ext <<_ACEOF
#ifndef __cplusplus
choke me
#endif
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
'' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
#include <stdlib.h>
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
continue
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
echo '#ifdef __cplusplus' >>confdefs.h
echo $ac_declaration >>confdefs.h
echo '#endif' >>confdefs.h
fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
| ︙ | ︙ | |||
2314 2315 2316 2317 2318 2319 2320 |
#--------------------------------------------------------------------
# Checks to see if the make progeam sets the $MAKE variable.
#--------------------------------------------------------------------
echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
| | | 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 |
#--------------------------------------------------------------------
# Checks to see if the make progeam sets the $MAKE variable.
#--------------------------------------------------------------------
echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\_ACEOF
all:
@echo 'ac_maketemp="$(MAKE)"'
_ACEOF
|
| ︙ | ︙ | |||
2354 2355 2356 2357 2358 2359 2360 |
echo "$as_me:$LINENO: checking for Cygwin version of gcc" >&5
echo $ECHO_N "checking for Cygwin version of gcc... $ECHO_C" >&6
if test "${ac_cv_cygwin+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | > > > > > > > > > > | | | 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 |
echo "$as_me:$LINENO: checking for Cygwin version of gcc" >&5
echo $ECHO_N "checking for Cygwin version of gcc... $ECHO_C" >&6
if test "${ac_cv_cygwin+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __CYGWIN__
#error cygwin
#endif
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_cygwin=no
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_cygwin=yes
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_cygwin" >&5
echo "${ECHO_T}$ac_cv_cygwin" >&6
if test "$ac_cv_cygwin" = "yes" ; then
{ { echo "$as_me:$LINENO: error: Compiling under Cygwin is not currently supported.
A maintainer for the Cygwin port of Tcl/Tk is needed. See the README
|
| ︙ | ︙ | |||
2417 2418 2419 2420 2421 2422 2423 |
if test "${tcl_cv_seh+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
tcl_cv_seh=no
else
cat >conftest.$ac_ext <<_ACEOF
| < | 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 |
if test "${tcl_cv_seh+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
tcl_cv_seh=no
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define WIN32_LEAN_AND_MEAN
|
| ︙ | ︙ | |||
2460 2461 2462 2463 2464 2465 2466 | echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) tcl_cv_seh=no fi | | | 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 |
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
tcl_cv_seh=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $tcl_cv_seh" >&5
echo "${ECHO_T}$tcl_cv_seh" >&6
if test "$tcl_cv_seh" = "no" ; then
|
| ︙ | ︙ | |||
2486 2487 2488 2489 2490 2491 2492 |
#
echo "$as_me:$LINENO: checking for EXCEPTION_DISPOSITION support in include files" >&5
echo $ECHO_N "checking for EXCEPTION_DISPOSITION support in include files... $ECHO_C" >&6
if test "${tcl_cv_eh_disposition+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 |
#
echo "$as_me:$LINENO: checking for EXCEPTION_DISPOSITION support in include files" >&5
echo $ECHO_N "checking for EXCEPTION_DISPOSITION support in include files... $ECHO_C" >&6
if test "${tcl_cv_eh_disposition+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define WIN32_LEAN_AND_MEAN
|
| ︙ | ︙ | |||
2509 2510 2511 2512 2513 2514 2515 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
| | > > > > > > > > > > | | | 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 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_eh_disposition=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_eh_disposition=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $tcl_cv_eh_disposition" >&5
echo "${ECHO_T}$tcl_cv_eh_disposition" >&6
if test "$tcl_cv_eh_disposition" = "no" ; then
cat >>confdefs.h <<\_ACEOF
|
| ︙ | ︙ | |||
2549 2550 2551 2552 2553 2554 2555 |
#
echo "$as_me:$LINENO: checking for LPFN_ACCEPT support in winsock2.h" >&5
echo $ECHO_N "checking for LPFN_ACCEPT support in winsock2.h... $ECHO_C" >&6
if test "${tcl_cv_lpfn_decls+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 |
#
echo "$as_me:$LINENO: checking for LPFN_ACCEPT support in winsock2.h" >&5
echo $ECHO_N "checking for LPFN_ACCEPT support in winsock2.h... $ECHO_C" >&6
if test "${tcl_cv_lpfn_decls+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define WIN32_LEAN_AND_MEAN
|
| ︙ | ︙ | |||
2573 2574 2575 2576 2577 2578 2579 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
| | > > > > > > > > > > | | | 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 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_lpfn_decls=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_lpfn_decls=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $tcl_cv_lpfn_decls" >&5
echo "${ECHO_T}$tcl_cv_lpfn_decls" >&6
if test "$tcl_cv_lpfn_decls" = "no" ; then
cat >>confdefs.h <<\_ACEOF
|
| ︙ | ︙ | |||
2613 2614 2615 2616 2617 2618 2619 |
echo "$as_me:$LINENO: checking for winnt.h that ignores VOID define" >&5
echo $ECHO_N "checking for winnt.h that ignores VOID define... $ECHO_C" >&6
if test "${tcl_cv_winnt_ignore_void+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 |
echo "$as_me:$LINENO: checking for winnt.h that ignores VOID define" >&5
echo $ECHO_N "checking for winnt.h that ignores VOID define... $ECHO_C" >&6
if test "${tcl_cv_winnt_ignore_void+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define VOID void
|
| ︙ | ︙ | |||
2639 2640 2641 2642 2643 2644 2645 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
| | > > > > > > > > > > | | | 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 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_winnt_ignore_void=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_winnt_ignore_void=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $tcl_cv_winnt_ignore_void" >&5
echo "${ECHO_T}$tcl_cv_winnt_ignore_void" >&6
if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
cat >>confdefs.h <<\_ACEOF
|
| ︙ | ︙ | |||
2685 2686 2687 2688 2689 2690 2691 |
echo "$as_me:$LINENO: checking for alloca declaration in malloc.h" >&5
echo $ECHO_N "checking for alloca declaration in malloc.h... $ECHO_C" >&6
if test "${tcl_cv_malloc_decl_alloca+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 |
echo "$as_me:$LINENO: checking for alloca declaration in malloc.h" >&5
echo $ECHO_N "checking for alloca declaration in malloc.h... $ECHO_C" >&6
if test "${tcl_cv_malloc_decl_alloca+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <malloc.h>
|
| ︙ | ︙ | |||
2709 2710 2711 2712 2713 2714 2715 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
| | > > > > > > > > > > | | | 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 2876 2877 2878 2879 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_malloc_decl_alloca=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_malloc_decl_alloca=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $tcl_cv_malloc_decl_alloca" >&5
echo "${ECHO_T}$tcl_cv_malloc_decl_alloca" >&6
if test "$tcl_cv_malloc_decl_alloca" = "no" &&
test "${GCC}" = "yes" ; then
|
| ︙ | ︙ | |||
2750 2751 2752 2753 2754 2755 2756 |
echo "$as_me:$LINENO: checking for cast to union support" >&5
echo $ECHO_N "checking for cast to union support... $ECHO_C" >&6
if test "${tcl_cv_cast_to_union+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | > > > > > > > > > > | | | 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 |
echo "$as_me:$LINENO: checking for cast to union support" >&5
echo $ECHO_N "checking for cast to union support... $ECHO_C" >&6
if test "${tcl_cv_cast_to_union+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
union foo { int i; double d; };
union foo f = (union foo) (int) 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_cast_to_union=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_cast_to_union=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $tcl_cv_cast_to_union" >&5
echo "${ECHO_T}$tcl_cv_cast_to_union" >&6
if test "$tcl_cv_cast_to_union" = "yes"; then
cat >>confdefs.h <<\_ACEOF
|
| ︙ | ︙ | |||
2811 2812 2813 2814 2815 2816 2817 |
echo "$as_me:$LINENO: checking for FINDEX_INFO_LEVELS in winbase.h" >&5
echo $ECHO_N "checking for FINDEX_INFO_LEVELS in winbase.h... $ECHO_C" >&6
if test "${tcl_cv_findex_enums+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 |
echo "$as_me:$LINENO: checking for FINDEX_INFO_LEVELS in winbase.h" >&5
echo $ECHO_N "checking for FINDEX_INFO_LEVELS in winbase.h... $ECHO_C" >&6
if test "${tcl_cv_findex_enums+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define WIN32_LEAN_AND_MEAN
|
| ︙ | ︙ | |||
2835 2836 2837 2838 2839 2840 2841 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
| | > > > > > > > > > > | | | 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_findex_enums=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_findex_enums=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $tcl_cv_findex_enums" >&5
echo "${ECHO_T}$tcl_cv_findex_enums" >&6
if test "$tcl_cv_findex_enums" = "no"; then
cat >>confdefs.h <<\_ACEOF
|
| ︙ | ︙ | |||
2874 2875 2876 2877 2878 2879 2880 |
echo "$as_me:$LINENO: checking for MWMO_ALERTABLE in winuser.h" >&5
echo $ECHO_N "checking for MWMO_ALERTABLE in winuser.h... $ECHO_C" >&6
if test "${tcl_cv_mwmo_alertable+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 |
echo "$as_me:$LINENO: checking for MWMO_ALERTABLE in winuser.h" >&5
echo $ECHO_N "checking for MWMO_ALERTABLE in winuser.h... $ECHO_C" >&6
if test "${tcl_cv_mwmo_alertable+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define WIN32_LEAN_AND_MEAN
|
| ︙ | ︙ | |||
2897 2898 2899 2900 2901 2902 2903 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
| | > > > > > > > > > > | | | 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 |
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
tcl_cv_mwmo_alertable=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
tcl_cv_mwmo_alertable=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $tcl_cv_mwmo_alertable" >&5
echo "${ECHO_T}$tcl_cv_mwmo_alertable" >&6
if test "$tcl_cv_mwmo_alertable" = "no"; then
cat >>confdefs.h <<\_ACEOF
|
| ︙ | ︙ | |||
3301 3302 3303 3304 3305 3306 3307 |
# This is a 2-stage check to make sure we have the 64-bit SDK
# We have to know where the SDK is installed.
if test "$do64bit" = "yes" ; then
if test "x${MSSDK}x" = "xx" ; then
MSSDK="C:/Progra~1/Microsoft SDK"
fi
| < < | > > > | | | | | | > | | | < | | < > > > | | 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 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 |
# This is a 2-stage check to make sure we have the 64-bit SDK
# We have to know where the SDK is installed.
if test "$do64bit" = "yes" ; then
if test "x${MSSDK}x" = "xx" ; then
MSSDK="C:/Progra~1/Microsoft SDK"
fi
MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
if test ! -d "${MSSDK}/bin/win64" ; then
{ echo "$as_me:$LINENO: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&5
echo "$as_me: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&2;}
do64bit="no"
fi
fi
if test "$do64bit" = "yes" ; then
# All this magic is necessary for the Win64 SDK RC1 - hobbs
# The space-based-path will work for the Makefile, but will
# not work if AC_TRY_COMPILE is called. TEA has the
# TEA_PATH_NOSPACE to avoid this issue.
CC="\"${MSSDK}/Bin/Win64/cl.exe\" \
-I\"${MSSDK}/Include/prerelease\" \
-I\"${MSSDK}/Include/Win64/crt\" \
-I\"${MSSDK}/Include/Win64/crt/sys\" \
-I\"${MSSDK}/Include\""
RC="\"${MSSDK}/bin/rc.exe\""
CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
# Do not use -O2 for Win64 - this has proved buggy in code gen.
CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
lflags="-MACHINE:IA64 -LIBPATH:\"${MSSDK}/Lib/IA64\" \
-LIBPATH:\"${MSSDK}/Lib/Prerelease/IA64\" -nologo"
LINKBIN="\"${MSSDK}/bin/win64/link.exe\""
else
RC="rc"
# -Od - no optimization
# -WX - warnings as errors
CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
# -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy)
CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
lflags="-nologo"
LINKBIN="link"
fi
LIBS="user32.lib advapi32.lib"
LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
# link -lib only works when -lib is the first arg
STLIB_LD="${LINKBIN} -lib ${lflags}"
RC_OUT=-fo
RC_TYPE=-r
RC_INCLUDE=-i
RC_DEFINE=-d
RES=res
MAKE_LIB="\${STLIB_LD} -out:\$@"
POST_MAKE_LIB=
MAKE_EXE="\${CC} -Fe\$@"
LIBPREFIX=""
EXTRA_CFLAGS=""
CFLAGS_WARNING="-W3"
LDFLAGS_DEBUG="-debug:full"
LDFLAGS_OPTIMIZE="-release"
# Specify the CC output file names based on the target name
CC_OBJNAME="-Fo\$@"
CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\$@')\""
# Specify linker flags depending on the type of app being
|
| ︙ | ︙ | |||
3485 3486 3487 3488 3489 3490 3491 | # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF | < | > < > | 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 3728 |
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
|
| ︙ | ︙ | |||
3592 3593 3594 3595 3596 3597 3598 | # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF | < | > < > | 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 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 |
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
|
| ︙ | ︙ | |||
3713 3714 3715 3716 3717 3718 3719 |
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
| < | > > > > > > > > > > | | < | 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 3908 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 |
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_stdc=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <string.h>
|
| ︙ | ︙ | |||
3778 3779 3780 3781 3782 3783 3784 | rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF | < | 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 | rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <stdlib.h> |
| ︙ | ︙ | |||
3803 3804 3805 3806 3807 3808 3809 | if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF | < | | | | | 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 |
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then
:
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ctype.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
|
| ︙ | ︙ | |||
3853 3854 3855 3856 3857 3858 3859 | echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi | | | 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 |
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then
|
| ︙ | ︙ | |||
3878 3879 3880 3881 3882 3883 3884 | for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ | | < | > > > > > > > > > > | | | 4053 4054 4055 4056 4057 4058 4059 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 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 |
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=no"
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
|
| ︙ | ︙ | |||
3943 3944 3945 3946 3947 3948 3949 |
echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
echo "${ECHO_T}$ac_cv_header_errno_h" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking errno.h usability" >&5
echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
| < | > > > > > > > > > > | | < > | | | | < < < < < < < < > | > > | | > > > > | | | | 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 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 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 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 |
echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
echo "${ECHO_T}$ac_cv_header_errno_h" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking errno.h usability" >&5
echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <errno.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking errno.h presence" >&5
echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <errno.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: errno.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: errno.h: see the Autoconf documentation" >&5
echo "$as_me: WARNING: errno.h: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: errno.h: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: errno.h: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------------------ ##
## Report this to the AC_PACKAGE_NAME lists. ##
## ------------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for errno.h" >&5
echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
|
| ︙ | ︙ | |||
4262 4263 4264 4265 4266 4267 4268 |
{
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
| | | | | 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 |
{
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
} |
sed '
t clear
: clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
|
| ︙ | ︙ | |||
4298 4299 4300 4301 4302 4303 4304 |
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
| | | | | | | | 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 |
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/;
s/:*\${srcdir}:*/:/;
s/:*@srcdir@:*/:/;
s/^\([^=]*=[ ]*\):*/\1/;
s/:*$//;
s/^[^=]*=[ ]*$//;
}'
fi
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
# take arguments), then we branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
cat >confdef2opt.sed <<\_ACEOF
t clear
: clear
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
t quote
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
t quote
d
: quote
s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
s,\[,\\&,g
s,\],\\&,g
s,\$,$$,g
p
_ACEOF
# We use echo to avoid assuming a particular line-breaking character.
# The extra dot is to prevent the shell from consuming trailing
|
| ︙ | ︙ | |||
4346 4347 4348 4349 4350 4351 4352 | ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | | | | 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 | ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs |
| ︙ | ︙ | |||
4390 4391 4392 4393 4394 4395 4396 4397 4398 |
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
# Support unset when possible.
| > | | | 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 |
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
|
| ︙ | ︙ | |||
4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 | as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. | > | | | 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 | as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" |
| ︙ | ︙ | |||
4626 4627 4628 4629 4630 4631 4632 | sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was | | | 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 | sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ |
| ︙ | ︙ | |||
4670 4671 4672 4673 4674 4675 4676 |
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
| | | < | | 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 |
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
Configuration files:
$config_files
Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
config.status
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If no file are specified by the user, then we need to provide default
|
| ︙ | ︙ | |||
4988 4989 4990 4991 4992 4993 4994 |
# The purpose of the label and of the branching condition is to
# speed up the sed processing (if there are no `@' at all, there
# is no need to browse any of the substitutions).
# These are the two extra sed commands mentioned above.
(echo ':t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
if test -z "$ac_sed_cmds"; then
| | | | | | | | | | | | | | | | 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 |
# The purpose of the label and of the branching condition is to
# speed up the sed processing (if there are no `@' at all, there
# is no need to browse any of the substitutions).
# These are the two extra sed commands mentioned above.
(echo ':t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
else
ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
fi
ac_sed_frag=`expr $ac_sed_frag + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_lines`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
fi # test -n "$CONFIG_FILES"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
# Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
|
| ︙ | ︙ | |||
5079 5080 5081 5082 5083 5084 5085 |
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
| | | > > > > > | > > > > > > > | > > > > > > | > > > > > > > > > > | > > > > > | | | | | | | | | | | | | | | 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 |
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
if test x"$ac_file" != x-; then
{ echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file"
fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
if test x"$ac_file" = x-; then
configure_input=
else
configure_input="$ac_file. "
fi
configure_input=$configure_input"Generated from `echo $ac_file_in |
sed 's,.*/,,'` by configure."
# First look for the input files in the build tree, otherwise in the
# src tree.
ac_file_inputs=`IFS=:
for f in $ac_file_in; do
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo "$f";;
*) # Relative
if test -f "$f"; then
# Build tree
echo "$f"
elif test -f "$srcdir/$f"; then
# Source tree
echo "$srcdir/$f"
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
esac
done` || { (exit 1); exit 1; }
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
_ACEOF
|
| ︙ | ︙ |
Changes to win/configure.in.
1 2 3 4 5 | #! /bin/bash -norc # This file is an input file used by the GNU "autoconf" program to # generate the file "configure", which is run during Tcl installation # to configure the system for the local environment. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #! /bin/bash -norc # This file is an input file used by the GNU "autoconf" program to # generate the file "configure", which is run during Tcl installation # to configure the system for the local environment. # # RCS: @(#) $Id: configure.in,v 1.82.2.4 2005/10/08 23:15:59 msofer Exp $ AC_INIT(../generic/tcl.h) AC_PREREQ(2.57) # The following define is needed when building with Cygwin since newer # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TCL_VERSION=8.5 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=5 TCL_PATCH_LEVEL="a4" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.3 TCL_DDE_MAJOR_VERSION=1 TCL_DDE_MINOR_VERSION=3 TCL_DDE_PATCH_LEVEL="" DDEVER=$TCL_DDE_MAJOR_VERSION$TCL_DDE_MINOR_VERSION |
| ︙ | ︙ | |||
360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
AC_SUBST(MAN2TCLFLAGS)
#------------------------------------------------------------------------
# tclConfig.sh refers to this by a different name
#------------------------------------------------------------------------
TCL_SHARED_BUILD=${SHARED_BUILD}
#--------------------------------------------------------------------
# Perform final evaluations of variables with possible substitutions.
#--------------------------------------------------------------------
TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
| > > > > > > > > > | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
AC_SUBST(MAN2TCLFLAGS)
#------------------------------------------------------------------------
# tclConfig.sh refers to this by a different name
#------------------------------------------------------------------------
TCL_SHARED_BUILD=${SHARED_BUILD}
#--------------------------------------------------------------------
# Define the size of pointers and of the different integer types
#--------------------------------------------------------------------
AC_CHECK_SIZEOF( short )
AC_CHECK_SIZEOF( int )
AC_CHECK_SIZEOF( long )
AC_CHECK_SIZEOF( void * )
#--------------------------------------------------------------------
# Perform final evaluations of variables with possible substitutions.
#--------------------------------------------------------------------
TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
|
| ︙ | ︙ |
Changes to win/makefile.vc.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # Copyright (c) 2001-2005 ActiveState Corporation. # Copyright (c) 2001-2004 David Gravereaux. # #------------------------------------------------------------------------------ | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # Copyright (c) 2001-2005 ActiveState Corporation. # Copyright (c) 2001-2004 David Gravereaux. # #------------------------------------------------------------------------------ # RCS: @(#) $Id: makefile.vc,v 1.136.2.1 2005/06/13 01:47:19 msofer Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) # or with the MS Platform SDK (MSSDK) !if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK) MSG = ^ You need to run vcvars32.bat from Developer Studio or setenv.bat from the^ |
| ︙ | ︙ | |||
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 | $(TMP_DIR)\tclPreserve.obj \ $(TMP_DIR)\tclProc.obj \ $(TMP_DIR)\tclRegexp.obj \ $(TMP_DIR)\tclResolve.obj \ $(TMP_DIR)\tclResult.obj \ $(TMP_DIR)\tclScan.obj \ $(TMP_DIR)\tclStringObj.obj \ $(TMP_DIR)\tclStubInit.obj \ $(TMP_DIR)\tclStubLib.obj \ $(TMP_DIR)\tclThread.obj \ $(TMP_DIR)\tclThreadAlloc.obj \ $(TMP_DIR)\tclThreadJoin.obj \ $(TMP_DIR)\tclThreadStorage.obj \ $(TMP_DIR)\tclTimer.obj \ $(TMP_DIR)\tclTrace.obj \ $(TMP_DIR)\tclUtf.obj \ $(TMP_DIR)\tclUtil.obj \ $(TMP_DIR)\tclVar.obj \ $(TMP_DIR)\tclWin32Dll.obj \ $(TMP_DIR)\tclWinChan.obj \ $(TMP_DIR)\tclWinConsole.obj \ $(TMP_DIR)\tclWinSerial.obj \ $(TMP_DIR)\tclWinError.obj \ $(TMP_DIR)\tclWinFCmd.obj \ $(TMP_DIR)\tclWinFile.obj \ $(TMP_DIR)\tclWinInit.obj \ $(TMP_DIR)\tclWinLoad.obj \ $(TMP_DIR)\tclWinNotify.obj \ $(TMP_DIR)\tclWinPipe.obj \ $(TMP_DIR)\tclWinSock.obj \ $(TMP_DIR)\tclWinThrd.obj \ $(TMP_DIR)\tclWinTime.obj \ !if !$(STATIC_BUILD) $(TMP_DIR)\tcl.res !endif TCLSTUBOBJS = $(TMP_DIR)\tclStubLib.obj ### The following paths CANNOT have spaces in them. COMPATDIR = $(ROOT)\compat DOCDIR = $(ROOT)\doc GENERICDIR = $(ROOT)\generic TOOLSDIR = $(ROOT)\tools WINDIR = $(ROOT)\win #--------------------------------------------------------------------- # Compile flags #--------------------------------------------------------------------- | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | $(TMP_DIR)\tclPreserve.obj \ $(TMP_DIR)\tclProc.obj \ $(TMP_DIR)\tclRegexp.obj \ $(TMP_DIR)\tclResolve.obj \ $(TMP_DIR)\tclResult.obj \ $(TMP_DIR)\tclScan.obj \ $(TMP_DIR)\tclStringObj.obj \ $(TMP_DIR)\tclStrToD.obj \ $(TMP_DIR)\tclStubInit.obj \ $(TMP_DIR)\tclStubLib.obj \ $(TMP_DIR)\tclThread.obj \ $(TMP_DIR)\tclThreadAlloc.obj \ $(TMP_DIR)\tclThreadJoin.obj \ $(TMP_DIR)\tclThreadStorage.obj \ $(TMP_DIR)\tclTimer.obj \ $(TMP_DIR)\tclTomMathInterface.obj \ $(TMP_DIR)\tclTrace.obj \ $(TMP_DIR)\tclUtf.obj \ $(TMP_DIR)\tclUtil.obj \ $(TMP_DIR)\tclVar.obj \ $(TMP_DIR)\tclWin32Dll.obj \ $(TMP_DIR)\tclWinChan.obj \ $(TMP_DIR)\tclWinConsole.obj \ $(TMP_DIR)\tclWinSerial.obj \ $(TMP_DIR)\tclWinError.obj \ $(TMP_DIR)\tclWinFCmd.obj \ $(TMP_DIR)\tclWinFile.obj \ $(TMP_DIR)\tclWinInit.obj \ $(TMP_DIR)\tclWinLoad.obj \ $(TMP_DIR)\tclWinNotify.obj \ $(TMP_DIR)\tclWinPipe.obj \ $(TMP_DIR)\tclWinSock.obj \ $(TMP_DIR)\tclWinThrd.obj \ $(TMP_DIR)\tclWinTime.obj \ $(TMP_DIR)\bncore.obj \ $(TMP_DIR)\bn_reverse.obj \ $(TMP_DIR)\bn_fast_s_mp_mul_digs.obj \ $(TMP_DIR)\bn_fast_s_mp_sqr.obj \ $(TMP_DIR)\bn_mp_add.obj \ $(TMP_DIR)\bn_mp_add_d.obj \ $(TMP_DIR)\bn_mp_clamp.obj \ $(TMP_DIR)\bn_mp_clear.obj \ $(TMP_DIR)\bn_mp_clear_multi.obj \ $(TMP_DIR)\bn_mp_cmp.obj \ $(TMP_DIR)\bn_mp_cmp_mag.obj \ $(TMP_DIR)\bn_mp_copy.obj \ $(TMP_DIR)\bn_mp_count_bits.obj \ $(TMP_DIR)\bn_mp_div.obj \ $(TMP_DIR)\bn_mp_div_d.obj \ $(TMP_DIR)\bn_mp_div_2.obj \ $(TMP_DIR)\bn_mp_div_2d.obj \ $(TMP_DIR)\bn_mp_div_3.obj \ $(TMP_DIR)\bn_mp_exch.obj \ $(TMP_DIR)\bn_mp_grow.obj \ $(TMP_DIR)\bn_mp_init.obj \ $(TMP_DIR)\bn_mp_init_copy.obj \ $(TMP_DIR)\bn_mp_init_multi.obj \ $(TMP_DIR)\bn_mp_init_set.obj \ $(TMP_DIR)\bn_mp_init_size.obj \ $(TMP_DIR)\bn_mp_karatsuba_mul.obj \ $(TMP_DIR)\bn_mp_karatsuba_sqr.obj \ $(TMP_DIR)\bn_mp_lshd.obj \ $(TMP_DIR)\bn_mp_mod.obj \ $(TMP_DIR)\bn_mp_mod_2d.obj \ $(TMP_DIR)\bn_mp_mul.obj \ $(TMP_DIR)\bn_mp_mul_2.obj \ $(TMP_DIR)\bn_mp_mul_2d.obj \ $(TMP_DIR)\bn_mp_mul_d.obj \ $(TMP_DIR)\bn_mp_radix_size.obj \ $(TMP_DIR)\bn_mp_radix_smap.obj \ $(TMP_DIR)\bn_mp_read_radix.obj \ $(TMP_DIR)\bn_mp_rshd.obj \ $(TMP_DIR)\bn_mp_set.obj \ $(TMP_DIR)\bn_mp_sqr.obj \ $(TMP_DIR)\bn_mp_sub.obj \ $(TMP_DIR)\bn_mp_sub_d.obj \ $(TMP_DIR)\bn_mp_toom_mul.obj \ $(TMP_DIR)\bn_mp_toom_sqr.obj \ $(TMP_DIR)\bn_mp_toradix_n.obj \ $(TMP_DIR)\bn_mp_zero.obj \ $(TMP_DIR)\bn_s_mp_add.obj \ $(TMP_DIR)\bn_s_mp_mul_digs.obj \ $(TMP_DIR)\bn_s_mp_sqr.obj \ $(TMP_DIR)\bn_s_mp_sub.obj \ !if !$(STATIC_BUILD) $(TMP_DIR)\tcl.res !endif TCLSTUBOBJS = $(TMP_DIR)\tclStubLib.obj ### The following paths CANNOT have spaces in them. COMPATDIR = $(ROOT)\compat DOCDIR = $(ROOT)\doc GENERICDIR = $(ROOT)\generic TOMMATHDIR = $(ROOT)\libtommath TOOLSDIR = $(ROOT)\tools WINDIR = $(ROOT)\win #--------------------------------------------------------------------- # Compile flags #--------------------------------------------------------------------- |
| ︙ | ︙ | |||
392 393 394 395 396 397 398 | !if $(DEBUG) && !$(UNCHECKED) crt = -MTd !else crt = -MT !endif !endif | | | | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | !if $(DEBUG) && !$(UNCHECKED) crt = -MTd !else crt = -MT !endif !endif TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(TCL_INCLUDES) \ -DTCL_PIPE_DLL=\"$(TCLPIPEDLLNAME)\" -DTCL_TOMMATH CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE TCL_CFLAGS = $(BASE_CFLAGS) $(OPTDEFINES) STUB_CFLAGS = $(cflags) $(cdebug) $(OPTDEFINES) #--------------------------------------------------------------------- # Link flags |
| ︙ | ︙ | |||
835 836 837 838 839 840 841 842 843 844 845 846 847 848 |
# Implicit rules
#---------------------------------------------------------------------
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<
{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<
{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
| > > > > > | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
# Implicit rules
#---------------------------------------------------------------------
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<
{$(TOMMATHDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<
{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<
{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
|
| ︙ | ︙ |
Changes to win/rules.vc.
1 2 3 4 5 6 7 8 9 10 11 12 | #------------------------------------------------------------------------------ # rules.vc -- # # Microsoft Visual C++ makefile include for decoding the commandline # macros. This file does not need editing to build Tcl. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 2001-2003 David Gravereaux. # #------------------------------------------------------------------------------ | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #------------------------------------------------------------------------------ # rules.vc -- # # Microsoft Visual C++ makefile include for decoding the commandline # macros. This file does not need editing to build Tcl. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 2001-2003 David Gravereaux. # #------------------------------------------------------------------------------ # RCS: @(#) $Id: rules.vc,v 1.19.4.1 2005/06/13 01:47:19 msofer Exp $ #------------------------------------------------------------------------------ !ifndef _RULES_VC _RULES_VC = 1 cc32 = $(CC) # built-in default. link32 = link |
| ︙ | ︙ |
Changes to win/tcl.m4.
| ︙ | ︙ | |||
573 574 575 576 577 578 579 |
# This is a 2-stage check to make sure we have the 64-bit SDK
# We have to know where the SDK is installed.
if test "$do64bit" = "yes" ; then
if test "x${MSSDK}x" = "xx" ; then
MSSDK="C:/Progra~1/Microsoft SDK"
fi
| < < | > > > | | | | | | > | | | < | | < > > > | | 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 |
# This is a 2-stage check to make sure we have the 64-bit SDK
# We have to know where the SDK is installed.
if test "$do64bit" = "yes" ; then
if test "x${MSSDK}x" = "xx" ; then
MSSDK="C:/Progra~1/Microsoft SDK"
fi
MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
if test ! -d "${MSSDK}/bin/win64" ; then
AC_MSG_WARN("could not find 64-bit SDK to enable 64bit mode")
do64bit="no"
fi
fi
if test "$do64bit" = "yes" ; then
# All this magic is necessary for the Win64 SDK RC1 - hobbs
# The space-based-path will work for the Makefile, but will
# not work if AC_TRY_COMPILE is called. TEA has the
# TEA_PATH_NOSPACE to avoid this issue.
CC="\"${MSSDK}/Bin/Win64/cl.exe\" \
-I\"${MSSDK}/Include/prerelease\" \
-I\"${MSSDK}/Include/Win64/crt\" \
-I\"${MSSDK}/Include/Win64/crt/sys\" \
-I\"${MSSDK}/Include\""
RC="\"${MSSDK}/bin/rc.exe\""
CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
# Do not use -O2 for Win64 - this has proved buggy in code gen.
CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
lflags="-MACHINE:IA64 -LIBPATH:\"${MSSDK}/Lib/IA64\" \
-LIBPATH:\"${MSSDK}/Lib/Prerelease/IA64\" -nologo"
LINKBIN="\"${MSSDK}/bin/win64/link.exe\""
else
RC="rc"
# -Od - no optimization
# -WX - warnings as errors
CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
# -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy)
CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
lflags="-nologo"
LINKBIN="link"
fi
LIBS="user32.lib advapi32.lib"
LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
# link -lib only works when -lib is the first arg
STLIB_LD="${LINKBIN} -lib ${lflags}"
RC_OUT=-fo
RC_TYPE=-r
RC_INCLUDE=-i
RC_DEFINE=-d
RES=res
MAKE_LIB="\${STLIB_LD} -out:\[$]@"
POST_MAKE_LIB=
MAKE_EXE="\${CC} -Fe\[$]@"
LIBPREFIX=""
EXTRA_CFLAGS=""
CFLAGS_WARNING="-W3"
LDFLAGS_DEBUG="-debug:full"
LDFLAGS_OPTIMIZE="-release"
# Specify the CC output file names based on the target name
CC_OBJNAME="-Fo\[$]@"
CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\[$]@')\""
# Specify linker flags depending on the type of app being
|
| ︙ | ︙ |
Changes to win/tclWin32Dll.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclWin32Dll.c -- * * This file contains the DLL entry point. * * Copyright (c) 1995-1996 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclWin32Dll.c -- * * This file contains the DLL entry point. * * Copyright (c) 1995-1996 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWin32Dll.c,v 1.40.4.1 2005/06/13 01:47:19 msofer Exp $ */ #include "tclWinInt.h" /* * The following data structures are used when loading the thunking * library for execing child processes under Win32s. |
| ︙ | ︙ | |||
33 34 35 36 37 38 39 | * on a per-instance basis. Each time this DLL is loaded, it gets its own * new data segment with its own copy of all static and global information. */ static HINSTANCE hInstance; /* HINSTANCE of this DLL. */ static int platformId; /* Running under NT, or 95/98? */ | < < < < < < < < < < < < > | > | < | < > > | < | < < < | | | | < | < < < < < | < | 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 |
* on a per-instance basis. Each time this DLL is loaded, it gets its own
* new data segment with its own copy of all static and global information.
*/
static HINSTANCE hInstance; /* HINSTANCE of this DLL. */
static int platformId; /* Running under NT, or 95/98? */
#ifdef HAVE_NO_SEH
/*
* Unlike Borland and Microsoft, we don't register exception handlers
* by pushing registration records onto the runtime stack. Instead, we
* register them by creating an EXCEPTION_REGISTRATION within the activation
* record.
*/
typedef struct EXCEPTION_REGISTRATION {
struct EXCEPTION_REGISTRATION* link;
EXCEPTION_DISPOSITION (*handler)( struct _EXCEPTION_RECORD*, void*,
struct _CONTEXT*, void* );
void* ebp;
void* esp;
int status;
} EXCEPTION_REGISTRATION;
#endif
/*
* VC++ 5.x has no 'cpuid' assembler instruction, so we
* must emulate it
*/
#if defined(_MSC_VER) && ( _MSC_VER <= 1100 )
#define cpuid __asm __emit 0fh __asm __emit 0a2h
|
| ︙ | ︙ | |||
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
*/
BOOL APIENTRY
DllMain(hInst, reason, reserved)
HINSTANCE hInst; /* Library instance handle. */
DWORD reason; /* Reason this function is being called. */
LPVOID reserved; /* Not used. */
{
switch (reason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInst);
TclWinInit(hInst);
return TRUE;
case DLL_PROCESS_DETACH:
/*
* Protect the call to Tcl_Finalize. The OS could be unloading
* us from an exception handler and the state of the stack might
* be unstable.
*/
#ifdef HAVE_NO_SEH
| > > > > < | < < < < < < < < > > > > | | > | > | > > | > | > > | < | | < < < > | | > | | > | | | | > | > > > > | > > > | > > > > | < > | | | > | < < | < > > > > > > > | | < < < < | > > | > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 |
*/
BOOL APIENTRY
DllMain(hInst, reason, reserved)
HINSTANCE hInst; /* Library instance handle. */
DWORD reason; /* Reason this function is being called. */
LPVOID reserved; /* Not used. */
{
#ifdef HAVE_NO_SEH
EXCEPTION_REGISTRATION registration;
#endif
switch (reason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInst);
TclWinInit(hInst);
return TRUE;
case DLL_PROCESS_DETACH:
/*
* Protect the call to Tcl_Finalize. The OS could be unloading
* us from an exception handler and the state of the stack might
* be unstable.
*/
#ifdef HAVE_NO_SEH
__asm__ __volatile__ (
/*
* Construct an EXCEPTION_REGISTRATION to protect the
* call to Tcl_Finalize
*/
"leal %[registration], %%edx" "\n\t"
"movl %%fs:0, %%eax" "\n\t"
"movl %%eax, 0x0(%%edx)" "\n\t" /* link */
"leal 1f, %%eax" "\n\t"
"movl %%eax, 0x4(%%edx)" "\n\t" /* handler */
"movl %%ebp, 0x8(%%edx)" "\n\t" /* ebp */
"movl %%esp, 0xc(%%edx)" "\n\t" /* esp */
"movl %[error], 0x10(%%edx)" "\n\t" /* status */
/*
* Link the EXCEPTION_REGISTRATION on the chain
*/
"movl %%edx, %%fs:0" "\n\t"
/*
* Call Tcl_Finalize
*/
"call _Tcl_Finalize" "\n\t"
/*
* Come here on a normal exit. Recover the EXCEPTION_REGISTRATION
* and store a TCL_OK status
*/
"movl %%fs:0, %%edx" "\n\t"
"movl %[ok], %%eax" "\n\t"
"movl %%eax, 0x10(%%edx)" "\n\t"
"jmp 2f" "\n"
/*
* Come here on an exception. Get the EXCEPTION_REGISTRATION
* that we previously put on the chain.
*/
"1:" "\t"
"movl %%fs:0, %%edx" "\n\t"
"movl 0x8(%%edx), %%edx" "\n"
/*
* Come here however we exited. Restore context from the
* EXCEPTION_REGISTRATION in case the stack is unbalanced.
*/
"2:" "\t"
"movl 0xc(%%edx), %%esp" "\n\t"
"movl 0x8(%%edx), %%ebp" "\n\t"
"movl 0x0(%%edx), %%eax" "\n\t"
"movl %%eax, %%fs:0" "\n\t"
:
/* No outputs */
:
[registration] "m" (registration),
[ok] "i" (TCL_OK),
[error] "i" (TCL_ERROR)
:
"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"
);
#else /* HAVE_NO_SEH */
__try {
Tcl_Finalize();
} __except (EXCEPTION_EXECUTE_HANDLER) {
/* empty handler body. */
}
#endif
break;
}
return TRUE;
}
#endif /* !STATIC_BUILD */
#endif /* __WIN32__ */
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
*
*----------------------------------------------------------------------
*/
int
TclpCheckStackSpace()
{
int retval = 0;
/*
* We can recurse only if there is at least TCL_WIN_STACK_THRESHOLD
* bytes of stack space left. alloca() is cheap on windows; basically
* it just subtracts from the stack pointer causing the OS to throw an
* exception if the stack pointer is set below the bottom of the stack.
*/
#ifdef HAVE_NO_SEH
| > > > > < | > > > > | | > > > > > > | > > > > | > > > > | > > > | > > > > > > > > > > > > > > > | > > > > | > | > > | | | > > > > > > > > > > | | < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 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 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 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 797 798 799 800 801 802 803 804 805 806 807 808 809 |
*
*----------------------------------------------------------------------
*/
int
TclpCheckStackSpace()
{
#ifdef HAVE_NO_SEH
EXCEPTION_REGISTRATION registration;
#endif
int retval = 0;
/*
* We can recurse only if there is at least TCL_WIN_STACK_THRESHOLD
* bytes of stack space left. alloca() is cheap on windows; basically
* it just subtracts from the stack pointer causing the OS to throw an
* exception if the stack pointer is set below the bottom of the stack.
*/
#ifdef HAVE_NO_SEH
__asm__ __volatile__ (
/*
* Construct an EXCEPTION_REGISTRATION to protect the
* call to __alloca
*/
"leal %[registration], %%edx" "\n\t"
"movl %%fs:0, %%eax" "\n\t"
"movl %%eax, 0x0(%%edx)" "\n\t" /* link */
"leal 1f, %%eax" "\n\t"
"movl %%eax, 0x4(%%edx)" "\n\t" /* handler */
"movl %%ebp, 0x8(%%edx)" "\n\t" /* ebp */
"movl %%esp, 0xc(%%edx)" "\n\t" /* esp */
"movl %[error], 0x10(%%edx)" "\n\t" /* status */
/*
* Link the EXCEPTION_REGISTRATION on the chain
*/
"movl %%edx, %%fs:0" "\n\t"
/*
* Attempt a call to __alloca, to determine whether there's
* sufficient memory to be had.
*/
"movl %[size], %%eax" "\n\t"
"pushl %%eax" "\n\t"
"call __alloca" "\n\t"
/*
* Come here on a normal exit. Recover the EXCEPTION_REGISTRATION
* and store a TCL_OK status
*/
"movl %%fs:0, %%edx" "\n\t"
"movl %[ok], %%eax" "\n\t"
"movl %%eax, 0x10(%%edx)" "\n\t"
"jmp 2f" "\n"
/*
* Come here on an exception. Get the EXCEPTION_REGISTRATION
* that we previously put on the chain.
*/
"1:" "\t"
"movl %%fs:0, %%edx" "\n\t"
"movl 0x8(%%edx), %%edx" "\n\t"
/*
* Come here however we exited. Restore context from the
* EXCEPTION_REGISTRATION in case the stack is unbalanced.
*/
"2:" "\t"
"movl 0xc(%%edx), %%esp" "\n\t"
"movl 0x8(%%edx), %%ebp" "\n\t"
"movl 0x0(%%edx), %%eax" "\n\t"
"movl %%eax, %%fs:0" "\n\t"
:
/* No outputs */
:
[registration] "m" (registration),
[ok] "i" (TCL_OK),
[error] "i" (TCL_ERROR),
[size] "i" (TCL_WIN_STACK_THRESHOLD)
:
"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"
);
retval = (registration.status == TCL_OK);
#else /* !HAVE_NO_SEH */
__try {
#ifdef HAVE_ALLOCA_GCC_INLINE
__asm__ __volatile__ (
"movl %0, %%eax" "\n\t"
"call __alloca" "\n\t"
:
: "i"(TCL_WIN_STACK_THRESHOLD)
: "%eax");
#else
alloca(TCL_WIN_STACK_THRESHOLD);
#endif /* HAVE_ALLOCA_GCC_INLINE */
retval = 1;
} __except (EXCEPTION_EXECUTE_HANDLER) {}
#endif /* HAVE_NO_SEH */
return retval;
}
/*
*---------------------------------------------------------------------------
*
* TclWinSetInterfaces --
*
* A helper proc that allows the test library to change the
* tclWinProcs structure to dispatch to either the wide-character
* or multi-byte versions of the operating system calls, depending
* on whether Unicode is the system encoding.
*
* As well as this, we can also try to load in some additional
* procs which may/may not be present depending on the current
* Windows version (e.g. Win95 will not have the procs below).
*
* Results:
* None.
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
void
TclWinSetInterfaces(
int wide) /* Non-zero to use wide interfaces, 0
* otherwise. */
{
Tcl_FreeEncoding(tclWinTCharEncoding);
if (wide) {
tclWinProcs = &unicodeProcs;
tclWinTCharEncoding = Tcl_GetEncoding(NULL, "unicode");
if (tclWinProcs->getFileAttributesExProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("kernel32");
if (hInstance != NULL) {
tclWinProcs->getFileAttributesExProc =
(BOOL (WINAPI *)(CONST TCHAR *, GET_FILEEX_INFO_LEVELS,
LPVOID)) GetProcAddress(hInstance, "GetFileAttributesExW");
tclWinProcs->createHardLinkProc =
(BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR*,
LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance,
"CreateHardLinkW");
tclWinProcs->findFirstFileExProc =
(HANDLE (WINAPI *)(CONST TCHAR*, UINT,
LPVOID, UINT, LPVOID, DWORD)) GetProcAddress(hInstance,
"FindFirstFileExW");
tclWinProcs->getVolumeNameForVMPProc =
(BOOL (WINAPI *)(CONST TCHAR*, TCHAR*,
DWORD)) GetProcAddress(hInstance,
"GetVolumeNameForVolumeMountPointW");
tclWinProcs->getLongPathNameProc =
(DWORD (WINAPI *)(CONST TCHAR*, TCHAR*,
DWORD)) GetProcAddress(hInstance,
"GetLongPathNameW");
FreeLibrary(hInstance);
}
hInstance = LoadLibraryA("advapi32");
if (hInstance != NULL) {
tclWinProcs->getFileSecurityProc = (BOOL (WINAPI *)(
LPCTSTR lpFileName,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength,
LPDWORD lpnLengthNeeded)) GetProcAddress(hInstance,
"GetFileSecurityW");
tclWinProcs->impersonateSelfProc = (BOOL (WINAPI *) (
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel))
GetProcAddress(hInstance, "ImpersonateSelf");
tclWinProcs->openThreadTokenProc = (BOOL (WINAPI *) (
HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf,
PHANDLE TokenHandle)) GetProcAddress(hInstance,
"OpenThreadToken");
tclWinProcs->revertToSelfProc = (BOOL (WINAPI *) (void))
GetProcAddress(hInstance, "RevertToSelf");
tclWinProcs->mapGenericMaskProc = (VOID (WINAPI *) (
PDWORD AccessMask, PGENERIC_MAPPING GenericMapping))
GetProcAddress(hInstance, "MapGenericMask");
tclWinProcs->accessCheckProc = (BOOL (WINAPI *)(
PSECURITY_DESCRIPTOR pSecurityDescriptor,
HANDLE ClientToken, DWORD DesiredAccess,
PGENERIC_MAPPING GenericMapping,
PPRIVILEGE_SET PrivilegeSet,
LPDWORD PrivilegeSetLength,
LPDWORD GrantedAccess,
LPBOOL AccessStatus)) GetProcAddress(hInstance,
"AccessCheck");
FreeLibrary(hInstance);
}
}
} else {
tclWinProcs = &asciiProcs;
tclWinTCharEncoding = NULL;
if (tclWinProcs->getFileAttributesExProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("kernel32");
if (hInstance != NULL) {
tclWinProcs->getFileAttributesExProc =
(BOOL (WINAPI *)(CONST TCHAR *, GET_FILEEX_INFO_LEVELS,
LPVOID)) GetProcAddress(hInstance, "GetFileAttributesExA");
tclWinProcs->createHardLinkProc =
(BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR*,
LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance,
"CreateHardLinkA");
tclWinProcs->findFirstFileExProc = NULL;
tclWinProcs->getLongPathNameProc = NULL;
/*
* The 'findFirstFileExProc' function exists on some
* of 95/98/ME, but it seems not to work as anticipated.
* Therefore we don't set this function pointer. The
* relevant code will fall back on a slower approach
* using the normal findFirstFileProc.
*
* (HANDLE (WINAPI *)(CONST TCHAR*, UINT,
* LPVOID, UINT, LPVOID, DWORD)) GetProcAddress(hInstance,
* "FindFirstFileExA");
*/
tclWinProcs->getVolumeNameForVMPProc =
(BOOL (WINAPI *)(CONST TCHAR*, TCHAR*,
DWORD)) GetProcAddress(hInstance,
"GetVolumeNameForVolumeMountPointA");
FreeLibrary(hInstance);
}
}
}
}
/*
*---------------------------------------------------------------------------
*
* TclWinResetInterfaceEncodings --
*
* Called during finalization to free up any encodings we use.
* The tclWinProcs-> look up table is still ok to use after
* this call, provided no encoding conversion is required.
*
* We also clean up any memory allocated in our mount point
* map which is used to follow certain kinds of symlinks.
* That code should never be used once encodings are taken
* down.
*
* Results:
* None.
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
void
TclWinResetInterfaceEncodings()
{
MountPointMap *dlIter, *dlIter2;
if (tclWinTCharEncoding != NULL) {
Tcl_FreeEncoding(tclWinTCharEncoding);
tclWinTCharEncoding = NULL;
}
/* Clean up the mount point map */
Tcl_MutexLock(&mountPointMap);
dlIter = driveLetterLookup;
while (dlIter != NULL) {
dlIter2 = dlIter->nextPtr;
ckfree((char*)dlIter->volumeName);
ckfree((char*)dlIter);
dlIter = dlIter2;
}
Tcl_MutexUnlock(&mountPointMap);
}
/*
*---------------------------------------------------------------------------
*
* TclWinResetInterfaces --
*
* Called during finalization to reset us to a safe state for reuse.
* After this call, it is best not to use the tclWinProcs-> look
* up table since it is likely to be different to what is expected.
*
* Results:
* None.
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
void
TclWinResetInterfaces()
{
tclWinProcs = &asciiProcs;
|
| ︙ | ︙ | |||
908 909 910 911 912 913 914 |
* simple way to map a unique volume name to a DOS drive letter.
* So, we have to build an associative array.
*/
Tcl_MutexLock(&mountPointMap);
dlIter = driveLetterLookup;
while (dlIter != NULL) {
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > | < < < < < < < < < < < < < < | | | | | | | > > > > | | | > > | | > | > > > > | > > | > | < > | < < > > > > > < > > > > > > > > > > > > > > > | > > | | | < < < < > | | | < < | | | > | | | > > > | > > | 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 |
* simple way to map a unique volume name to a DOS drive letter.
* So, we have to build an associative array.
*/
Tcl_MutexLock(&mountPointMap);
dlIter = driveLetterLookup;
while (dlIter != NULL) {
if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
/*
* We need to check whether this information is
* still valid, since either the user or various
* programs could have adjusted the mount points on
* the fly.
*/
drive[0] = L'A' + (dlIter->driveLetter - 'A');
/* Try to read the volume mount point and see where it points */
if ((*tclWinProcs->getVolumeNameForVMPProc)((TCHAR*)drive,
(TCHAR*)Target, 55) != 0) {
if (wcscmp((WCHAR*)dlIter->volumeName, Target) == 0) {
/* Nothing has changed */
Tcl_MutexUnlock(&mountPointMap);
return dlIter->driveLetter;
}
}
/*
* If we reach here, unfortunately, this mount point is
* no longer valid at all
*/
if (driveLetterLookup == dlIter) {
dlPtr2 = dlIter;
driveLetterLookup = dlIter->nextPtr;
} else {
for (dlPtr2 = driveLetterLookup;
dlPtr2 != NULL; dlPtr2 = dlPtr2->nextPtr) {
if (dlPtr2->nextPtr == dlIter) {
dlPtr2->nextPtr = dlIter->nextPtr;
dlPtr2 = dlIter;
break;
}
}
}
/* Now dlPtr2 points to the structure to free */
ckfree((char*)dlPtr2->volumeName);
ckfree((char*)dlPtr2);
/*
* Restart the loop --- we could try to be clever
* and continue half way through, but the logic is a
* bit messy, so it's cleanest just to restart
*/
dlIter = driveLetterLookup;
continue;
}
dlIter = dlIter->nextPtr;
}
/* We couldn't find it, so we must iterate over the letters */
for (drive[0] = L'A'; drive[0] <= L'Z'; drive[0]++) {
/* Try to read the volume mount point and see where it points */
if ((*tclWinProcs->getVolumeNameForVMPProc)((TCHAR*)drive,
(TCHAR*)Target, 55) != 0) {
int alreadyStored = 0;
for (dlIter = driveLetterLookup; dlIter != NULL;
dlIter = dlIter->nextPtr) {
if (wcscmp((WCHAR*)dlIter->volumeName, Target) == 0) {
alreadyStored = 1;
break;
}
}
if (!alreadyStored) {
dlPtr2 = (MountPointMap*) ckalloc(sizeof(MountPointMap));
dlPtr2->volumeName = TclNativeDupInternalRep(Target);
dlPtr2->driveLetter = 'A' + (drive[0] - L'A');
dlPtr2->nextPtr = driveLetterLookup;
driveLetterLookup = dlPtr2;
}
}
}
/* Try again */
for (dlIter = driveLetterLookup; dlIter != NULL;
dlIter = dlIter->nextPtr) {
if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
Tcl_MutexUnlock(&mountPointMap);
return dlIter->driveLetter;
}
}
/*
* The volume doesn't appear to correspond to a drive letter -- we
* remember that fact and store '-1' so we don't have to look it
* up each time.
*/
dlPtr2 = (MountPointMap*) ckalloc(sizeof(MountPointMap));
dlPtr2->volumeName = TclNativeDupInternalRep((ClientData)mountPoint);
dlPtr2->driveLetter = -1;
dlPtr2->nextPtr = driveLetterLookup;
driveLetterLookup = dlPtr2;
Tcl_MutexUnlock(&mountPointMap);
return -1;
}
/*
*---------------------------------------------------------------------------
*
* Tcl_WinUtfToTChar, Tcl_WinTCharToUtf --
*
* Convert between UTF-8 and Unicode when running Windows NT or
* the current ANSI code page when running Windows 95.
*
* On Mac, Unix, and Windows 95, all strings exchanged between Tcl
* and the OS are "char" oriented. We need only one Tcl_Encoding to
* convert between UTF-8 and the system's native encoding. We use
* NULL to represent that encoding.
*
* On NT, some strings exchanged between Tcl and the OS are "char"
* oriented, while others are in Unicode. We need two Tcl_Encoding
* APIs depending on whether we are targeting a "char" or Unicode
* interface.
*
* Calling Tcl_UtfToExternal() or Tcl_ExternalToUtf() with an
* encoding of NULL should always used to convert between UTF-8
* and the system's "char" oriented encoding. The following two
* functions are used in Windows-specific code to convert between
* UTF-8 and Unicode strings (NT) or "char" strings(95). This saves
* you the trouble of writing the following type of fragment over and
* over:
*
* if (running NT) {
* encoding <- Tcl_GetEncoding("unicode");
* nativeBuffer <- UtfToExternal(encoding, utfBuffer);
* Tcl_FreeEncoding(encoding);
* } else {
* nativeBuffer <- UtfToExternal(NULL, utfBuffer);
* }
*
* By convention, in Windows a TCHAR is a character in the ANSI code
* page on Windows 95, a Unicode character on Windows NT. If you
* plan on targeting a Unicode interfaces when running on NT and a
* "char" oriented interface while running on 95, these functions
* should be used. If you plan on targetting the same "char"
* oriented function on both 95 and NT, use Tcl_UtfToExternal()
* with an encoding of NULL.
*
* Results:
* The result is a pointer to the string in the desired target
* encoding. Storage for the result string is allocated in
* dsPtr; the caller must call Tcl_DStringFree() when the result
* is no longer needed.
*
* Side effects:
* None.
*
*---------------------------------------------------------------------------
*/
TCHAR *
Tcl_WinUtfToTChar(string, len, dsPtr)
CONST char *string; /* Source string in UTF-8. */
int len; /* Source string length in bytes, or < 0 for
* strlen(). */
Tcl_DString *dsPtr; /* Uninitialized or free DString in which
* the converted string is stored. */
{
return (TCHAR *) Tcl_UtfToExternalDString(tclWinTCharEncoding,
string, len, dsPtr);
}
char *
Tcl_WinTCharToUtf(string, len, dsPtr)
CONST TCHAR *string; /* Source string in Unicode when running
* NT, ANSI when running 95. */
int len; /* Source string length in bytes, or < 0 for
* platform-specific string length. */
Tcl_DString *dsPtr; /* Uninitialized or free DString in which
* the converted string is stored. */
{
return Tcl_ExternalToUtfDString(tclWinTCharEncoding,
(CONST char *) string, len, dsPtr);
}
/*
*------------------------------------------------------------------------
*
* TclWinCPUID --
*
* Get CPU ID information on an Intel box under Windows
*
* Results:
* Returns TCL_OK if successful, TCL_ERROR if CPUID is not
* supported or fails.
*
* Side effects:
* If successful, stores EAX, EBX, ECX and EDX registers after
* the CPUID instruction in the four integers designated by 'regsPtr'
*
*----------------------------------------------------------------------
*/
int
TclWinCPUID( unsigned int index, /* Which CPUID value to retrieve */
unsigned int * regsPtr ) /* Registers after the CPUID */
{
#ifdef HAVE_NO_SEH
EXCEPTION_REGISTRATION registration;
#endif
int status = TCL_ERROR;
#if defined(__GNUC__) && !defined(_WIN64)
/*
* Execute the CPUID instruction with the given index, and
* store results off 'regPtr'.
*/
__asm__ __volatile__ (
/*
* Construct an EXCEPTION_REGISTRATION to protect the
* CPUID instruction (early 486's don't have CPUID)
*/
"leal %[registration], %%edx" "\n\t"
"movl %%fs:0, %%eax" "\n\t"
"movl %%eax, 0x0(%%edx)" "\n\t" /* link */
"leal 1f, %%eax" "\n\t"
"movl %%eax, 0x4(%%edx)" "\n\t" /* handler */
"movl %%ebp, 0x8(%%edx)" "\n\t" /* ebp */
"movl %%esp, 0xc(%%edx)" "\n\t" /* esp */
"movl %[error], 0x10(%%edx)" "\n\t" /* status */
/*
* Link the EXCEPTION_REGISTRATION on the chain
*/
"movl %%edx, %%fs:0" "\n\t"
/*
* Do the CPUID instruction, and save the results in
* the 'regsPtr' area
*/
"movl %[rptr], %%edi" "\n\t"
"movl %[index], %%eax" "\n\t"
"cpuid" "\n\t"
"movl %%eax, 0x0(%%edi)" "\n\t"
"movl %%ebx, 0x4(%%edi)" "\n\t"
"movl %%ecx, 0x8(%%edi)" "\n\t"
"movl %%edx, 0xc(%%edi)" "\n\t"
/*
* Come here on a normal exit. Recover the EXCEPTION_REGISTRATION
* and store a TCL_OK status
*/
"movl %%fs:0, %%edx" "\n\t"
"movl %[ok], %%eax" "\n\t"
"movl %%eax, 0x10(%%edx)" "\n\t"
"jmp 2f" "\n"
/*
* Come here on an exception. Get the EXCEPTION_REGISTRATION
* that we previously put on the chain.
*/
"1:" "\t"
"movl %%fs:0, %%edx" "\n\t"
"movl 0x8(%%edx), %%edx" "\n\t"
/*
* Come here however we exited. Restore context from the
* EXCEPTION_REGISTRATION in case the stack is unbalanced.
*/
"2:" "\t"
"movl 0xc(%%edx), %%esp" "\n\t"
"movl 0x8(%%edx), %%ebp" "\n\t"
"movl 0x0(%%edx), %%eax" "\n\t"
"movl %%eax, %%fs:0" "\n\t"
:
/* No outputs */
:
[index] "m" (index),
[rptr] "m" (regsPtr),
[registration] "m" (registration),
[ok] "i" (TCL_OK),
[error] "i" (TCL_ERROR)
:
"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory" );
status = registration.status;
#elif defined(_MSC_VER) && !defined(_WIN64)
/* Define a structure in the stack frame to hold the registers */
struct {
DWORD dw0;
|
| ︙ | ︙ | |||
1212 1213 1214 1215 1216 1217 1218 |
#else
/* Don't know how to do assembly code for
* this compiler and/or architecture */
#endif
return status;
}
| | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1168 1169 1170 1171 1172 1173 1174 1175 |
#else
/* Don't know how to do assembly code for
* this compiler and/or architecture */
#endif
return status;
}
|
Changes to win/tclWinChan.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclWinChan.c * * Channel drivers for Windows channels based on files, command * pipes and TCP sockets. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclWinChan.c * * Channel drivers for Windows channels based on files, command * pipes and TCP sockets. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinChan.c,v 1.39.2.1 2005/06/13 01:47:20 msofer Exp $ */ #include "tclWinInt.h" #include "tclIO.h" /* * State flags used in the info structures below. |
| ︙ | ︙ | |||
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
Tcl_WideInt offset, int mode, int *errorCode));
static void FileSetupProc _ANSI_ARGS_((ClientData clientData,
int flags));
static void FileWatchProc _ANSI_ARGS_((ClientData instanceData,
int mask));
static void FileThreadActionProc _ANSI_ARGS_ ((
ClientData instanceData, int action));
/*
* This structure describes the channel type structure for file based IO.
*/
static Tcl_ChannelType fileChannelType = {
"file", /* Type name. */
| > > | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
Tcl_WideInt offset, int mode, int *errorCode));
static void FileSetupProc _ANSI_ARGS_((ClientData clientData,
int flags));
static void FileWatchProc _ANSI_ARGS_((ClientData instanceData,
int mask));
static void FileThreadActionProc _ANSI_ARGS_ ((
ClientData instanceData, int action));
static int FileTruncateProc _ANSI_ARGS_ ((
ClientData instanceData, Tcl_WideInt length));
/*
* This structure describes the channel type structure for file based IO.
*/
static Tcl_ChannelType fileChannelType = {
"file", /* Type name. */
|
| ︙ | ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
FileGetHandleProc, /* Get an OS handle from channel. */
NULL, /* close2proc. */
FileBlockProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
FileWideSeekProc, /* Wide seek proc. */
FileThreadActionProc, /* Thread action proc. */
};
#if defined(HAVE_NO_SEH) && defined(TCL_MEM_DEBUG)
static void *INITIAL_ESP, *INITIAL_EBP, *INITIAL_HANDLER;
static void *RESTORED_ESP, *RESTORED_EBP, *RESTORED_HANDLER;
#endif /* HAVE_NO_SEH && TCL_MEM_DEBUG */
| > | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
FileGetHandleProc, /* Get an OS handle from channel. */
NULL, /* close2proc. */
FileBlockProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
FileWideSeekProc, /* Wide seek proc. */
FileThreadActionProc, /* Thread action proc. */
FileTruncateProc, /* Truncate proc. */
};
#if defined(HAVE_NO_SEH) && defined(TCL_MEM_DEBUG)
static void *INITIAL_ESP, *INITIAL_EBP, *INITIAL_HANDLER;
static void *RESTORED_ESP, *RESTORED_EBP, *RESTORED_HANDLER;
#endif /* HAVE_NO_SEH && TCL_MEM_DEBUG */
|
| ︙ | ︙ | |||
569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
TclWinConvertError(winError);
*errorCodePtr = errno;
return -1;
}
}
return (Tcl_LongAsWide(newPos) | (Tcl_LongAsWide(newPosHigh) << 32));
}
/*
*----------------------------------------------------------------------
*
* FileInputProc --
*
* Reads input from the IO channel into the buffer given. Returns
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 |
TclWinConvertError(winError);
*errorCodePtr = errno;
return -1;
}
}
return (Tcl_LongAsWide(newPos) | (Tcl_LongAsWide(newPosHigh) << 32));
}
/*
*----------------------------------------------------------------------
*
* FileTruncateProc --
*
* Truncates a file-based channel. Returns the error code.
*
* Results:
* 0 if successful, POSIX-y error code if it failed.
*
* Side effects:
* Truncates the file, may move file pointers too.
*
*----------------------------------------------------------------------
*/
static int
FileTruncateProc(instanceData, length)
ClientData instanceData; /* File state. */
Tcl_WideInt length; /* Length to truncate at. */
{
FileInfo *infoPtr = (FileInfo *) instanceData;
LONG newPos, newPosHigh, oldPos, oldPosHigh;
/*
* Save where we were...
*/
oldPosHigh = 0;
oldPos = SetFilePointer(infoPtr->handle, 0, &oldPosHigh, FILE_CURRENT);
if (oldPos == INVALID_SET_FILE_POINTER) {
DWORD winError = GetLastError();
if (winError != NO_ERROR) {
TclWinConvertError(winError);
return errno;
}
}
/*
* Move to where we want to truncate
*/
newPosHigh = Tcl_WideAsLong(length >> 32);
newPos = SetFilePointer(infoPtr->handle, Tcl_WideAsLong(length),
&newPosHigh, FILE_BEGIN);
if (newPos == INVALID_SET_FILE_POINTER) {
DWORD winError = GetLastError();
if (winError != NO_ERROR) {
TclWinConvertError(winError);
return errno;
}
}
/*
* Perform the truncation (unlike POSIX ftruncate(), we needed to
* move to the location to truncate at first).
*/
if (!SetEndOfFile(infoPtr->handle)) {
TclWinConvertError(GetLastError());
return errno;
}
/*
* Move back. If this last step fails, we don't care; it's just a
* "best effort" attempt to restore our file pointer to where it
* was.
*/
SetFilePointer(infoPtr->handle, oldPos, &oldPosHigh, FILE_BEGIN);
return 0;
}
/*
*----------------------------------------------------------------------
*
* FileInputProc --
*
* Reads input from the IO channel into the buffer given. Returns
|
| ︙ | ︙ |
Changes to win/tclWinConsole.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclWinConsole.c -- * * This file implements the Windows-specific console functions, * and the "console" channel driver. * * Copyright (c) 1999 by Scriptics Corp. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclWinConsole.c -- * * This file implements the Windows-specific console functions, * and the "console" channel driver. * * Copyright (c) 1999 by Scriptics Corp. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinConsole.c,v 1.13.2.1 2005/06/13 01:47:20 msofer Exp $ */ #include "tclWinInt.h" #include <fcntl.h> #include <io.h> #include <sys/stat.h> |
| ︙ | ︙ |
Changes to win/tclWinFCmd.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclWinFCmd.c * * This file implements the Windows specific portion of file manipulation * subcommands of the "file" command. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclWinFCmd.c * * This file implements the Windows specific portion of file manipulation * subcommands of the "file" command. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinFCmd.c,v 1.44.2.1 2005/06/13 01:47:20 msofer Exp $ */ #include "tclWinInt.h" /* * The following constants specify the type of callback when * TraverseWinTree() calls the traverseProc() |
| ︙ | ︙ |
Changes to win/tclWinFile.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclWinFile.c -- * * This file contains temporary wrappers around UNIX file handling * functions. These wrappers map the UNIX functions to Win32 HANDLE-style * files, which can be manipulated through the Win32 console redirection * interfaces. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclWinFile.c -- * * This file contains temporary wrappers around UNIX file handling * functions. These wrappers map the UNIX functions to Win32 HANDLE-style * files, which can be manipulated through the Win32 console redirection * interfaces. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinFile.c,v 1.72.4.1 2005/06/13 01:47:20 msofer Exp $ */ //#define _WIN32_WINNT 0x0500 #include "tclWinInt.h" #include "tclFileSystem.h" #include <winioctl.h> |
| ︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 | static int NativeReadReparse(CONST TCHAR* LinkDirectory, REPARSE_DATA_BUFFER* buffer); static int NativeWriteReparse(CONST TCHAR* LinkDirectory, REPARSE_DATA_BUFFER* buffer); static int NativeMatchType(int isDrive, DWORD attr, CONST TCHAR* nativeName, Tcl_GlobTypeData *types); static int WinIsDrive(CONST char *name, int nameLen); static Tcl_Obj* WinReadLink(CONST TCHAR* LinkSource); static Tcl_Obj* WinReadLinkDirectory(CONST TCHAR* LinkDirectory); static int WinLink(CONST TCHAR* LinkSource, CONST TCHAR* LinkTarget, int linkAction); static int WinSymLinkDirectory(CONST TCHAR* LinkDirectory, CONST TCHAR* LinkTarget); | > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | static int NativeReadReparse(CONST TCHAR* LinkDirectory, REPARSE_DATA_BUFFER* buffer); static int NativeWriteReparse(CONST TCHAR* LinkDirectory, REPARSE_DATA_BUFFER* buffer); static int NativeMatchType(int isDrive, DWORD attr, CONST TCHAR* nativeName, Tcl_GlobTypeData *types); static int WinIsDrive(CONST char *name, int nameLen); static int WinIsReserved(CONST char *path); static Tcl_Obj* WinReadLink(CONST TCHAR* LinkSource); static Tcl_Obj* WinReadLinkDirectory(CONST TCHAR* LinkDirectory); static int WinLink(CONST TCHAR* LinkSource, CONST TCHAR* LinkTarget, int linkAction); static int WinSymLinkDirectory(CONST TCHAR* LinkDirectory, CONST TCHAR* LinkTarget); |
| ︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 |
/* Path is pointing to the root volume */
return 1;
} else if ((name[1] == ':')
&& (len == 2 || (name[2] == '/' || name[2] == '\\'))) {
/* Path is of the form 'x:' or 'x:/' or 'x:\' */
return 1;
}
}
return 0;
}
/*
*----------------------------------------------------------------------
*
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/* Path is pointing to the root volume */
return 1;
} else if ((name[1] == ':')
&& (len == 2 || (name[2] == '/' || name[2] == '\\'))) {
/* Path is of the form 'x:' or 'x:/' or 'x:\' */
return 1;
}
}
return 0;
}
/*
* Does the given path represent a reserved window path name? If not
* return 0, if true, return the number of characters of the path that
* we actually want (not any trailing :).
*/
static int WinIsReserved(
CONST char *path) /* Path in UTF-8 */
{
if ((path[0] == 'c' || path[0] == 'C')
&& (path[1] == 'o' || path[1] == 'O')) {
if ((path[2] == 'm' || path[2] == 'M')
&& path[3] >= '1' && path[3] <= '4') {
/* May have match for 'com[1-4]:?', which is a serial port */
if (path[4] == '\0') {
return 4;
} else if (path [4] == ':' && path[5] == '\0') {
return 4;
}
} else if ((path[2] == 'n' || path[2] == 'N') && path[3] == '\0') {
/* Have match for 'con' */
return 3;
}
} else if ((path[0] == 'l' || path[0] == 'L')
&& (path[1] == 'p' || path[1] == 'P')
&& (path[2] == 't' || path[2] == 'T')) {
if (path[3] >= '1' && path[3] <= '3') {
/* May have match for 'lpt[1-3]:?' */
if (path[4] == '\0') {
return 4;
} else if (path [4] == ':' && path[5] == '\0') {
return 4;
}
}
} else if (stricmp(path, "prn") == 0) {
/* Have match for 'prn' */
return 3;
} else if (stricmp(path, "nul") == 0) {
/* Have match for 'nul' */
return 3;
} else if (stricmp(path, "aux") == 0) {
/* Have match for 'aux' */
return 3;
}
return 0;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
2347 2348 2349 2350 2351 2352 2353 |
/*
* Now we convert the tail of the current path to its
* 'long form', and append it to 'dsNorm' which holds
* the current normalized path, if the file exists.
*/
if (isDrive) {
| | < > > > > > > > > > > > > > > | 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 |
/*
* Now we convert the tail of the current path to its
* 'long form', and append it to 'dsNorm' which holds
* the current normalized path, if the file exists.
*/
if (isDrive) {
if (GetFileAttributesA(nativePath) == 0xffffffff) {
/* File doesn't exist */
if (isDrive) {
int len = WinIsReserved(path);
if (len > 0) {
/* Actually it does exist - COM1, etc */
int i;
for (i=0;i<len;i++) {
if (nativePath[i] >= 'a') {
((char*)nativePath)[i] -= ('a' - 'A');
}
}
Tcl_DStringAppend(&dsNorm, nativePath, len);
lastValidPathEnd = currentPathEndPosition;
}
}
Tcl_DStringFree(&ds);
break;
}
if (nativePath[0] >= 'a') {
((char*)nativePath)[0] -= ('a' - 'A');
}
Tcl_DStringAppend(&dsNorm,nativePath,Tcl_DStringLength(&ds));
|
| ︙ | ︙ | |||
2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 |
/* Reached directory separator, or end of string */
WIN32_FILE_ATTRIBUTE_DATA data;
CONST char *nativePath = Tcl_WinUtfToTChar(path,
currentPathEndPosition - path, &ds);
if ((*tclWinProcs->getFileAttributesExProc)(nativePath,
GetFileExInfoStandard, &data) != TRUE) {
/* File doesn't exist */
Tcl_DStringFree(&ds);
break;
}
/*
* File 'nativePath' does exist if we get here. We
* now want to check if it is a symlink and otherwise
| > > > > > > > > > > > > > > > > > | 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 |
/* Reached directory separator, or end of string */
WIN32_FILE_ATTRIBUTE_DATA data;
CONST char *nativePath = Tcl_WinUtfToTChar(path,
currentPathEndPosition - path, &ds);
if ((*tclWinProcs->getFileAttributesExProc)(nativePath,
GetFileExInfoStandard, &data) != TRUE) {
/* File doesn't exist */
if (isDrive) {
int len = WinIsReserved(path);
if (len > 0) {
/* Actually it does exist - COM1, etc */
int i;
for (i=0;i<len;i++) {
WCHAR wc = ((WCHAR*)nativePath)[i];
if (wc >= L'a') {
wc -= (L'a' - L'A');
((WCHAR*)nativePath)[i] = wc;
}
}
Tcl_DStringAppend(&dsNorm, nativePath,
sizeof(WCHAR)*len);
lastValidPathEnd = currentPathEndPosition;
}
}
Tcl_DStringFree(&ds);
break;
}
/*
* File 'nativePath' does exist if we get here. We
* now want to check if it is a symlink and otherwise
|
| ︙ | ︙ |
Changes to win/tclWinInit.c.
1 2 3 4 5 6 7 8 9 | /* * tclWinInit.c -- * * Contains the Windows-specific interpreter initialization functions. * * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tclWinInit.c -- * * Contains the Windows-specific interpreter initialization functions. * * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * * RCS: @(#) $Id: tclWinInit.c,v 1.65.2.1 2005/06/13 01:47:21 msofer Exp $ */ #include "tclWinInt.h" #include <winnt.h> #include <winbase.h> #include <lmcons.h> |
| ︙ | ︙ |
Changes to win/tclWinNotify.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclWinNotify.c -- * * This file contains Windows-specific procedures for the notifier, * which is the lowest-level part of the Tcl event loop. This file * works together with ../generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclWinNotify.c -- * * This file contains Windows-specific procedures for the notifier, * which is the lowest-level part of the Tcl event loop. This file * works together with ../generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinNotify.c,v 1.17.2.1 2005/06/13 01:47:21 msofer Exp $ */ #include "tclInt.h" /* * The follwing static indicates whether this module has been initialized. */ |
| ︙ | ︙ | |||
448 449 450 451 452 453 454 |
* to real-time.
*/
Tcl_Time myTime;
myTime.sec = timePtr->sec;
myTime.usec = timePtr->usec;
| > | > | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
* to real-time.
*/
Tcl_Time myTime;
myTime.sec = timePtr->sec;
myTime.usec = timePtr->usec;
if (myTime.sec != 0 || myTime.usec != 0) {
(*tclScaleTimeProcPtr) (&myTime, tclTimeClientData);
}
timeout = myTime.sec * 1000 + myTime.usec / 1000;
} else {
timeout = INFINITE;
}
/*
|
| ︙ | ︙ |
Changes to win/tclWinPipe.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclWinPipe.c -- * * This file implements the Windows-specific exec pipeline functions, * the "pipe" channel driver, and the "pid" Tcl command. * * Copyright (c) 1996-1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclWinPipe.c -- * * This file implements the Windows-specific exec pipeline functions, * the "pipe" channel driver, and the "pid" Tcl command. * * Copyright (c) 1996-1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinPipe.c,v 1.54.2.1 2005/06/13 01:47:21 msofer Exp $ */ #include "tclWinInt.h" #include <fcntl.h> #include <io.h> #include <sys/stat.h> |
| ︙ | ︙ |
Changes to win/tclWinPort.h.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclWinPort.h -- * * This header file handles porting issues that occur because of * differences between Windows and Unix. It should be the only * file that contains #ifdefs to handle different flavors of OS. * * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclWinPort.h -- * * This header file handles porting issues that occur because of * differences between Windows and Unix. It should be the only * file that contains #ifdefs to handle different flavors of OS. * * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinPort.h,v 1.43.4.1 2005/06/13 01:47:22 msofer Exp $ */ #ifndef _TCLWINPORT #define _TCLWINPORT #ifdef CHECK_UNICODE_CALLS # define _UNICODE |
| ︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #include <float.h> #include <io.h> #include <malloc.h> #include <process.h> #include <signal.h> #include <string.h> /* * Need to block out these includes for building extensions with MetroWerks * compiler for Win32. */ #ifndef __MWERKS__ #include <sys/stat.h> | > > > > > > > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include <float.h> #include <io.h> #include <malloc.h> #include <process.h> #include <signal.h> #include <string.h> /* * These string functions are not defined with the same names on Windows. */ #define strcasecmp stricmp #define strncasecmp strnicmp /* * Need to block out these includes for building extensions with MetroWerks * compiler for Win32. */ #ifndef __MWERKS__ #include <sys/stat.h> |
| ︙ | ︙ |
Changes to win/tclWinSerial.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclWinSerial.c -- * * This file implements the Windows-specific serial port functions, * and the "serial" channel driver. * * Copyright (c) 1999 by Scriptics Corp. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Serial functionality implemented by Rolf.Schroedter@dlr.de * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclWinSerial.c -- * * This file implements the Windows-specific serial port functions, * and the "serial" channel driver. * * Copyright (c) 1999 by Scriptics Corp. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Serial functionality implemented by Rolf.Schroedter@dlr.de * * RCS: @(#) $Id: tclWinSerial.c,v 1.29.2.1 2005/06/13 01:47:23 msofer Exp $ */ #include "tclWinInt.h" #include <fcntl.h> #include <io.h> #include <sys/stat.h> |
| ︙ | ︙ |
Changes to win/tclWinSock.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclWinSock.c -- * * This file contains Windows-specific socket related code. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclWinSock.c -- * * This file contains Windows-specific socket related code. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinSock.c,v 1.45.2.1 2005/06/13 01:47:23 msofer Exp $ */ #include "tclWinInt.h" /* * Make sure to remove the redirection defines set in tclWinPort.h * that is in use in other sections of the core, except for us. |
| ︙ | ︙ |
Changes to win/tclWinThrd.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclWinThread.c -- * * This file implements the Windows-specific thread operations. * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclWinThread.c -- * * This file implements the Windows-specific thread operations. * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinThrd.c,v 1.34.4.1 2005/06/13 01:47:24 msofer Exp $ */ #include "tclWinInt.h" #include <fcntl.h> #include <io.h> #include <sys/stat.h> |
| ︙ | ︙ | |||
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
typedef struct WinCondition {
CRITICAL_SECTION condLock; /* Lock to serialize queuing on the condition */
struct ThreadSpecificData *firstPtr; /* Queue pointers */
struct ThreadSpecificData *lastPtr;
} WinCondition;
/*
*----------------------------------------------------------------------
*
* TclpThreadCreate --
*
* This procedure creates a new thread.
| > > > > > > > > > > > > | 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 |
typedef struct WinCondition {
CRITICAL_SECTION condLock; /* Lock to serialize queuing on the condition */
struct ThreadSpecificData *firstPtr; /* Queue pointers */
struct ThreadSpecificData *lastPtr;
} WinCondition;
/*
* Additions by AOL for specialized thread memory allocator.
*/
#ifdef USE_THREAD_ALLOC
static int once;
static DWORD tlsKey;
typedef struct allocMutex {
Tcl_Mutex tlock;
CRITICAL_SECTION wlock;
} allocMutex;
#endif
/*
*----------------------------------------------------------------------
*
* TclpThreadCreate --
*
* This procedure creates a new thread.
|
| ︙ | ︙ | |||
679 680 681 682 683 684 685 |
TclpFinalizeThreadData(keyPtr)
Tcl_ThreadDataKey *keyPtr;
{
VOID *result;
DWORD *indexPtr;
BOOL success;
| < < < > > > > > > | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
TclpFinalizeThreadData(keyPtr)
Tcl_ThreadDataKey *keyPtr;
{
VOID *result;
DWORD *indexPtr;
BOOL success;
if (*keyPtr != NULL) {
indexPtr = *(DWORD **)keyPtr;
result = (VOID *)TlsGetValue(*indexPtr);
if (result != NULL) {
#if defined(USE_THREAD_ALLOC) && !defined(TCL_MEM_DEBUG)
if (indexPtr == &tlsKey) {
TclpFreeAllocCache(result);
return;
}
#endif
ckfree((char *)result);
success = TlsSetValue(*indexPtr, (void *)NULL);
if (!success) {
Tcl_Panic("TlsSetValue failed from TclpFinalizeThreadData!");
}
} else {
if (GetLastError() != NO_ERROR) {
|
| ︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 |
}
}
/*
* Additions by AOL for specialized thread memory allocator.
*/
#ifdef USE_THREAD_ALLOC
| < < < < < < < | 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 |
}
}
/*
* Additions by AOL for specialized thread memory allocator.
*/
#ifdef USE_THREAD_ALLOC
Tcl_Mutex *
TclpNewAllocMutex(void)
{
struct allocMutex *lockPtr;
lockPtr = malloc(sizeof(struct allocMutex));
|
| ︙ | ︙ | |||
1076 1077 1078 1079 1080 1081 1082 |
void *
TclpGetAllocCache(void)
{
VOID *result;
if (!once) {
/*
| | | | | | | < < > > > > > | | < | < > > | < < | < | | < > | 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 |
void *
TclpGetAllocCache(void)
{
VOID *result;
if (!once) {
/*
* We need to make sure that TclpFreeAllocCache is called
* on each thread that calls this, but only on threads that
* call this.
*/
tlsKey = TlsAlloc();
once = 1;
if (tlsKey == TLS_OUT_OF_INDEXES) {
Tcl_Panic("could not allocate thread local storage");
}
}
result = TlsGetValue(tlsKey);
if ((result == NULL) && (GetLastError() != NO_ERROR)) {
Tcl_Panic("TlsGetValue failed from TclpGetAllocCache!");
}
return result;
}
void
TclpSetAllocCache(void *ptr)
{
BOOL success;
success = TlsSetValue(tlsKey, ptr);
if (!success) {
Tcl_Panic("TlsSetValue failed from TclpSetAllocCache!");
}
}
void
TclpFreeAllocCache(void *ptr)
{
BOOL success;
if (ptr != NULL) {
/*
* Called by us in TclpFinalizeThreadData when a thread exits
* and destroys the tsd key which stores allocator caches.
*/
TclFreeAllocCache(ptr);
success = TlsSetValue(tlsKey, NULL);
if (!success) {
panic("TlsSetValue failed from TclpFreeAllocCache!");
}
} else if (once) {
/*
* Called by us in TclFinalizeThreadAlloc() during
* the library finalization initiated from Tcl_Finalize()
*/
success = TlsFree(tlsKey);
if (!success) {
Tcl_Panic("TlsFree failed from TclpFreeAllocCache!");
}
once = 0; /* reset for next time. */
}
}
#endif /* USE_THREAD_ALLOC */
#endif /* TCL_THREADS */
|
Changes to win/tclWinTime.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclWinTime.c -- * * Contains Windows specific versions of Tcl functions that * obtain time values from the operating system. * * Copyright 1995-1998 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclWinTime.c -- * * Contains Windows specific versions of Tcl functions that * obtain time values from the operating system. * * Copyright 1995-1998 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinTime.c,v 1.29.2.1 2005/06/13 01:47:24 msofer Exp $ */ #include "tclInt.h" #define SECSPERDAY (60L * 60L * 24L) #define SECSPERYEAR (SECSPERDAY * 365L) #define SECSPER4YEAR (SECSPERYEAR * 4L + SECSPERDAY) |
| ︙ | ︙ |